clarifai 11.1.4rc1__py3-none-any.whl → 11.1.4rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clarifai/__init__.py +1 -1
- clarifai/cli/__pycache__/model.cpython-310.pyc +0 -0
- clarifai/cli/model.py +13 -3
- clarifai/runners/dockerfile_template/Dockerfile.template +1 -1
- clarifai/runners/models/__pycache__/model_builder.cpython-310.pyc +0 -0
- clarifai/runners/models/model_builder.py +18 -9
- clarifai/runners/utils/const.py +3 -0
- {clarifai-11.1.4rc1.dist-info → clarifai-11.1.4rc2.dist-info}/METADATA +1 -1
- {clarifai-11.1.4rc1.dist-info → clarifai-11.1.4rc2.dist-info}/RECORD +13 -13
- {clarifai-11.1.4rc1.dist-info → clarifai-11.1.4rc2.dist-info}/LICENSE +0 -0
- {clarifai-11.1.4rc1.dist-info → clarifai-11.1.4rc2.dist-info}/WHEEL +0 -0
- {clarifai-11.1.4rc1.dist-info → clarifai-11.1.4rc2.dist-info}/entry_points.txt +0 -0
- {clarifai-11.1.4rc1.dist-info → clarifai-11.1.4rc2.dist-info}/top_level.txt +0 -0
clarifai/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "11.1.
|
1
|
+
__version__ = "11.1.4rc2"
|
Binary file
|
clarifai/cli/model.py
CHANGED
@@ -14,16 +14,26 @@ def model():
|
|
14
14
|
type=click.Path(exists=True),
|
15
15
|
required=True,
|
16
16
|
help='Path to the model directory.')
|
17
|
+
@click.option(
|
18
|
+
'--download_checkpoints',
|
19
|
+
is_flag=True,
|
20
|
+
help=
|
21
|
+
'Flag to download checkpoints before uploading and including them in the tar file that is uploaded. Defaults to False, which will use the "when" field in config.yaml checkpoints section which can be "upload", "build", or "runtime".',
|
22
|
+
)
|
17
23
|
@click.option(
|
18
24
|
'--skip_dockerfile',
|
19
25
|
is_flag=True,
|
20
26
|
help=
|
21
27
|
'Flag to skip generating a dockerfile so that you can manually edit an already created dockerfile.',
|
22
28
|
)
|
23
|
-
def upload(model_path, skip_dockerfile):
|
29
|
+
def upload(model_path, download_checkpoints, skip_dockerfile):
|
24
30
|
"""Upload a model to Clarifai."""
|
25
31
|
from clarifai.runners.models.model_builder import upload_model
|
26
|
-
|
32
|
+
if download_checkpoints:
|
33
|
+
stage = "any" # ignore config.yaml and force download now.
|
34
|
+
else:
|
35
|
+
stage = "upload"
|
36
|
+
upload_model(model_path, stage, skip_dockerfile)
|
27
37
|
|
28
38
|
|
29
39
|
@model.command()
|
@@ -38,7 +48,7 @@ def upload(model_path, skip_dockerfile):
|
|
38
48
|
required=False,
|
39
49
|
default=None,
|
40
50
|
help=
|
41
|
-
'Option path to write the checkpoints to. This will place them in {out_path}/ If not provided it will default to {model_path}/1/checkpoints where the config.yaml is read
|
51
|
+
'Option path to write the checkpoints to. This will place them in {out_path}/1/checkpoints If not provided it will default to {model_path}/1/checkpoints where the config.yaml is read.'
|
42
52
|
)
|
43
53
|
@click.option(
|
44
54
|
'--stage',
|
@@ -49,7 +49,7 @@ COPY --chown=nonroot:nonroot downloader/unused.yaml /home/nonroot/main/1/checkpo
|
|
49
49
|
#####
|
50
50
|
# Download checkpoints if config.yaml has checkpoints.when = "build"
|
51
51
|
COPY --link=true config.yaml /home/nonroot/main/
|
52
|
-
RUN ["python", "-m", "clarifai.cli", "model", "download-checkpoints", "--model_path", "/home/nonroot/main", "--out_path", "/home/nonroot/main", "--stage", "build"]
|
52
|
+
RUN ["python", "-m", "clarifai.cli", "model", "download-checkpoints", "--model_path", "/home/nonroot/main", "--out_path", "/home/nonroot/main/1/checkpoints", "--stage", "build"]
|
53
53
|
#####
|
54
54
|
|
55
55
|
|
Binary file
|
@@ -18,7 +18,8 @@ from clarifai.client import BaseClient
|
|
18
18
|
from clarifai.runners.models.model_class import ModelClass
|
19
19
|
from clarifai.runners.utils.const import (
|
20
20
|
AVAILABLE_PYTHON_IMAGES, AVAILABLE_TORCH_IMAGES, CONCEPTS_REQUIRED_MODEL_TYPE,
|
21
|
-
DEFAULT_DOWNLOAD_CHECKPOINT_WHEN, DEFAULT_PYTHON_VERSION,
|
21
|
+
DEFAULT_DOWNLOAD_CHECKPOINT_WHEN, DEFAULT_PYTHON_VERSION, DEFAULT_RUNTIME_DOWNLOAD_PATH,
|
22
|
+
PYTHON_BASE_IMAGE, TORCH_BASE_IMAGE)
|
22
23
|
from clarifai.runners.utils.loader import HuggingFaceLoader
|
23
24
|
from clarifai.urls.helper import ClarifaiUrlHelper
|
24
25
|
from clarifai.utils.logging import logger
|
@@ -448,6 +449,9 @@ class ModelBuilder:
|
|
448
449
|
def tar_file(self):
|
449
450
|
return f"{self.folder}.tar.gz"
|
450
451
|
|
452
|
+
def default_runtime_checkpoint_path(self):
|
453
|
+
return DEFAULT_RUNTIME_DOWNLOAD_PATH
|
454
|
+
|
451
455
|
def download_checkpoints(self, stage: str, checkpoint_path_override: str = None):
|
452
456
|
"""
|
453
457
|
Downloads the checkpoints specified in the config file.
|
@@ -455,13 +459,16 @@ class ModelBuilder:
|
|
455
459
|
:param stage: The stage of the build process. This is used to determine when to download the
|
456
460
|
checkpoints. The stage can be one of ['build', 'upload', 'runtime', 'any']. If "any" it will always try to download
|
457
461
|
regardless of what is specified in config.yaml. Otherwise it must match what is in config.yaml
|
458
|
-
:param checkpoint_path_override: The path to download the checkpoints to. If not provided, the
|
459
|
-
default path is used based on the folder ModelUploader was initialized with. The
|
460
|
-
|
462
|
+
:param checkpoint_path_override: The path to download the checkpoints to (with 1/checkpoints added as suffix). If not provided, the
|
463
|
+
default path is used based on the folder ModelUploader was initialized with. The checkpoint_suffix will be appended to the path.
|
464
|
+
If stage is 'runtime' and checkpoint_path_override is None, the default runtime path will be used.
|
465
|
+
|
466
|
+
:return: The path to the downloaded checkpoints. Even if it doesn't download anything, it will return the default path.
|
461
467
|
"""
|
468
|
+
path = self.checkpoint_path # default checkpoint path.
|
462
469
|
if not self.config.get("checkpoints"):
|
463
470
|
logger.info("No checkpoints specified in the config file")
|
464
|
-
return
|
471
|
+
return path
|
465
472
|
|
466
473
|
loader_type, repo_id, hf_token, when = self._validate_config_checkpoints()
|
467
474
|
if stage not in ["build", "upload", "runtime", "any"]:
|
@@ -470,13 +477,15 @@ class ModelBuilder:
|
|
470
477
|
logger.info(
|
471
478
|
f"Skipping downloading checkpoints for stage {stage} since config.yaml says to download them at stage {when}"
|
472
479
|
)
|
473
|
-
return
|
480
|
+
return path
|
474
481
|
|
475
482
|
success = True
|
476
483
|
if loader_type == "huggingface":
|
477
484
|
loader = HuggingFaceLoader(repo_id=repo_id, token=hf_token)
|
478
|
-
|
479
|
-
|
485
|
+
# for runtime default to /tmp path
|
486
|
+
if stage == "runtime" and checkpoint_path_override is None:
|
487
|
+
checkpoint_path_override = self.default_runtime_checkpoint_path()
|
488
|
+
path = checkpoint_path_override if checkpoint_path_override else self.checkpoint_path
|
480
489
|
success = loader.download_checkpoints(path)
|
481
490
|
|
482
491
|
if loader_type:
|
@@ -485,7 +494,7 @@ class ModelBuilder:
|
|
485
494
|
sys.exit(1)
|
486
495
|
else:
|
487
496
|
logger.info(f"Downloaded checkpoints for model {repo_id}")
|
488
|
-
return
|
497
|
+
return path
|
489
498
|
|
490
499
|
def _concepts_protos_from_concepts(self, concepts):
|
491
500
|
concept_protos = []
|
clarifai/runners/utils/const.py
CHANGED
@@ -15,6 +15,9 @@ DEFAULT_PYTHON_VERSION = 3.12
|
|
15
15
|
# By default we download at runtime.
|
16
16
|
DEFAULT_DOWNLOAD_CHECKPOINT_WHEN = "runtime"
|
17
17
|
|
18
|
+
# Folder for downloading checkpoints at runtime.
|
19
|
+
DEFAULT_RUNTIME_DOWNLOAD_PATH = "/tmp/.cache"
|
20
|
+
|
18
21
|
# List of available torch images
|
19
22
|
# Keep sorted by most recent cuda version.
|
20
23
|
AVAILABLE_TORCH_IMAGES = [
|
@@ -1,4 +1,4 @@
|
|
1
|
-
clarifai/__init__.py,sha256=
|
1
|
+
clarifai/__init__.py,sha256=5OapSO2V91rqpOHdVy0RsIMd_yhKwAFpy7L2nTUB7hM,26
|
2
2
|
clarifai/cli.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
clarifai/errors.py,sha256=RwzTajwds51wLD0MVlMC5kcpBnzRpreDLlazPSBZxrg,2605
|
4
4
|
clarifai/versions.py,sha256=jctnczzfGk_S3EnVqb2FjRKfSREkNmvNEwAAa_VoKiQ,222
|
@@ -12,14 +12,14 @@ clarifai/cli/__main__.py~,sha256=ozwaF8wYiURORkuFhk0_wsDPUYZjH547Wz9eVk-4nro,70
|
|
12
12
|
clarifai/cli/base.py,sha256=eaUsp7S1e2dslC437Hjk7gUBQsng13ID3N3lkYotB2U,3403
|
13
13
|
clarifai/cli/compute_cluster.py,sha256=N2dNQNJEPg9nxsb8x2igEzYuGRzjn7l4kNttjFIxmhI,1827
|
14
14
|
clarifai/cli/deployment.py,sha256=sUEuz5-rtozMx8deVcJXLi6lHsP2jc8x3y2MpUAVfqY,2506
|
15
|
-
clarifai/cli/model.py,sha256=
|
15
|
+
clarifai/cli/model.py,sha256=yu4VBm8dNL2al2MrLq7Ohrkx92zRNTh9soLdkwNOKx4,10643
|
16
16
|
clarifai/cli/nodepool.py,sha256=yihxS_rIFoBBKzRlqBX8Ab42iPpBMJrJFsk8saph6ms,3049
|
17
17
|
clarifai/cli/__pycache__/__init__.cpython-310.pyc,sha256=4ksYQqqaAMCKwyxNsG7hfJGjXDc8y78s9n7AxCEaTQo,160
|
18
18
|
clarifai/cli/__pycache__/__main__.cpython-310.pyc,sha256=CM9FOqcSyt-DLnck7FovGDxqT4FPkge7ggq61EsRjjA,250
|
19
19
|
clarifai/cli/__pycache__/base.cpython-310.pyc,sha256=a7mN_r511p_Ao8aXrWU9KPSe8wkDZJW4p8UhlD6EoB8,3151
|
20
20
|
clarifai/cli/__pycache__/compute_cluster.cpython-310.pyc,sha256=NHLAcVEwqUhci0KB5DpnPWUqXcCttpWrA3F5zld4qN8,1985
|
21
21
|
clarifai/cli/__pycache__/deployment.cpython-310.pyc,sha256=AhfbPlwjjj_TmC2UayjuRbNr00dOukDl6NfLhm2rIng,2278
|
22
|
-
clarifai/cli/__pycache__/model.cpython-310.pyc,sha256=
|
22
|
+
clarifai/cli/__pycache__/model.cpython-310.pyc,sha256=Xv9ztIWC9wG2Yx9HB46gcBk6L34zpvQJFeDHmevuXLg,7978
|
23
23
|
clarifai/cli/__pycache__/nodepool.cpython-310.pyc,sha256=nEmM-s1HFg7xM5x-bpnqHFWAVLWj0J0ZskYtd6NSq20,2473
|
24
24
|
clarifai/client/__init__.py,sha256=xI1U0l5AZdRThvQAXCLsd9axxyFzXXJ22m8LHqVjQRU,662
|
25
25
|
clarifai/client/app.py,sha256=6pckYme1urV2YJjLIYfeZ-vH0Z5YSQa51jzIMcEfwug,38342
|
@@ -129,10 +129,10 @@ clarifai/runners/__pycache__/__init__.cpython-310.pyc,sha256=fDW5OMOxp7N8ZekWweA
|
|
129
129
|
clarifai/runners/__pycache__/server.cpython-310.pyc,sha256=a6yFsRHEWmPhlvVlBx4AhsOms7Q4If62hhmldpW_d6Q,3644
|
130
130
|
clarifai/runners/dockerfile_template/Dockerfile.debug,sha256=sRlfRmSLE_TiLORcVRx-3-B0vvSNeUYgm0CCrWmLvAA,667
|
131
131
|
clarifai/runners/dockerfile_template/Dockerfile.debug~,sha256=7YOVg3adIaiudfSkfLGeyxt-FfIBbD3UIIYccrIVJTs,426
|
132
|
-
clarifai/runners/dockerfile_template/Dockerfile.template,sha256=
|
132
|
+
clarifai/runners/dockerfile_template/Dockerfile.template,sha256=L2SSEBqkJcOtf02r0jrH1nzjcgVB0eRYx2gDLBU2iEs,3171
|
133
133
|
clarifai/runners/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
134
134
|
clarifai/runners/models/base_typed_model.py,sha256=0QCWxch8CcyJSKvE1D4PILd2RSnQZHTmx4DXlQQ6dpo,7856
|
135
|
-
clarifai/runners/models/model_builder.py,sha256=
|
135
|
+
clarifai/runners/models/model_builder.py,sha256=f3OS6mnDAWf4PvugCrED4-deAA0ea7y06ZDtdUKmfoI,32004
|
136
136
|
clarifai/runners/models/model_class.py,sha256=9JSPAr4U4K7xI0kSl-q0mHB06zknm2OR-8XIgBCto94,1611
|
137
137
|
clarifai/runners/models/model_run_locally.py,sha256=den2rmw7gDS7VIssz7cpoSDzPdw0yunLnmxPv0jiEbs,20638
|
138
138
|
clarifai/runners/models/model_runner.py,sha256=PyxwK-33hLlhkD07tTXkjWZ_iNlZHl9_8AZ2W7WfExI,6097
|
@@ -140,7 +140,7 @@ clarifai/runners/models/model_servicer.py,sha256=jtQmtGeQlvQ5ttMvVw7CMnNzq-rLkTa
|
|
140
140
|
clarifai/runners/models/model_upload.py,sha256=VjJgNNBPP9O7LkNCXxOqa0lTW1M7k6XKVyI6XlLdXIc,25095
|
141
141
|
clarifai/runners/models/__pycache__/__init__.cpython-310.pyc,sha256=GTFjzypyx5wnDGqxYeY01iya1CELKb5fOFBFLV031yU,171
|
142
142
|
clarifai/runners/models/__pycache__/base_typed_model.cpython-310.pyc,sha256=CubexZ9Ie7mrZcER8LE9V_KKESZgXZJS_JYxq5kYYMg,8271
|
143
|
-
clarifai/runners/models/__pycache__/model_builder.cpython-310.pyc,sha256=
|
143
|
+
clarifai/runners/models/__pycache__/model_builder.cpython-310.pyc,sha256=Y0KPtyrWfsToC3xLd36owymVdHueO_MbxmeYDizrcBM,25834
|
144
144
|
clarifai/runners/models/__pycache__/model_class.cpython-310.pyc,sha256=OxOQDH4G_XXvXCOChWLjONFVcDWdr6T00JjQvKx1AgA,1889
|
145
145
|
clarifai/runners/models/__pycache__/model_run_locally.cpython-310.pyc,sha256=35VGAU78qM0T6pVmIoHNhIe0pWrU5JOQtNF7xwp8wGE,17073
|
146
146
|
clarifai/runners/models/__pycache__/model_runner.cpython-310.pyc,sha256=OqkMwm5-oq9oOJOBaFWscG_yDOPXsZl3cpvZOnP8hMI,4964
|
@@ -148,7 +148,7 @@ clarifai/runners/models/__pycache__/model_servicer.cpython-310.pyc,sha256=w5kENn
|
|
148
148
|
clarifai/runners/models/__pycache__/model_upload.cpython-310.pyc,sha256=erkIUHtJv1ohMOFT8EAJuVfBsEY4o0GxpeXrZqjrfGk,21046
|
149
149
|
clarifai/runners/utils/#const.py#,sha256=H47gAAI93H0juXaz5dAXg2mPF5SmCxP8GXXVDVe49DU,929
|
150
150
|
clarifai/runners/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
151
|
-
clarifai/runners/utils/const.py,sha256=
|
151
|
+
clarifai/runners/utils/const.py,sha256=xnPeVuUHQ1K-LoEfhLCmzOV6UQoPS1jqDqQJ5h0IvPU,1024
|
152
152
|
clarifai/runners/utils/data_handler.py,sha256=sxy9zlAgI6ETuxCQhUgEXAn2GCsaW1GxpK6GTaMne0g,6966
|
153
153
|
clarifai/runners/utils/data_utils.py,sha256=R1iQ82TuQ9JwxCJk8yEB1Lyb0BYVhVbWJI9YDi1zGOs,318
|
154
154
|
clarifai/runners/utils/loader.py,sha256=SgNHMwRmCCymFQm8aDp73NmIUHhM-N60CBlTKbPzmVc,7470
|
@@ -186,9 +186,9 @@ clarifai/workflows/__pycache__/__init__.cpython-310.pyc,sha256=oRKg6B7Z-wWQy0EW2
|
|
186
186
|
clarifai/workflows/__pycache__/export.cpython-310.pyc,sha256=cNmGLnww7xVpm4htd1vRhQJoEZ1dhpN1oD8iLLAtVzM,2418
|
187
187
|
clarifai/workflows/__pycache__/utils.cpython-310.pyc,sha256=rm2kWk4a3GOKWoerXpEAEeRvGhEe7wPd0ZZ6jHtEGqY,1925
|
188
188
|
clarifai/workflows/__pycache__/validate.cpython-310.pyc,sha256=QA1i6YdDpY824cqtQvkEaFPpaCa2iqfOwFouqwZfAKY,2139
|
189
|
-
clarifai-11.1.
|
190
|
-
clarifai-11.1.
|
191
|
-
clarifai-11.1.
|
192
|
-
clarifai-11.1.
|
193
|
-
clarifai-11.1.
|
194
|
-
clarifai-11.1.
|
189
|
+
clarifai-11.1.4rc2.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
|
190
|
+
clarifai-11.1.4rc2.dist-info/METADATA,sha256=ATJvWHHlwjNR80XlRNvonuRfPNoznpqZlgcbpkMYNas,22198
|
191
|
+
clarifai-11.1.4rc2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
192
|
+
clarifai-11.1.4rc2.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
|
193
|
+
clarifai-11.1.4rc2.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
|
194
|
+
clarifai-11.1.4rc2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|