clarifai 11.0.1__py3-none-any.whl → 11.0.3__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__ = "11.0.1"
1
+ __version__ = "11.0.3"
@@ -29,10 +29,16 @@ def _clear_line(n: int = 1) -> None:
29
29
 
30
30
  class ModelUploader:
31
31
 
32
- def __init__(self, folder: str):
32
+ def __init__(self, folder: str, validate_api_ids: bool = True):
33
+ """
34
+ :param folder: The folder containing the model.py, config.yaml, requirements.txt and
35
+ checkpoints.
36
+ :param validate_api_ids: Whether to validate the user_id and app_id in the config file.
37
+ """
33
38
  self._client = None
34
39
  self.folder = self._validate_folder(folder)
35
40
  self.config = self._load_config(os.path.join(self.folder, 'config.yaml'))
41
+ self.validate_api_ids = validate_api_ids
36
42
  self._validate_config()
37
43
  self.model_proto = self._get_model_proto()
38
44
  self.model_id = self.model_proto.id
@@ -76,6 +82,8 @@ class ModelUploader:
76
82
  return repo_id, hf_token
77
83
 
78
84
  def _check_app_exists(self):
85
+ if not self.validate_api_ids:
86
+ return True
79
87
  resp = self.client.STUB.GetApp(service_pb2.GetAppRequest(user_app_id=self.client.user_app_id))
80
88
  if resp.status.code == status_code_pb2.SUCCESS:
81
89
  return True
@@ -1,39 +1,41 @@
1
- PYTHON_BASE_IMAGE = 'public.ecr.aws/clarifai-models/python-base:{python_version}'
2
- TORCH_BASE_IMAGE = 'public.ecr.aws/clarifai-models/torch:{torch_version}-py{python_version}-cuda{cuda_version}'
1
+ import os
2
+
3
+ registry = os.environ.get('CLARIFAI_BASE_IMAGE_REGISTRY', 'public.ecr.aws/clarifai-models')
4
+
5
+ PYTHON_BASE_IMAGE = registry + '/python-base:{python_version}'
6
+ TORCH_BASE_IMAGE = registry + '/torch:{torch_version}-py{python_version}-cuda{cuda_version}'
3
7
 
4
8
  # List of available python base images
5
- AVAILABLE_PYTHON_IMAGES = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
9
+ AVAILABLE_PYTHON_IMAGES = ['3.11', '3.12', '3.13']
6
10
 
7
- DEFAULT_PYTHON_VERSION = 3.11
11
+ DEFAULT_PYTHON_VERSION = 3.12
8
12
 
9
13
  # List of available torch images
10
14
  AVAILABLE_TORCH_IMAGES = [
11
- '1.13.1-py3.8-cuda117',
12
- '1.13.1-py3.9-cuda117',
13
- '1.13.1-py3.10-cuda117',
14
- '2.1.2-py3.8-cuda121',
15
- '2.1.2-py3.9-cuda121',
16
- '2.1.2-py3.10-cuda121',
17
- '2.1.2-py3.11-cuda121',
18
- '2.2.2-py3.8-cuda121',
19
- '2.2.2-py3.9-cuda121',
20
- '2.2.2-py3.10-cuda121',
21
15
  '2.2.2-py3.11-cuda121',
22
- '2.2.2-py3.12-cuda121',
23
- '2.3.1-py3.8-cuda121',
24
- '2.3.1-py3.9-cuda121',
25
- '2.3.1-py3.10-cuda121',
26
16
  '2.3.1-py3.11-cuda121',
27
- '2.3.1-py3.12-cuda121',
28
- '2.4.1-py3.8-cuda124',
29
- '2.4.1-py3.9-cuda124',
30
- '2.4.1-py3.10-cuda124',
17
+ '2.4.0-py3.11-cuda121',
18
+ '2.4.0-py3.11-cuda124',
19
+ '2.4.1-py3.11-cuda121',
31
20
  '2.4.1-py3.11-cuda124',
32
- '2.4.1-py3.12-cuda124',
33
- '2.5.1-py3.9-cuda124',
34
- '2.5.1-py3.10-cuda124',
21
+ '2.5.1-py3.11-cuda121',
35
22
  '2.5.1-py3.11-cuda124',
23
+ '2.2.2-py3.12-cuda121',
24
+ '2.3.1-py3.12-cuda121',
25
+ '2.4.0-py3.12-cuda121',
26
+ '2.4.0-py3.12-cuda124',
27
+ '2.4.1-py3.12-cuda121',
28
+ '2.4.1-py3.12-cuda124',
29
+ '2.5.1-py3.12-cuda121',
36
30
  '2.5.1-py3.12-cuda124',
31
+ # '2.2.2-py3.13-cuda121',
32
+ # '2.3.1-py3.13-cuda121',
33
+ # '2.4.0-py3.13-cuda121',
34
+ # '2.4.0-py3.13-cuda124',
35
+ # '2.4.1-py3.13-cuda121',
36
+ # '2.4.1-py3.13-cuda124',
37
+ # '2.5.1-py3.13-cuda121',
38
+ # '2.5.1-py3.13-cuda124',
37
39
  ]
