clarifai 11.1.5rc8__py3-none-any.whl → 11.1.6rc1__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__/__main__.cpython-310.pyc +0 -0
- clarifai/cli/__pycache__/model.cpython-310.pyc +0 -0
- clarifai/cli/model.py +40 -50
- clarifai/client/model.py +393 -157
- clarifai/runners/__init__.py +7 -2
- clarifai/runners/__pycache__/__init__.cpython-310.pyc +0 -0
- clarifai/runners/dockerfile_template/Dockerfile.template +1 -4
- 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_runner.cpython-310.pyc +0 -0
- clarifai/runners/models/base_typed_model.py +238 -0
- clarifai/runners/models/model_builder.py +9 -26
- clarifai/runners/models/model_class.py +28 -256
- clarifai/runners/models/model_run_locally.py +78 -3
- clarifai/runners/models/model_runner.py +0 -2
- clarifai/runners/models/model_servicer.py +2 -11
- clarifai/runners/utils/__pycache__/data_handler.cpython-310.pyc +0 -0
- clarifai/runners/utils/__pycache__/data_types.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/data_handler.py +205 -308
- {clarifai-11.1.5rc8.dist-info → clarifai-11.1.6rc1.dist-info}/METADATA +1 -2
- {clarifai-11.1.5rc8.dist-info → clarifai-11.1.6rc1.dist-info}/RECORD +29 -28
- {clarifai-11.1.5rc8.dist-info → clarifai-11.1.6rc1.dist-info}/LICENSE +0 -0
- {clarifai-11.1.5rc8.dist-info → clarifai-11.1.6rc1.dist-info}/WHEEL +0 -0
- {clarifai-11.1.5rc8.dist-info → clarifai-11.1.6rc1.dist-info}/entry_points.txt +0 -0
- {clarifai-11.1.5rc8.dist-info → clarifai-11.1.6rc1.dist-info}/top_level.txt +0 -0
clarifai/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "11.1.
|
1
|
+
__version__ = "11.1.6rc1"
|
Binary file
|
Binary file
|
clarifai/cli/model.py
CHANGED
@@ -9,11 +9,7 @@ def model():
|
|
9
9
|
|
10
10
|
|
11
11
|
@model.command()
|
12
|
-
@click.
|
13
|
-
'--model_path',
|
14
|
-
type=click.Path(exists=True),
|
15
|
-
required=True,
|
16
|
-
help='Path to the model directory.')
|
12
|
+
@click.argument("model_path", type=click.Path(exists=True), required=False, default=".")
|
17
13
|
@click.option(
|
18
14
|
'--stage',
|
19
15
|
required=False,
|
@@ -30,17 +26,21 @@ def model():
|
|
30
26
|
'Flag to skip generating a dockerfile so that you can manually edit an already created dockerfile.',
|
31
27
|
)
|
32
28
|
def upload(model_path, stage, skip_dockerfile):
|
33
|
-
"""Upload a model to Clarifai.
|
29
|
+
"""Upload a model to Clarifai.
|
30
|
+
|
31
|
+
MODEL_PATH: Path to the model directory. If not specified, the current directory is used by default.
|
32
|
+
"""
|
34
33
|
from clarifai.runners.models.model_builder import upload_model
|
35
34
|
upload_model(model_path, stage, skip_dockerfile)
|
36
35
|
|
37
36
|
|
38
37
|
@model.command()
|
39
|
-
@click.
|
40
|
-
|
38
|
+
@click.argument(
|
39
|
+
"model_path",
|
41
40
|
type=click.Path(exists=True),
|
42
|
-
required=
|
43
|
-
|
41
|
+
required=False,
|
42
|
+
default=".",
|
43
|
+
)
|
44
44
|
@click.option(
|
45
45
|
'--out_path',
|
46
46
|
type=click.Path(exists=False),
|
@@ -59,7 +59,10 @@ def upload(model_path, stage, skip_dockerfile):
|
|
59
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.'
|
60
60
|
)
|
61
61
|
def download_checkpoints(model_path, out_path, stage):
|
62
|
-
"""Download checkpoints from external source to local model_path
|
62
|
+
"""Download checkpoints from external source to local model_path
|
63
|
+
|
64
|
+
MODEL_PATH: Path to the model directory. If not specified, the current directory is used by default.
|
65
|
+
"""
|
63
66
|
|
64
67
|
from clarifai.runners.models.model_builder import ModelBuilder
|
65
68
|
builder = ModelBuilder(model_path, download_validation_only=True)
|
@@ -67,36 +70,12 @@ def download_checkpoints(model_path, out_path, stage):
|
|
67
70
|
|
68
71
|
|
69
72
|
@model.command()
|
70
|
-
@click.
|
71
|
-
|
73
|
+
@click.argument(
|
74
|
+
"model_path",
|
72
75
|
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
76
|
required=False,
|
79
|
-
default=
|
80
|
-
|
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
|
-
|
94
|
-
@model.command()
|
95
|
-
@click.option(
|
96
|
-
'--model_path',
|
97
|
-
type=click.Path(exists=True),
|
98
|
-
required=True,
|
99
|
-
help='Path to the model directory.')
|
77
|
+
default=".",
|
78
|
+
)
|
100
79
|
@click.option(
|
101
80
|
'--mode',
|
102
81
|
type=click.Choice(['env', 'container'], case_sensitive=False),
|
@@ -118,7 +97,10 @@ def signatures(model_path, out_path):
|
|
118
97
|
'Keep the Docker image after testing the model locally (applicable for container mode). Defaults to False.'
|
119
98
|
)
|
120
99
|
def test_locally(model_path, keep_env=False, keep_image=False, mode='env'):
|
121
|
-
"""Test model locally.
|
100
|
+
"""Test model locally.
|
101
|
+
|
102
|
+
MODEL_PATH: Path to the model directory. If not specified, the current directory is used by default.
|
103
|
+
"""
|
122
104
|
try:
|
123
105
|
from clarifai.runners.models import model_run_locally
|
124
106
|
if mode == 'env' and keep_image:
|
@@ -139,11 +121,12 @@ def test_locally(model_path, keep_env=False, keep_image=False, mode='env'):
|
|
139
121
|
|
140
122
|
|
141
123
|
@model.command()
|
142
|
-
@click.
|
143
|
-
|
124
|
+
@click.argument(
|
125
|
+
"model_path",
|
144
126
|
type=click.Path(exists=True),
|
145
|
-
required=
|
146
|
-
|
127
|
+
required=False,
|
128
|
+
default=".",
|
129
|
+
)
|
147
130
|
@click.option(
|
148
131
|
'--port',
|
149
132
|
'-p',
|
@@ -172,7 +155,10 @@ def test_locally(model_path, keep_env=False, keep_image=False, mode='env'):
|
|
172
155
|
'Keep the Docker image after testing the model locally (applicable for container mode). Defaults to False.'
|
173
156
|
)
|
174
157
|
def run_locally(model_path, port, mode, keep_env, keep_image):
|
175
|
-
"""Run the model locally and start a gRPC server to serve the model.
|
158
|
+
"""Run the model locally and start a gRPC server to serve the model.
|
159
|
+
|
160
|
+
MODEL_PATH: Path to the model directory. If not specified, the current directory is used by default.
|
161
|
+
"""
|
176
162
|
try:
|
177
163
|
from clarifai.runners.models import model_run_locally
|
178
164
|
if mode == 'env' and keep_image:
|
@@ -197,13 +183,17 @@ def run_locally(model_path, port, mode, keep_env, keep_image):
|
|
197
183
|
|
198
184
|
|
199
185
|
@model.command()
|
200
|
-
@click.
|
201
|
-
|
186
|
+
@click.argument(
|
187
|
+
"model_path",
|
202
188
|
type=click.Path(exists=True),
|
203
|
-
required=
|
204
|
-
|
189
|
+
required=False,
|
190
|
+
default=".",
|
191
|
+
)
|
205
192
|
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.
|
193
|
+
"""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.
|
194
|
+
|
195
|
+
MODEL_PATH: Path to the model directory. If not specified, the current directory is used by default.
|
196
|
+
"""
|
207
197
|
from clarifai.runners.server import serve
|
208
198
|
serve(model_path)
|
209
199
|
|