clarifai 10.11.2rc2__py3-none-any.whl → 10.11.2rc3__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "10.11.2rc2"
1
+ __version__ = "10.11.2rc3"
@@ -29,16 +29,19 @@ def _clear_line(n: int = 1) -> None:
29
29
 
30
30
  class ModelUploader:
31
31
 
32
- def __init__(self, folder: str, validate_api_ids: bool = True):
32
+ def __init__(self, folder: str, validate_api_ids: bool = True, download_validation_only=False):
33
33
  """
34
34
  :param folder: The folder containing the model.py, config.yaml, requirements.txt and
35
35
  checkpoints.
36
- :param validate_api_ids: Whether to validate the user_id and app_id in the config file.
36
+ :param validate_api_ids: Whether to validate the user_id and app_id in the config file. TODO:
37
+ deprecate in favor of download_validation_only.
38
+ :param download_validation_only: Whether to skip the API config validation. Set to True if
39
+ just downloading a checkpoint.
37
40
  """
38
41
  self._client = None
42
+ self.download_validation_only = download_validation_only
39
43
  self.folder = self._validate_folder(folder)
40
44
  self.config = self._load_config(os.path.join(self.folder, 'config.yaml'))
41
- self.validate_api_ids = validate_api_ids
42
45
  self._validate_config()
43
46
  self.model_proto = self._get_model_proto()
44
47
  self.model_id = self.model_proto.id
@@ -46,19 +49,21 @@ class ModelUploader:
46
49
  self.inference_compute_info = self._get_inference_compute_info()
47
50
  self.is_v3 = True # Do model build for v3
48
51
 
49
- @staticmethod
50
- def _validate_folder(folder):
52
+ def _validate_folder(self, folder):
51
53
  if not folder.startswith("/"):
52
54
  folder = os.path.join(os.getcwd(), folder)
53
55
  logger.info(f"Validating folder: {folder}")
54
56
  if not os.path.exists(folder):
55
57
  raise FileNotFoundError(f"Folder {folder} not found, please provide a valid folder path")
56
58
  files = os.listdir(folder)
57
- assert "requirements.txt" in files, "requirements.txt not found in the folder"
58
59
  assert "config.yaml" in files, "config.yaml not found in the folder"
60
+ # If just downloading we don't need requirements.txt or the python code, we do need the
61
+ # 1/ folder to put 1/checkpoints into.
59
62
  assert "1" in files, "Subfolder '1' not found in the folder"
60
- subfolder_files = os.listdir(os.path.join(folder, '1'))
61
- assert 'model.py' in subfolder_files, "model.py not found in the folder"
63
+ if not self.download_validation_only:
64
+ assert "requirements.txt" in files, "requirements.txt not found in the folder"
65
+ subfolder_files = os.listdir(os.path.join(folder, '1'))
66
+ assert 'model.py' in subfolder_files, "model.py not found in the folder"
62
67
  return folder
63
68
 
64
69
  @staticmethod
@@ -83,8 +88,6 @@ class ModelUploader:
83
88
  return repo_id, hf_token
84
89
 
85
90
  def _check_app_exists(self):
86
- if not self.validate_api_ids:
87
- return True
88
91
  resp = self.client.STUB.GetApp(service_pb2.GetAppRequest(user_app_id=self.client.user_app_id))
89
92
  if resp.status.code == status_code_pb2.SUCCESS:
90
93
  return True
@@ -114,16 +117,14 @@ class ModelUploader:
114
117
  sys.exit(1)
115
118
 
116
119
  def _validate_config(self):
117
- self._validate_config_model()
118
-
119
- if self.config.get("checkpoints"):
120
- self._validate_config_checkpoints()
120
+ if not self.download_validation_only:
121
+ self._validate_config_model()
121
122
 
122
- assert "inference_compute_info" in self.config, "inference_compute_info not found in the config file"
123
+ assert "inference_compute_info" in self.config, "inference_compute_info not found in the config file"
123
124
 