38
40
  CONCEPTS_REQUIRED_MODEL_TYPE = [
39
41
  'visual-classifier', 'visual-detector', 'visual-segmenter', 'text-classifier'
@@ -39,7 +39,7 @@ class HuggingFaceLoader:
39
39
  def download_checkpoints(self, checkpoint_path: str):
40
40
  # throw error if huggingface_hub wasn't installed
41
41
  try:
42
- from huggingface_hub import snapshot_download
42
+ from huggingface_hub import list_repo_files, snapshot_download
43
43
  except ImportError:
44
44
  raise ImportError(self.HF_DOWNLOAD_TEXT)
45
45
  if os.path.exists(checkpoint_path) and self.validate_download(checkpoint_path):
@@ -52,8 +52,17 @@ class HuggingFaceLoader:
52
52
  if not is_hf_model_exists:
53
53
  logger.error("Model %s not found on Hugging Face" % (self.repo_id))
54
54
  return False
55
+
56
+ ignore_patterns = None # Download everything.
57
+ repo_files = list_repo_files(repo_id=self.repo_id, token=self.token)
58
+ if any(f.endswith(".safetensors") for f in repo_files):
59
+ logger.info(f"SafeTensors found in {self.repo_id}, downloading only .safetensors files.")
60
+ ignore_patterns = ["original/*", "*.pth", "*.bin"]
55
61
  snapshot_download(
56
- repo_id=self.repo_id, local_dir=checkpoint_path, local_dir_use_symlinks=False)
62
+ repo_id=self.repo_id,
63
+ local_dir=checkpoint_path,
64
+ local_dir_use_symlinks=False,
65
+ ignore_patterns=ignore_patterns)
57
66
  except Exception as e:
58
67
  logger.error(f"Error downloading model checkpoints {e}")
59
68
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: clarifai
3
- Version: 11.0.1
3
+ Version: 11.0.3
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=Zmzw2GjcXgMCFI3odyVpnnMKDMWMnQK5e88UxtrzWcY,23
1
+ clarifai/__init__.py,sha256=K00CpIHLj46O-cbNnxk2z-jzuaw9bwcK6iDyxoArIZg,23
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
@@ -69,12 +69,12 @@ clarifai/runners/models/model_class.py,sha256=9JSPAr4U4K7xI0kSl-q0mHB06zknm2OR-8
69
69
  clarifai/runners/models/model_run_locally.py,sha256=OhzQbmaV8Wwgs2H0KhdDF6Z7bYSaIh4RRA0QwSiv5vY,20644
70
70
  clarifai/runners/models/model_runner.py,sha256=3vzoastQxkGRDK8T9aojDsLNBb9A3IiKm6YmbFrE9S0,6241
71
71
  clarifai/runners/models/model_servicer.py,sha256=X4715PVA5PBurRTYcwSEudg8fShGV6InAF4mmRlRcHg,2826
72
- clarifai/runners/models/model_upload.py,sha256=ggUa1OwqZg57C-Dagf6U22fSC4SHKZ_mB4xMSynCtPg,22411
72
+ clarifai/runners/models/model_upload.py,sha256=NY1EyCUuG3EDEb1QVqFR8TDD_4Z2HtDSLSYREEfeEPo,22753
73
73
  clarifai/runners/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- clarifai/runners/utils/const.py,sha256=zINrIjDESUykq6xMLKNghwJ6N8qxDAtAJ6-1bH8VdOw,1238
74
+ clarifai/runners/utils/const.py,sha256=eyBrj5ywuGKPF-IFipm7yjiYyLhnsKhMNZ6xF-OvykQ,1250
75
75
  clarifai/runners/utils/data_handler.py,sha256=sxy9zlAgI6ETuxCQhUgEXAn2GCsaW1GxpK6GTaMne0g,6966
76
76
  clarifai/runners/utils/data_utils.py,sha256=R1iQ82TuQ9JwxCJk8yEB1Lyb0BYVhVbWJI9YDi1zGOs,318
77
- clarifai/runners/utils/loader.py,sha256=k2sZeH3awPDzF0HPeYqExZ1fEX6azAc8PCl5ddWOGKE,4414
77
+ clarifai/runners/utils/loader.py,sha256=O7L8Foc98CALA4FLUeQaRNw0d-y3K46lCJPXigsJd18,4858
78
78
  clarifai/runners/utils/url_fetcher.py,sha256=v_8JOWmkyFAzsBulsieKX7Nfjy1Yg7wGSZeqfEvw2cg,1640
79
79
  clarifai/schema/search.py,sha256=JjTi8ammJgZZ2OGl4K6tIA4zEJ1Fr2ASZARXavI1j5c,2448
80
80
  clarifai/urls/helper.py,sha256=tjoMGGHuWX68DUB0pk4MEjrmFsClUAQj2jmVEM_Sy78,4751
@@ -92,9 +92,9 @@ clarifai/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
92
92
  clarifai/workflows/export.py,sha256=vICRhIreqDSShxLKjHNM2JwzKsf1B4fdXB0ciMcA70k,1945
93
93
  clarifai/workflows/utils.py,sha256=nGeB_yjVgUO9kOeKTg4OBBaBz-AwXI3m-huSVj-9W18,1924
94
94
  clarifai/workflows/validate.py,sha256=yJq03MaJqi5AK3alKGJJBR89xmmjAQ31sVufJUiOqY8,2556
95
- clarifai-11.0.1.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
96
- clarifai-11.0.1.dist-info/METADATA,sha256=vmixUJQ2NNbLBg8KmGuOhwW50uGqphmLvOm_4y8dq8Q,22456
97
- clarifai-11.0.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
98
- clarifai-11.0.1.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
99
- clarifai-11.0.1.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
100
- clarifai-11.0.1.dist-info/RECORD,,
95
+ clarifai-11.0.3.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
96
+ clarifai-11.0.3.dist-info/METADATA,sha256=Sx6wc5afmi5brxqHlgkhBTrBvMpUThysnWHi2dbp7Hs,22456
97
+ clarifai-11.0.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
98
+ clarifai-11.0.3.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
99
+ clarifai-11.0.3.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
100
+ clarifai-11.0.3.dist-info/RECORD,,