clarifai 11.1.4rc2__py3-none-any.whl → 11.1.5rc1__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 +46 -10
- clarifai/client/model.py +89 -364
- clarifai/client/model_client.py +400 -0
- clarifai/client/workflow.py +2 -2
- clarifai/datasets/upload/loaders/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/datasets/upload/loaders/__pycache__/coco_detection.cpython-310.pyc +0 -0
- clarifai/rag/__pycache__/rag.cpython-310.pyc +0 -0
- clarifai/runners/__init__.py +2 -7
- clarifai/runners/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/runners/__pycache__/server.cpython-310.pyc +0 -0
- clarifai/runners/dockerfile_template/Dockerfile.template +4 -32
- clarifai/runners/models/__pycache__/base_typed_model.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_builder.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_class.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_run_locally.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_runner.cpython-310.pyc +0 -0
- clarifai/runners/models/__pycache__/model_servicer.cpython-310.pyc +0 -0
- clarifai/runners/models/model_builder.py +47 -20
- clarifai/runners/models/model_class.py +249 -25
- clarifai/runners/models/model_run_locally.py +5 -2
- clarifai/runners/models/model_runner.py +2 -0
- clarifai/runners/models/model_servicer.py +11 -2
- clarifai/runners/server.py +26 -9
- clarifai/runners/utils/__pycache__/const.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_handler.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/method_signatures.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/serializers.cpython-310.pyc +0 -0
- clarifai/runners/utils/const.py +1 -1
- clarifai/runners/utils/data_handler.py +308 -205
- clarifai/runners/utils/method_signatures.py +437 -0
- clarifai/runners/utils/serializers.py +132 -0
- clarifai/utils/evaluation/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/utils/evaluation/__pycache__/helpers.cpython-310.pyc +0 -0
- clarifai/utils/evaluation/__pycache__/main.cpython-310.pyc +0 -0
- clarifai/utils/misc.py +12 -0
- {clarifai-11.1.4rc2.dist-info → clarifai-11.1.5rc1.dist-info}/METADATA +3 -2
- {clarifai-11.1.4rc2.dist-info → clarifai-11.1.5rc1.dist-info}/RECORD +43 -36
- clarifai/runners/models/base_typed_model.py +0 -238
- clarifai/runners/models/model_upload.py +0 -607
- clarifai/runners/utils/#const.py# +0 -30
- {clarifai-11.1.4rc2.dist-info → clarifai-11.1.5rc1.dist-info}/LICENSE +0 -0
- {clarifai-11.1.4rc2.dist-info → clarifai-11.1.5rc1.dist-info}/WHEEL +0 -0
- {clarifai-11.1.4rc2.dist-info → clarifai-11.1.5rc1.dist-info}/entry_points.txt +0 -0
- {clarifai-11.1.4rc2.dist-info → clarifai-11.1.5rc1.dist-info}/top_level.txt +0 -0
clarifai/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "11.1.
|
1
|
+
__version__ = "11.1.5rc1"
|
Binary file
|
clarifai/cli/model.py
CHANGED
@@ -15,10 +15,13 @@ def model():
|
|
15
15
|
required=True,
|
16
16
|
help='Path to the model directory.')
|
17
17
|
@click.option(
|
18
|
-
'--
|
19
|
-
|
18
|
+
'--stage',
|
19
|
+
required=False,
|
20
|
+
type=click.Choice(['runtime', 'build', 'upload'], case_sensitive=True),
|
21
|
+
default="upload",
|
22
|
+
show_default=True,
|
20
23
|
help=
|
21
|
-
'
|
24
|
+
'The stage we are calling download checkpoints from. Typically this would "upload" and will download checkpoints if config.yaml checkpoints section has when set to "upload". Other options include "runtime" to be used in load_model or "upload" to be used during model upload. Set this stage to whatever you have in config.yaml to force downloading now.'
|
22
25
|
)
|
23
26
|
@click.option(
|
24
27
|
'--skip_dockerfile',
|
@@ -26,13 +29,9 @@ def model():
|
|
26
29
|
help=
|
27
30
|
'Flag to skip generating a dockerfile so that you can manually edit an already created dockerfile.',
|
28
31
|
)
|
29
|
-
def upload(model_path,
|
32
|
+
def upload(model_path, stage, skip_dockerfile):
|
30
33
|
"""Upload a model to Clarifai."""
|
31
34
|
from clarifai.runners.models.model_builder import upload_model
|
32
|
-
if download_checkpoints:
|
33
|
-
stage = "any" # ignore config.yaml and force download now.
|
34
|
-
else:
|
35
|
-
stage = "upload"
|
36
35
|
upload_model(model_path, stage, skip_dockerfile)
|
37
36
|
|
38
37
|
|
@@ -52,12 +51,12 @@ def upload(model_path, download_checkpoints, skip_dockerfile):
|
|
52
51
|
)
|
53
52
|
@click.option(
|
54
53
|
'--stage',
|
55
|
-
type=str,
|
56
54
|
required=False,
|
55
|
+
type=click.Choice(['runtime', 'build', 'upload'], case_sensitive=True),
|
57
56
|
default="build",
|
58
57
|
show_default=True,
|
59
58
|
help=
|
60
|
-
'The stage we are calling download checkpoints from. Typically this would be in the build stage which is the default. Other options include "runtime" to be used in load_model
|
59
|
+
'The stage we are calling download checkpoints from. Typically this would be in the build stage which is the default. Other options include "runtime" to be used in load_model or "upload" to be used during model upload. Set this stage to whatever you have in config.yaml to force downloading now.'
|
61
60
|
)
|
62
61
|
def download_checkpoints(model_path, out_path, stage):
|
63
62
|
"""Download checkpoints from external source to local model_path"""
|
@@ -67,6 +66,31 @@ def download_checkpoints(model_path, out_path, stage):
|
|
67
66
|
builder.download_checkpoints(stage=stage, checkpoint_path_override=out_path)
|
68
67
|
|
69
68
|
|
69
|
+
@model.command()
|
70
|
+
@click.option(
|
71
|
+
'--model_path',
|
72
|
+
type=click.Path(exists=True),
|
73
|
+
required=True,
|
74
|
+
help='Path to the model directory.')
|
75
|
+
@click.option(
|
76
|
+
'--out_path',
|
77
|
+
type=click.Path(exists=False),
|
78
|
+
required=False,
|
79
|
+
default=None,
|
80
|
+
help='Path to write the method signature defitions to. If not provided, use stdout.')
|
81
|
+
def signatures(model_path, out_path):
|
82
|
+
"""Generate method signatures for the model."""
|
83
|
+
|
84
|
+
from clarifai.runners.models.model_builder import ModelBuilder
|
85
|
+
builder = ModelBuilder(model_path, download_validation_only=True)
|
86
|
+
signatures = builder.method_signatures_yaml()
|
87
|
+
if out_path:
|
88
|
+
with open(out_path, 'w') as f:
|
89
|
+
f.write(signatures)
|
90
|
+
else:
|
91
|
+
click.echo(signatures)
|
92
|
+
|
93
|
+
|
70
94
|
@model.command()
|
71
95
|
@click.option(
|
72
96
|
'--model_path',
|
@@ -172,6 +196,18 @@ def run_locally(model_path, port, mode, keep_env, keep_image):
|
|
172
196
|
click.echo(f"Failed to starts model server locally: {e}", err=True)
|
173
197
|
|
174
198
|
|
199
|
+
@model.command()
|
200
|
+
@click.option(
|
201
|
+
'--model_path',
|
202
|
+
type=click.Path(exists=True),
|
203
|
+
required=True,
|
204
|
+
help='Path to the model directory.')
|
205
|
+
def local_dev(model_path):
|
206
|
+
"""Run the model as a local dev runner to help debug your model connected to the API. You must set several envvars such as CLARIFAI_PAT, CLARIFAI_RUNNER_ID, CLARIFAI_NODEPOOL_ID, CLARIFAI_COMPUTE_CLUSTER_ID. """
|
207
|
+
from clarifai.runners.server import serve
|
208
|
+
serve(model_path)
|
209
|
+
|
210
|
+
|
175
211
|
@model.command()
|
176
212
|
@click.option(
|
177
213
|
'--config',
|