124
- if self.config.get("concepts"):
125
- model_type_id = self.config.get('model').get('model_type_id')
126
- assert model_type_id in CONCEPTS_REQUIRED_MODEL_TYPE, f"Model type {model_type_id} not supported for concepts"
125
+ if self.config.get("concepts"):
126
+ model_type_id = self.config.get('model').get('model_type_id')
127
+ assert model_type_id in CONCEPTS_REQUIRED_MODEL_TYPE, f"Model type {model_type_id} not supported for concepts"
127
128
 
128
129
  if self.config.get("checkpoints"):
129
130
  _, hf_token = self._validate_config_checkpoints()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clarifai
3
- Version: 10.11.2rc2
3
+ Version: 10.11.2rc3
4
4
  Summary: Clarifai Python SDK
5
5
  Home-page: https://github.com/Clarifai/clarifai-python
6
6
  Author: Clarifai
@@ -1,4 +1,4 @@
1
- clarifai/__init__.py,sha256=REHNxfXEu4hO10MzxhqE0eEABGHhr7fJC2K18uUkiFE,27
1
+ clarifai/__init__.py,sha256=CeWkfe22NXjzgsoSQ84l50ZL9fR1MatZEVOZm2BBGZ4,27
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
@@ -186,14 +186,14 @@ clarifai/runners/models/model_class.py,sha256=9JSPAr4U4K7xI0kSl-q0mHB06zknm2OR-8
186
186
  clarifai/runners/models/model_run_locally.py,sha256=OhzQbmaV8Wwgs2H0KhdDF6Z7bYSaIh4RRA0QwSiv5vY,20644
187
187
  clarifai/runners/models/model_runner.py,sha256=3vzoastQxkGRDK8T9aojDsLNBb9A3IiKm6YmbFrE9S0,6241
188
188
  clarifai/runners/models/model_servicer.py,sha256=X4715PVA5PBurRTYcwSEudg8fShGV6InAF4mmRlRcHg,2826
189
- clarifai/runners/models/model_upload.py,sha256=4_tyT18unNV7QpFBfFCanKny4wMHDulfULZT4Son2yo,22923
189
+ clarifai/runners/models/model_upload.py,sha256=L5BbODARRDBXIV8DBe9_6jT37oNQw4PuzRrwKfy37mg,23250
190
190
  clarifai/runners/models/__pycache__/__init__.cpython-310.pyc,sha256=GTFjzypyx5wnDGqxYeY01iya1CELKb5fOFBFLV031yU,171
191
191
  clarifai/runners/models/__pycache__/base_typed_model.cpython-310.pyc,sha256=xni4ij1KhISxAia1j-Q1PDSX65tOYYjyfPlIxOxtlFs,8273
192
192
  clarifai/runners/models/__pycache__/model_class.cpython-310.pyc,sha256=OxOQDH4G_XXvXCOChWLjONFVcDWdr6T00JjQvKx1AgA,1889
193
193
  clarifai/runners/models/__pycache__/model_run_locally.cpython-310.pyc,sha256=_vm1H_HBCwWRpl-3mVjRIVbvHDYM6-sz9OheR1BmzcE,17040
194
194
  clarifai/runners/models/__pycache__/model_runner.cpython-310.pyc,sha256=lMrT9MMO3sLTo11zSv5XYTBQte3oY23esUFV4Wdnquw,5108
195
195
  clarifai/runners/models/__pycache__/model_servicer.cpython-310.pyc,sha256=w5kENnKCiiZSpZF6g7N1wljHbnan3pi_mhZBm_VvD4Q,2489
196
- clarifai/runners/models/__pycache__/model_upload.cpython-310.pyc,sha256=OiN-ZtidnMP_D95E0j-YvimcRS0b8ewSyb27chdkKtg,19274
196
+ clarifai/runners/models/__pycache__/model_upload.cpython-310.pyc,sha256=3iBqzh3IXS42yi4fYLJTZ594G9UGYX9xXw4NItrA5sI,19274
197
197
  clarifai/runners/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
198
198
  clarifai/runners/utils/const.py,sha256=eyBrj5ywuGKPF-IFipm7yjiYyLhnsKhMNZ6xF-OvykQ,1250
199
199
  clarifai/runners/utils/data_handler.py,sha256=sxy9zlAgI6ETuxCQhUgEXAn2GCsaW1GxpK6GTaMne0g,6966
@@ -205,7 +205,7 @@ clarifai/runners/utils/__pycache__/__init__.cpython-310.pyc,sha256=PRPZOzUV5Z8gr
205
205
  clarifai/runners/utils/__pycache__/const.cpython-310.pyc,sha256=oEBBn71Dyzuo25Rrt-UwPSUT7EAOliC1QZUYFVhW4vI,1028
206
206
  clarifai/runners/utils/__pycache__/data_handler.cpython-310.pyc,sha256=YVncnM0NaHeMaZAyALxaHCdtUT6n5E3BI99-54Bs6HM,7961
207
207
  clarifai/runners/utils/__pycache__/data_utils.cpython-310.pyc,sha256=1e6NiK6bnJiiAo2KPsDmm91BSlbI3mVkQZKbDfh5hBI,642
208
- clarifai/runners/utils/__pycache__/loader.cpython-310.pyc,sha256=svMKSepeCGYtgtGt3AObNK4t80Y_Q_7oNeoGoHbQ5oo,5058
208
+ clarifai/runners/utils/__pycache__/loader.cpython-310.pyc,sha256=smsd1eEst3buel_C8OcOhnyGBzvtBe_wrCEaBqhGTVo,6002
209
209
  clarifai/runners/utils/__pycache__/logging.cpython-310.pyc,sha256=VV0KFcnuYpFFtaG4EeDIgg7c4QEsBLo-eX_NnsyFEhA,331
210
210
  clarifai/runners/utils/__pycache__/url_fetcher.cpython-310.pyc,sha256=jFxVdOmm7DCkgatv1GwIXeefHthpvlkg4ybBlMnmxss,1739
211
211
  clarifai/schema/search.py,sha256=JjTi8ammJgZZ2OGl4K6tIA4zEJ1Fr2ASZARXavI1j5c,2448
@@ -234,9 +234,9 @@ clarifai/workflows/__pycache__/__init__.cpython-310.pyc,sha256=oRKg6B7Z-wWQy0EW2
234
234
  clarifai/workflows/__pycache__/export.cpython-310.pyc,sha256=cNmGLnww7xVpm4htd1vRhQJoEZ1dhpN1oD8iLLAtVzM,2418
235
235
  clarifai/workflows/__pycache__/utils.cpython-310.pyc,sha256=rm2kWk4a3GOKWoerXpEAEeRvGhEe7wPd0ZZ6jHtEGqY,1925
236
236
  clarifai/workflows/__pycache__/validate.cpython-310.pyc,sha256=QA1i6YdDpY824cqtQvkEaFPpaCa2iqfOwFouqwZfAKY,2139
237
- clarifai-10.11.2rc2.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
238
- clarifai-10.11.2rc2.dist-info/METADATA,sha256=Agq8Yp740aLqvNaYe4wWY8yIzkotmHxl_-ONWSLscQY,22237
239
- clarifai-10.11.2rc2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
240
- clarifai-10.11.2rc2.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
241
- clarifai-10.11.2rc2.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
242
- clarifai-10.11.2rc2.dist-info/RECORD,,
237
+ clarifai-10.11.2rc3.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
238
+ clarifai-10.11.2rc3.dist-info/METADATA,sha256=asimq_wgoMJRN83rnydqa8kUCc-AQBkwExjt_A01W34,22237
239
+ clarifai-10.11.2rc3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
240
+ clarifai-10.11.2rc3.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
241
+ clarifai-10.11.2rc3.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
242
+ clarifai-10.11.2rc3.dist-info/RECORD,,