clarifai 11.2.4rc2__py3-none-any.whl → 11.3.0__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.
Files changed (152) hide show
  1. clarifai/__init__.py +1 -1
  2. clarifai/client/deployment.py +3 -1
  3. clarifai/client/model.py +7 -3
  4. clarifai/runners/models/model_builder.py +0 -55
  5. clarifai/runners/models/model_class.py +4 -7
  6. clarifai/runners/utils/data_types.py +3 -3
  7. clarifai/runners/utils/data_utils.py +35 -36
  8. clarifai/runners/utils/method_signatures.py +0 -8
  9. clarifai/runners/utils/openai_convertor.py +126 -186
  10. clarifai/utils/protobuf.py +143 -0
  11. {clarifai-11.2.4rc2.dist-info → clarifai-11.3.0.dist-info}/METADATA +4 -3
  12. clarifai-11.3.0.dist-info/RECORD +107 -0
  13. {clarifai-11.2.4rc2.dist-info → clarifai-11.3.0.dist-info}/WHEEL +1 -1
  14. clarifai/__pycache__/__init__.cpython-310.pyc +0 -0
  15. clarifai/__pycache__/__init__.cpython-39.pyc +0 -0
  16. clarifai/__pycache__/errors.cpython-310.pyc +0 -0
  17. clarifai/__pycache__/versions.cpython-310.pyc +0 -0
  18. clarifai/cli/__pycache__/__init__.cpython-310.pyc +0 -0
  19. clarifai/cli/__pycache__/base.cpython-310.pyc +0 -0
  20. clarifai/cli/__pycache__/base_cli.cpython-310.pyc +0 -0
  21. clarifai/cli/__pycache__/compute_cluster.cpython-310.pyc +0 -0
  22. clarifai/cli/__pycache__/deployment.cpython-310.pyc +0 -0
  23. clarifai/cli/__pycache__/model.cpython-310.pyc +0 -0
  24. clarifai/cli/__pycache__/model_cli.cpython-310.pyc +0 -0
  25. clarifai/cli/__pycache__/nodepool.cpython-310.pyc +0 -0
  26. clarifai/client/__pycache__/__init__.cpython-310.pyc +0 -0
  27. clarifai/client/__pycache__/__init__.cpython-39.pyc +0 -0
  28. clarifai/client/__pycache__/app.cpython-310.pyc +0 -0
  29. clarifai/client/__pycache__/app.cpython-39.pyc +0 -0
  30. clarifai/client/__pycache__/base.cpython-310.pyc +0 -0
  31. clarifai/client/__pycache__/compute_cluster.cpython-310.pyc +0 -0
  32. clarifai/client/__pycache__/dataset.cpython-310.pyc +0 -0
  33. clarifai/client/__pycache__/deployment.cpython-310.pyc +0 -0
  34. clarifai/client/__pycache__/input.cpython-310.pyc +0 -0
  35. clarifai/client/__pycache__/lister.cpython-310.pyc +0 -0
  36. clarifai/client/__pycache__/model.cpython-310.pyc +0 -0
  37. clarifai/client/__pycache__/module.cpython-310.pyc +0 -0
  38. clarifai/client/__pycache__/nodepool.cpython-310.pyc +0 -0
  39. clarifai/client/__pycache__/search.cpython-310.pyc +0 -0
  40. clarifai/client/__pycache__/user.cpython-310.pyc +0 -0
  41. clarifai/client/__pycache__/workflow.cpython-310.pyc +0 -0
  42. clarifai/client/auth/__pycache__/__init__.cpython-310.pyc +0 -0
  43. clarifai/client/auth/__pycache__/helper.cpython-310.pyc +0 -0
  44. clarifai/client/auth/__pycache__/register.cpython-310.pyc +0 -0
  45. clarifai/client/auth/__pycache__/stub.cpython-310.pyc +0 -0
  46. clarifai/client/cli/__init__.py +0 -0
  47. clarifai/client/cli/__pycache__/__init__.cpython-310.pyc +0 -0
  48. clarifai/client/cli/__pycache__/base_cli.cpython-310.pyc +0 -0
  49. clarifai/client/cli/__pycache__/model_cli.cpython-310.pyc +0 -0
  50. clarifai/client/cli/base_cli.py +0 -88
  51. clarifai/client/cli/model_cli.py +0 -29
  52. clarifai/constants/__pycache__/base.cpython-310.pyc +0 -0
  53. clarifai/constants/__pycache__/dataset.cpython-310.pyc +0 -0
  54. clarifai/constants/__pycache__/input.cpython-310.pyc +0 -0
  55. clarifai/constants/__pycache__/model.cpython-310.pyc +0 -0
  56. clarifai/constants/__pycache__/rag.cpython-310.pyc +0 -0
  57. clarifai/constants/__pycache__/search.cpython-310.pyc +0 -0
  58. clarifai/constants/__pycache__/workflow.cpython-310.pyc +0 -0
  59. clarifai/datasets/__pycache__/__init__.cpython-310.pyc +0 -0
  60. clarifai/datasets/__pycache__/__init__.cpython-39.pyc +0 -0
  61. clarifai/datasets/export/__pycache__/__init__.cpython-310.pyc +0 -0
  62. clarifai/datasets/export/__pycache__/__init__.cpython-39.pyc +0 -0
  63. clarifai/datasets/export/__pycache__/inputs_annotations.cpython-310.pyc +0 -0
  64. clarifai/datasets/upload/__pycache__/__init__.cpython-310.pyc +0 -0
  65. clarifai/datasets/upload/__pycache__/__init__.cpython-39.pyc +0 -0
  66. clarifai/datasets/upload/__pycache__/base.cpython-310.pyc +0 -0
  67. clarifai/datasets/upload/__pycache__/features.cpython-310.pyc +0 -0
  68. clarifai/datasets/upload/__pycache__/image.cpython-310.pyc +0 -0
  69. clarifai/datasets/upload/__pycache__/multimodal.cpython-310.pyc +0 -0
  70. clarifai/datasets/upload/__pycache__/text.cpython-310.pyc +0 -0
  71. clarifai/datasets/upload/__pycache__/utils.cpython-310.pyc +0 -0
  72. clarifai/datasets/upload/loaders/__pycache__/__init__.cpython-39.pyc +0 -0
  73. clarifai/models/__pycache__/__init__.cpython-39.pyc +0 -0
  74. clarifai/modules/__pycache__/__init__.cpython-39.pyc +0 -0
  75. clarifai/rag/__pycache__/__init__.cpython-310.pyc +0 -0
  76. clarifai/rag/__pycache__/__init__.cpython-39.pyc +0 -0
  77. clarifai/rag/__pycache__/rag.cpython-310.pyc +0 -0
  78. clarifai/rag/__pycache__/rag.cpython-39.pyc +0 -0
  79. clarifai/rag/__pycache__/utils.cpython-310.pyc +0 -0
  80. clarifai/runners/__pycache__/__init__.cpython-310.pyc +0 -0
  81. clarifai/runners/__pycache__/__init__.cpython-39.pyc +0 -0
  82. clarifai/runners/dockerfile_template/Dockerfile.cpu.template +0 -31
  83. clarifai/runners/dockerfile_template/Dockerfile.cuda.template +0 -42
  84. clarifai/runners/dockerfile_template/Dockerfile.nim +0 -71
  85. clarifai/runners/models/__pycache__/__init__.cpython-310.pyc +0 -0
  86. clarifai/runners/models/__pycache__/__init__.cpython-39.pyc +0 -0
  87. clarifai/runners/models/__pycache__/base_typed_model.cpython-310.pyc +0 -0
  88. clarifai/runners/models/__pycache__/base_typed_model.cpython-39.pyc +0 -0
  89. clarifai/runners/models/__pycache__/model_class.cpython-310.pyc +0 -0
  90. clarifai/runners/models/__pycache__/model_run_locally.cpython-310-pytest-7.1.2.pyc +0 -0
  91. clarifai/runners/models/__pycache__/model_run_locally.cpython-310.pyc +0 -0
  92. clarifai/runners/models/__pycache__/model_runner.cpython-310.pyc +0 -0
  93. clarifai/runners/models/__pycache__/model_upload.cpython-310.pyc +0 -0
  94. clarifai/runners/models/base_typed_model.py +0 -238
  95. clarifai/runners/models/model_class_refract.py +0 -80
  96. clarifai/runners/models/model_upload.py +0 -607
  97. clarifai/runners/models/temp.py +0 -25
  98. clarifai/runners/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  99. clarifai/runners/utils/__pycache__/__init__.cpython-38.pyc +0 -0
  100. clarifai/runners/utils/__pycache__/__init__.cpython-39.pyc +0 -0
  101. clarifai/runners/utils/__pycache__/buffered_stream.cpython-310.pyc +0 -0
  102. clarifai/runners/utils/__pycache__/buffered_stream.cpython-38.pyc +0 -0
  103. clarifai/runners/utils/__pycache__/buffered_stream.cpython-39.pyc +0 -0
  104. clarifai/runners/utils/__pycache__/const.cpython-310.pyc +0 -0
  105. clarifai/runners/utils/__pycache__/constants.cpython-310.pyc +0 -0
  106. clarifai/runners/utils/__pycache__/constants.cpython-38.pyc +0 -0
  107. clarifai/runners/utils/__pycache__/constants.cpython-39.pyc +0 -0
  108. clarifai/runners/utils/__pycache__/data_handler.cpython-310.pyc +0 -0
  109. clarifai/runners/utils/__pycache__/data_handler.cpython-38.pyc +0 -0
  110. clarifai/runners/utils/__pycache__/data_handler.cpython-39.pyc +0 -0
  111. clarifai/runners/utils/__pycache__/data_utils.cpython-310.pyc +0 -0
  112. clarifai/runners/utils/__pycache__/data_utils.cpython-38.pyc +0 -0
  113. clarifai/runners/utils/__pycache__/data_utils.cpython-39.pyc +0 -0
  114. clarifai/runners/utils/__pycache__/grpc_server.cpython-310.pyc +0 -0
  115. clarifai/runners/utils/__pycache__/grpc_server.cpython-38.pyc +0 -0
  116. clarifai/runners/utils/__pycache__/grpc_server.cpython-39.pyc +0 -0
  117. clarifai/runners/utils/__pycache__/health.cpython-310.pyc +0 -0
  118. clarifai/runners/utils/__pycache__/health.cpython-38.pyc +0 -0
  119. clarifai/runners/utils/__pycache__/health.cpython-39.pyc +0 -0
  120. clarifai/runners/utils/__pycache__/loader.cpython-310.pyc +0 -0
  121. clarifai/runners/utils/__pycache__/logging.cpython-310.pyc +0 -0
  122. clarifai/runners/utils/__pycache__/logging.cpython-38.pyc +0 -0
  123. clarifai/runners/utils/__pycache__/logging.cpython-39.pyc +0 -0
  124. clarifai/runners/utils/__pycache__/stream_source.cpython-310.pyc +0 -0
  125. clarifai/runners/utils/__pycache__/stream_source.cpython-39.pyc +0 -0
  126. clarifai/runners/utils/__pycache__/url_fetcher.cpython-310.pyc +0 -0
  127. clarifai/runners/utils/__pycache__/url_fetcher.cpython-38.pyc +0 -0
  128. clarifai/runners/utils/__pycache__/url_fetcher.cpython-39.pyc +0 -0
  129. clarifai/runners/utils/data_handler.py +0 -292
  130. clarifai/runners/utils/data_handler_refract.py +0 -213
  131. clarifai/runners/utils/logger.py +0 -0
  132. clarifai/runners/utils/openai_format.py +0 -87
  133. clarifai/schema/__pycache__/search.cpython-310.pyc +0 -0
  134. clarifai/urls/__pycache__/helper.cpython-310.pyc +0 -0
  135. clarifai/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  136. clarifai/utils/__pycache__/__init__.cpython-39.pyc +0 -0
  137. clarifai/utils/__pycache__/cli.cpython-310.pyc +0 -0
  138. clarifai/utils/__pycache__/constants.cpython-310.pyc +0 -0
  139. clarifai/utils/__pycache__/logging.cpython-310.pyc +0 -0
  140. clarifai/utils/__pycache__/misc.cpython-310.pyc +0 -0
  141. clarifai/utils/__pycache__/model_train.cpython-310.pyc +0 -0
  142. clarifai/utils/evaluation/__pycache__/__init__.cpython-39.pyc +0 -0
  143. clarifai/utils/evaluation/__pycache__/main.cpython-39.pyc +0 -0
  144. clarifai/workflows/__pycache__/__init__.cpython-310.pyc +0 -0
  145. clarifai/workflows/__pycache__/__init__.cpython-39.pyc +0 -0
  146. clarifai/workflows/__pycache__/export.cpython-310.pyc +0 -0
  147. clarifai/workflows/__pycache__/utils.cpython-310.pyc +0 -0
  148. clarifai/workflows/__pycache__/validate.cpython-310.pyc +0 -0
  149. clarifai-11.2.4rc2.dist-info/RECORD +0 -241
  150. {clarifai-11.2.4rc2.dist-info → clarifai-11.3.0.dist-info}/entry_points.txt +0 -0
  151. {clarifai-11.2.4rc2.dist-info → clarifai-11.3.0.dist-info/licenses}/LICENSE +0 -0
  152. {clarifai-11.2.4rc2.dist-info → clarifai-11.3.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,143 @@
1
+ from google.protobuf import struct_pb2, symbol_database, wrappers_pb2
2
+ from google.protobuf.descriptor import FieldDescriptor
3
+ from google.protobuf.message import Message
4
+ from google.protobuf.timestamp_pb2 import Timestamp
5
+
6
+ from clarifai.utils.logging import logger
7
+
8
+ # Initialize the Protobuf symbol database for dynamic message type resolution
9
+ db = symbol_database.Default()
10
+
11
+ # Define standard wrapper types for Protobuf well-known types
12
+ WRAPPER_TYPES = {
13
+ wrappers_pb2.Int32Value,
14
+ wrappers_pb2.Int64Value,
15
+ wrappers_pb2.StringValue,
16
+ wrappers_pb2.UInt32Value,
17
+ wrappers_pb2.UInt64Value,
18
+ }
19
+
20
+
21
+ def dict_to_protobuf(pb_obj: Message, data: dict) -> None:
22
+ """Recursively convert a nested dictionary to a Protobuf message object.
23
+
24
+ Args:
25
+ pb_obj: The target Protobuf message instance to populate.
26
+ data: Source dictionary containing the data to convert.
27
+ """
28
+ for field, value in data.items():
29
+ if field not in pb_obj.DESCRIPTOR.fields_by_name:
30
+ logger.warning(f"Ignoring unknown field '{field}' in message '{pb_obj.DESCRIPTOR.name}'")
31
+ continue
32
+
33
+ field_descriptor = pb_obj.DESCRIPTOR.fields_by_name[field]
34
+
35
+ try:
36
+ # Handle repeated fields (lists)
37
+ if field_descriptor.label == FieldDescriptor.LABEL_REPEATED:
38
+ _handle_repeated_field(pb_obj, field_descriptor, field, value)
39
+
40
+ # Handle message fields (nested messages)
41
+ elif field_descriptor.type == FieldDescriptor.TYPE_MESSAGE:
42
+ _handle_message_field(pb_obj, field_descriptor, field, value)
43
+
44
+ # Handle scalar fields
45
+ else:
46
+ if value:
47
+ setattr(pb_obj, field, value)
48
+
49
+ except Exception as e:
50
+ logger.error(f"Error processing field '{field}': {str(e)}")
51
+ raise
52
+
53
+
54
+ def _handle_repeated_field(pb_obj: Message, field_descriptor: FieldDescriptor, field: str,
55
+ value: list) -> None:
56
+ """Process repeated fields (both scalar and message types)."""
57
+ if not isinstance(value, list):
58
+ logger.warning(f"Expected list for repeated field '{field}', got {type(value).__name__}")
59
+ return
60
+
61
+ repeated_field = getattr(pb_obj, field)
62
+
63
+ # Handle repeated message fields
64
+ if field_descriptor.type == FieldDescriptor.TYPE_MESSAGE:
65
+ for item in value:
66
+ if isinstance(item, dict):
67
+ item_msg = repeated_field.add()
68
+ dict_to_protobuf(item_msg, item)
69
+ elif isinstance(item, Message):
70
+ repeated_field.add().CopyFrom(item)
71
+ else:
72
+ logger.warning(f"Invalid type {type(item).__name__} in repeated message field '{field}'")
73
+ else:
74
+ # Handle repeated scalar fields
75
+ try:
76
+ repeated_field.extend(value)
77
+ except TypeError as e:
78
+ logger.error(f"Type mismatch in repeated scalar field '{field}': {str(e)}")
79
+ raise
80
+
81
+
82
+ def _handle_message_field(pb_obj: Message, field_descriptor: FieldDescriptor, field: str,
83
+ value: object) -> None:
84
+ """Process message-type fields including special types."""
85
+ msg_class = db.GetSymbol(field_descriptor.message_type.full_name)
86
+ target_field = getattr(pb_obj, field)
87
+
88
+ # Handle special message types
89
+ if msg_class is Timestamp:
90
+ _set_timestamp_value(target_field, value)
91
+ elif msg_class is struct_pb2.Struct:
92
+ _set_struct_value(target_field, value)
93
+ elif msg_class in WRAPPER_TYPES:
94
+ _set_wrapper_value(target_field, msg_class, value)
95
+ else:
96
+ # Handle nested messages
97
+ if isinstance(value, dict):
98
+ nested_pb = msg_class()
99
+ dict_to_protobuf(nested_pb, value)
100
+ target_field.CopyFrom(nested_pb)
101
+ elif isinstance(value, Message):
102
+ target_field.CopyFrom(value)
103
+ else:
104
+ logger.warning(f"Invalid type {type(value).__name__} for message field '{field}'")
105
+
106
+
107
+ def _set_timestamp_value(target_field: Message, value: object) -> None:
108
+ """Set timestamp value from dict or numeric timestamp."""
109
+ ts = Timestamp()
110
+ if isinstance(value, dict):
111
+ ts.seconds = value.get('seconds', 0)
112
+ ts.nanos = value.get('nanos', 0)
113
+ elif isinstance(value, (int, float)):
114
+ ts.seconds = int(value)
115
+ ts.nanos = int((value - ts.seconds) * 1e9)
116
+ else:
117
+ logger.warning(f"Unsupported timestamp format: {type(value).__name__}")
118
+ target_field.CopyFrom(ts)
119
+
120
+
121
+ def _set_struct_value(target_field: Message, value: object) -> None:
122
+ """Convert dictionary to Protobuf Struct."""
123
+ if not isinstance(value, dict):
124
+ logger.warning(f"Expected dict for Struct field, got {type(value).__name__}")
125
+ return
126
+
127
+ struct = struct_pb2.Struct()
128
+ try:
129
+ struct.update(value)
130
+ except ValueError as e:
131
+ logger.error(f"Invalid value in Struct: {str(e)}")
132
+ raise
133
+ target_field.CopyFrom(struct)
134
+
135
+
136
+ def _set_wrapper_value(target_field: Message, wrapper_type: type, value: object) -> None:
137
+ """Set value for wrapper types (e.g., Int32Value)."""
138
+ try:
139
+ wrapper = wrapper_type(value=value)
140
+ except TypeError as e:
141
+ logger.error(f"Invalid value for {wrapper_type.__name__}: {str(e)}")
142
+ raise
143
+ target_field.CopyFrom(wrapper)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: clarifai
3
- Version: 11.2.4rc2
3
+ Version: 11.3.0
4
4
  Summary: Clarifai Python SDK
5
5
  Home-page: https://github.com/Clarifai/clarifai-python
6
6
  Author: Clarifai
@@ -20,7 +20,7 @@ Classifier: Operating System :: OS Independent
20
20
  Requires-Python: >=3.8
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
- Requires-Dist: clarifai-grpc>=11.2.6
23
+ Requires-Dist: clarifai-grpc>=11.3.2
24
24
  Requires-Dist: clarifai-protocol>=0.0.22
25
25
  Requires-Dist: numpy>=1.22.0
26
26
  Requires-Dist: tqdm>=4.65.0
@@ -42,6 +42,7 @@ Dynamic: description
42
42
  Dynamic: description-content-type
43
43
  Dynamic: home-page
44
44
  Dynamic: license
45
+ Dynamic: license-file
45
46
  Dynamic: provides-extra
46
47
  Dynamic: requires-dist
47
48
  Dynamic: requires-python
@@ -0,0 +1,107 @@
1
+ clarifai/__init__.py,sha256=AKQVpPKUjXA31bxC6zOaWuLMOUf9UCfopNi6s5UU5_g,23
2
+ clarifai/cli.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ clarifai/errors.py,sha256=RwzTajwds51wLD0MVlMC5kcpBnzRpreDLlazPSBZxrg,2605
4
+ clarifai/versions.py,sha256=jctnczzfGk_S3EnVqb2FjRKfSREkNmvNEwAAa_VoKiQ,222
5
+ clarifai/cli/README.md,sha256=YGApHfeUyu5P0Pdth-mqQCQftWHDxz6bugDlvDXDhOE,1942
6
+ clarifai/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ clarifai/cli/__main__.py,sha256=utJ2F40cl0jPHcYdTlGZRqpPfZ0CtVYB-8Ft0b2fWD4,72
8
+ clarifai/cli/base.py,sha256=ZG1Ial89wGVqt4bSFYmIoRH_OZtw2yxlq3Ihp9e025U,7592
9
+ clarifai/cli/compute_cluster.py,sha256=dma_dgzSg5pYQcxlWhoKYdMFPO2KS7HzsN81ploNB-E,2083
10
+ clarifai/cli/deployment.py,sha256=wBWkYfLr6W73LScF6NlQM-reXWUP38VfAudltjpnFpk,3822
11
+ clarifai/cli/model.py,sha256=M1dEbR7t0Ay9cgUe73knIvZ5y1UJedM8FoNrmuYxWOA,12789
12
+ clarifai/cli/nodepool.py,sha256=7nTNd9T-UEPFE36vbxwdUHu2B3NECbN-lSTb_DQYw18,3874
13
+ clarifai/client/__init__.py,sha256=xI1U0l5AZdRThvQAXCLsd9axxyFzXXJ22m8LHqVjQRU,662
14
+ clarifai/client/app.py,sha256=FnKvKksYZwdry0e4Obh-trdSO1mv6QcVAa3kzKiQMpU,38340
15
+ clarifai/client/base.py,sha256=hSHOqkXbSKyaRDeylMMnkhUHCAHhEqno4KI0CXGziBA,7536
16
+ clarifai/client/compute_cluster.py,sha256=EvW9TJjPvInUlggfg1A98sxoWH8_PY5rCVXZhsj6ac0,8705
17
+ clarifai/client/dataset.py,sha256=6DqfXQtiHoOJq0vPw2fz5ATo5zxQMmlhKG9IBwhnXeU,32078
18
+ clarifai/client/deployment.py,sha256=I3UJLu2NB1GlKZaIFTI_q-3P5ZTtIoNEuKxB-oHMvD4,2682
19
+ clarifai/client/input.py,sha256=obMAHMDU1OwfXZ8KraOnGFlWzlW-3F7Ob_2lcOQMlhY,46339
20
+ clarifai/client/lister.py,sha256=03KGMvs5RVyYqxLsSrWhNc34I8kiF1Ph0NeyEwu7nMU,2082
21
+ clarifai/client/model.py,sha256=Zm_GoTNy-HL6zmld_PeKGqnQgaLhLPqlNb4BcFBX8bY,77125
22
+ clarifai/client/model_client.py,sha256=X0RndVfTdfa4PZaOtSick0VKC3AkQakT-qrkPqaFKuI,19971
23
+ clarifai/client/module.py,sha256=FTkm8s9m-EaTKN7g9MnLhGJ9eETUfKG7aWZ3o1RshYs,4204
24
+ clarifai/client/nodepool.py,sha256=la3vTFrO4LX8zm2eQ5jqf2L0-kQ63Dano8FibadoZbk,10152
25
+ clarifai/client/search.py,sha256=GaPWN6JmTQGZaCHr6U1yv0zqR6wKFl7i9IVLg2ul1CI,14254
26
+ clarifai/client/user.py,sha256=WOv66ww2wx9isIge3V-xTHCkqC6akl2jEGAxzT_Ugfs,17642
27
+ clarifai/client/workflow.py,sha256=5VjZ2D8cudLznR8yhrwNawOmjxUhkJllZMKM6pn-4gs,12170
28
+ clarifai/client/auth/__init__.py,sha256=7EwR0NrozkAUwpUnCsqXvE_p0wqx_SelXlSpKShKJK0,136
29
+ clarifai/client/auth/helper.py,sha256=Ngw5IDkOWvnOz5YwViVk55z3mC52MyezLc0G3WxLqok,14643
30
+ clarifai/client/auth/register.py,sha256=2CMdBsoVLoTfjyksE6j7BM2tiEc73WKYvxnwDDgNn1k,536
31
+ clarifai/client/auth/stub.py,sha256=FrA5QpEFY4sK6fvPVhTg19ROLHkYSRo343nNqiVE7xw,4963
32
+ clarifai/constants/base.py,sha256=ogmFSZYoF0YhGjHg5aiOc3MLqPr_poKAls6xaD0_C3U,89
33
+ clarifai/constants/dataset.py,sha256=vjK3IlgXu31HycuvjRSzEQSqhU6xfj5TIgo6IpyUWoc,609
34
+ clarifai/constants/input.py,sha256=WcHwToUVIK9ItAhDefaSohQHCLNeR55PSjZ0BFnoZ3U,28
35
+ clarifai/constants/model.py,sha256=Um1hLfMFlh5R_vtP3Z6P-o6zon-tdbLcKVIl4PucrV4,438
36
+ clarifai/constants/rag.py,sha256=WcHwToUVIK9ItAhDefaSohQHCLNeR55PSjZ0BFnoZ3U,28
37
+ clarifai/constants/search.py,sha256=yYEqTaFg-KdnpJE_Ytp-EPVHIIC395iNtZrpVlLIf4o,101
38
+ clarifai/constants/workflow.py,sha256=cECq1xdvf44MCdtK2AbkiuuwhyL-6OWZdQfYbsLKy_o,33
39
+ clarifai/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
+ clarifai/datasets/export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ clarifai/datasets/export/inputs_annotations.py,sha256=3AtUBrMIjw8H3ehDsJFYcBFoAZ1QKQo1hXTMsHh8f20,10159
42
+ clarifai/datasets/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
+ clarifai/datasets/upload/base.py,sha256=UIc0ufyIBCrb83_sFpv21L8FshsX4nwsLYQkdlJfzD4,2357
44
+ clarifai/datasets/upload/features.py,sha256=GK69WvUYnks5G26Z5L5XSisBIZILLv7lYhS2y8BJCt0,2031
45
+ clarifai/datasets/upload/image.py,sha256=HlCsfEMu_C4GVecGSv52RUJ6laLW8H64Pfj_FQyX6qg,8580
46
+ clarifai/datasets/upload/multimodal.py,sha256=_NpNQak9KMn0NOiOr48MYnXL0GQZ1LXKhwdYF1HhrHs,2377
47
+ clarifai/datasets/upload/text.py,sha256=dpRMNz49EyKau0kwksEaNV6TLBUf5lSr7t5g3pG2byM,2298
48
+ clarifai/datasets/upload/utils.py,sha256=BerWhq40ZUN30z6VImlc93eZtT-1vI18AMgSOuNzJEM,9647
49
+ clarifai/datasets/upload/loaders/README.md,sha256=aNRutSCTzLp2ruIZx74ZkN5AxpzwKOxMa7OzabnKpwg,2980
50
+ clarifai/datasets/upload/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
+ clarifai/datasets/upload/loaders/coco_captions.py,sha256=YfuNXplbdoH8N9ph7RyN9MfJTtOcJBG4ie1ow6-mELA,1516
52
+ clarifai/datasets/upload/loaders/coco_detection.py,sha256=_I_yThw435KS9SH7zheBbJDK3zFgjTImBsES__ijjMk,2831
53
+ clarifai/datasets/upload/loaders/imagenet_classification.py,sha256=i7W5F6FTB3LwLmhPgjZHmbCbS3l4LmjsuBFKtjxl1pU,1962
54
+ clarifai/datasets/upload/loaders/xview_detection.py,sha256=hk8cZdYZimm4KOaZvBjYcC6ikURZMn51xmn7pXZT3HE,6052
55
+ clarifai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
+ clarifai/models/api.py,sha256=d3FQQlG0mNDLrfEvchqaVcq4Tgb_TqryNnJtwp3c7sE,10961
57
+ clarifai/modules/README.md,sha256=mx8pVx6cPp-pP4LcFPT_nX3ngGmhygVK0WiXeD3cbIo,367
58
+ clarifai/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
+ clarifai/modules/css.py,sha256=kadCEunmyh5h2yf0-4aysE3ZcZ6qaQcxuAgDXS96yF8,2020
60
+ clarifai/modules/pages.py,sha256=iOoM3RNRMgXlV0qBqcdQofxoXo2RuRQh0h9c9BIS0-I,1383
61
+ clarifai/modules/style.css,sha256=j7FNPZVhLPj35vvBksAJ90RuX5sLuqzDR5iM2WIEhiA,6073
62
+ clarifai/rag/__init__.py,sha256=wu3PzAzo7uqgrEzuaC9lY_3gj1HFiR3GU3elZIKTT5g,40
63
+ clarifai/rag/rag.py,sha256=bqUWnfdf91OYMucEK0_rJXDwg0oKjz5c7eda-9CPXu8,12680
64
+ clarifai/rag/utils.py,sha256=yr1jAcbpws4vFGBqlAwPPE7v1DRba48g8gixLFw8OhQ,4070
65
+ clarifai/runners/__init__.py,sha256=cDJ31l41dDsqW4Xn6sFMkKxxdIMTnGH9IW6sVkq0TNw,207
66
+ clarifai/runners/server.py,sha256=xHDLdhQApCgYG19QOKXqJNCGNyw1Vsvobq3UdryDrVc,4132
67
+ clarifai/runners/dockerfile_template/Dockerfile.template,sha256=5cjv7U8PmWa3DB_5B1CqSYh_6GE0E0np52TIAa7EIDE,2312
68
+ clarifai/runners/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
+ clarifai/runners/models/model_builder.py,sha256=vIUZII9n5wL0SGV4xR6wfsdRvrMv4pSHr6P-KdYpikI,36343
70
+ clarifai/runners/models/model_class.py,sha256=J33aq5OqKu_1iVnaSAbEQCaE_ina8X46PlQ5AiK80_o,14806
71
+ clarifai/runners/models/model_run_locally.py,sha256=H7FKUBzZ_EPPj1b6P59qbOYr3mUJjJTlD5gavH5e80o,17746
72
+ clarifai/runners/models/model_runner.py,sha256=T4Qn_x0vky7XdeS54bvipzEmKZMra1tQdAu_u01yyjc,6503
73
+ clarifai/runners/models/model_servicer.py,sha256=A--b1P71PBCAMJCpy_-fpNDkfCVdvdMh1LleW15dSas,3037
74
+ clarifai/runners/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
+ clarifai/runners/utils/code_script.py,sha256=NutTcbJWChjSb_WLNwkesavzcpP_-wh_R4ySWt0VPcI,8971
76
+ clarifai/runners/utils/const.py,sha256=9qnOC1Bt6SGLQ9XCQEQ6519XhW4gzcztsV1Rgej67Vw,1055
77
+ clarifai/runners/utils/data_types.py,sha256=l_yd09GIlAZ_0bJdY558BuNSKTM48rx7fYA7-HNxETY,12415
78
+ clarifai/runners/utils/data_utils.py,sha256=dVGl7ZW6t0BztzfIOKV-WMeAEyEjwxzU3ud5fgL5Jmo,12843
79
+ clarifai/runners/utils/loader.py,sha256=Sl0m29RDtMPx2cIiSbbDFtKHQj2ktXQ5CnkvaHi-zDc,8804
80
+ clarifai/runners/utils/method_signatures.py,sha256=2SSStcBuBUbIgvFgAJFt4By0ZHos2c7bDWJOiUxQxZQ,18190
81
+ clarifai/runners/utils/openai_convertor.py,sha256=qRhq_nGacaLFD_-8oAbPaDhGZJVMtKbgb2A4X7FlhD0,4564
82
+ clarifai/runners/utils/serializers.py,sha256=S4sRsOVvH191vAGTRTAAdwLlQwlK4T5QVRDGPptg9nQ,7191
83
+ clarifai/runners/utils/url_fetcher.py,sha256=v_8JOWmkyFAzsBulsieKX7Nfjy1Yg7wGSZeqfEvw2cg,1640
84
+ clarifai/schema/search.py,sha256=JjTi8ammJgZZ2OGl4K6tIA4zEJ1Fr2ASZARXavI1j5c,2448
85
+ clarifai/urls/helper.py,sha256=tjoMGGHuWX68DUB0pk4MEjrmFsClUAQj2jmVEM_Sy78,4751
86
+ clarifai/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
+ clarifai/utils/cli.py,sha256=FUFJJb8Jzohpt132JE43xHNzWtX0N8fbWROxJISfCM0,5072
88
+ clarifai/utils/config.py,sha256=MxuQ1U4EOT4yVOEcRyv3OUPnoY_A_J5cZKHJGiuuo30,2883
89
+ clarifai/utils/constants.py,sha256=fdCmw8fjgo8eoWu85t95ZoRTrgXC5_XVXFyB8_VQTtw,219
90
+ clarifai/utils/logging.py,sha256=I2Sj1X-phYcINXe4-pW22Tq6Sz5PlwcxYQh7zORBbeM,13634
91
+ clarifai/utils/misc.py,sha256=gensDjU5pV44iFzUzmM_Lf6PZX63GFxRXJX91esEjAg,2999
92
+ clarifai/utils/model_train.py,sha256=Mndqy5GNu7kjQHjDyNVyamL0hQFLGSHcWhOuPyOvr1w,8005
93
+ clarifai/utils/protobuf.py,sha256=P2deeGfs3VajkfQgPn7ROkqZ-4kXnWRxHCsy_XS7yKI,4954
94
+ clarifai/utils/evaluation/__init__.py,sha256=PYkurUrXrGevByj7RFb6CoU1iC7fllyQSfnnlo9WnY8,69
95
+ clarifai/utils/evaluation/helpers.py,sha256=aZeHLI7oSmU5YDWQp5GdkYW5qbHx37nV9xwunKTAwWM,18549
96
+ clarifai/utils/evaluation/main.py,sha256=sQAuMk0lPclXCYvy_rS7rYteo2xh9Ju13VNvbyGt_VM,15779
97
+ clarifai/utils/evaluation/testset_annotation_parser.py,sha256=iZfLw6oR1qgJ3MHMbOZXcGBLu7btSDn0VqdiAzpIm4g,5002
98
+ clarifai/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
+ clarifai/workflows/export.py,sha256=vICRhIreqDSShxLKjHNM2JwzKsf1B4fdXB0ciMcA70k,1945
100
+ clarifai/workflows/utils.py,sha256=nGeB_yjVgUO9kOeKTg4OBBaBz-AwXI3m-huSVj-9W18,1924
101
+ clarifai/workflows/validate.py,sha256=yJq03MaJqi5AK3alKGJJBR89xmmjAQ31sVufJUiOqY8,2556
102
+ clarifai-11.3.0.dist-info/licenses/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
103
+ clarifai-11.3.0.dist-info/METADATA,sha256=_Y8jWVUURPYvFkK2Ky0MSr0dZSjY9S_LkLMBtBZh4Bo,22472
104
+ clarifai-11.3.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
105
+ clarifai-11.3.0.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
106
+ clarifai-11.3.0.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
107
+ clarifai-11.3.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
Binary file
File without changes
@@ -1,88 +0,0 @@
1
- import click
2
- import os
3
- import yaml
4
-
5
- @click.group()
6
- @click.pass_context
7
- def cli(ctx):
8
- """Clarifai CLI"""
9
- ctx.ensure_object(dict)
10
- config_path = 'config.yaml'
11
- if os.path.exists(config_path):
12
- ctx.obj = _from_yaml(config_path)
13
- print("Loaded config from file.")
14
- print(f"Config: {ctx.obj}")
15
- else:
16
- ctx.obj = {}
17
-
18
- def _from_yaml(filename: str):
19
- try:
20
- with open(filename, 'r') as f:
21
- return yaml.safe_load(f)
22
- except yaml.YAMLError as e:
23
- click.echo(f"Error reading YAML file: {e}", err=True)
24
- return {}
25
-
26
- def _dump_yaml(data, filename: str):
27
- try:
28
- with open(filename, 'w') as f:
29
- yaml.dump(data, f)
30
- except Exception as e:
31
- click.echo(f"Error writing YAML file: {e}", err=True)
32
-
33
- def _set_base_url(env):
34
- environments = {'prod': 'https://api.clarifai.com', 'staging': 'https://api-staging.clarifai.com', 'dev': 'https://api-dev.clarifai.com'}
35
- return environments.get(env, 'https://api.clarifai.com')
36
-
37
-
38
- @cli.command()
39
- @click.option('--config', type=click.Path(), required=False, help='Path to the config file')
40
- @click.option('-e', '--env', required=False, help='Environment', type=click.Choice(['prod', 'staging', 'dev']))
41
- @click.option('--user_id', required=False, help='User ID')
42
- @click.pass_context
43
- def login(ctx, config, env, user_id):
44
- """Login command to set PAT and other configurations."""
45
-
46
- if config and os.path.exists(config):
47
- ctx.obj = _from_yaml(config)
48
-
49
- if 'pat' in ctx.obj:
50
- os.environ["CLARIFAI_PAT"] = ctx.obj['pat']
51
- click.echo("Loaded PAT from config file.")
52
- elif 'CLARIFAI_PAT' in os.environ:
53
- ctx.obj['pat'] = os.environ["CLARIFAI_PAT"]
54
- click.echo("Loaded PAT from environment variable.")
55
- else:
56
- _pat = click.prompt("Get your PAT from https://clarifai.com/settings/security and pass it here", type=str)
57
- os.environ["CLARIFAI_PAT"] = _pat
58
- ctx.obj['pat'] = _pat
59
- click.echo("PAT saved successfully.")
60
-
61
- if user_id:
62
- ctx.obj['user_id'] = user_id
63
- os.environ["CLARIFAI_USER_ID"] = ctx.obj['user_id']
64
- elif 'user_id' in ctx.obj or 'CLARIFAI_USER_ID' in os.environ:
65
- ctx.obj['user_id'] = ctx.obj.get('user_id', os.environ["CLARIFAI_USER_ID"])
66
- os.environ["CLARIFAI_USER_ID"] = ctx.obj['user_id']
67
-
68
- if env:
69
- ctx.obj['env'] = env
70
- ctx.obj['base_url'] = _set_base_url(env)
71
- os.environ["CLARIFAI_API_BASE"] = ctx.obj['base_url']
72
- elif 'env' in ctx.obj:
73
- ctx.obj['env'] = ctx.obj.get('env', "prod")
74
- ctx.obj['base_url'] = _set_base_url(ctx.obj['env'])
75
- os.environ["CLARIFAI_API_BASE"] = ctx.obj['base_url']
76
- elif 'CLARIFAI_API_BASE' in os.environ:
77
- ctx.obj['base_url'] = os.environ["CLARIFAI_API_BASE"]
78
-
79
- _dump_yaml(ctx.obj, 'config.yaml')
80
-
81
- click.echo("Login successful.")
82
-
83
- # Import the model CLI commands to register them
84
- from clarifai.client.cli.model_cli import model # Ensure this is the correct import path
85
-
86
-
87
- if __name__ == '__main__':
88
- cli()
@@ -1,29 +0,0 @@
1
- import click
2
- from clarifai.client.cli.base_cli import cli
3
-
4
- @cli.group()
5
- def model():
6
- """Manage models: upload, test locally"""
7
- pass
8
-
9
- @model.command()
10
- @click.argument('model_path', type=click.Path(exists=True))
11
- @click.option('--download_checkpoints', is_flag=True, help='Flag to download checkpoints before uploading and including them in the tar file that is uploaded. Defaults to False, which will attempt to download them at docker build time.', )
12
- @click.option('--skip_dockerfile', is_flag =True, help='Flag to skip generating a dockerfile so that you can manually edit an already created dockerfile.', )
13
- def upload(model_path, download_checkpoints, skip_dockerfile):
14
- """Upload a model to Clarifai."""
15
- from clarifai.runners.models import model_upload
16
-
17
- model_upload.main(model_path, download_checkpoints, skip_dockerfile)
18
-
19
- @model.command()
20
- @click.argument('model_path', type=click.Path(exists=True))
21
- def test_locally(model_path):
22
- """Test model locally."""
23
- try:
24
- from clarifai.runners.models import run_test_locally
25
- run_test_locally.main(model_path)
26
- click.echo(f"Model tested locally from {model_path}.")
27
- except Exception as e:
28
- click.echo(f"Failed to test model locally: {e}", err=True)
29
-
Binary file
@@ -1,31 +0,0 @@
1
- ARG BASE_IMAGE=${BASE_IMAGE}
2
- FROM ${BASE_IMAGE} as build
3
-
4
- # Set the working directory to /app
5
- WORKDIR /app
6
-
7
- COPY requirements.txt .
8
- # Install requirements and cleanup before leaving this line.
9
- # Note(zeiler): this could be in a future template as {{model_python_deps}}
10
- RUN pip install --no-cache-dir -r requirements.txt
11
-
12
- # Install Clarifai SDK
13
- RUN pip install --no-cache-dir clarifai
14
-
15
- # These will be set by the templaing system.
16
- ENV CLARIFAI_PAT=${CLARIFAI_PAT}
17
- ENV CLARIFAI_USER_ID=${CLARIFAI_USER_ID}
18
- ENV CLARIFAI_RUNNER_ID=${CLARIFAI_RUNNER_ID}
19
- ENV CLARIFAI_NODEPOOL_ID=${CLARIFAI_NODEPOOL_ID}
20
- ENV CLARIFAI_COMPUTE_CLUSTER_ID=${CLARIFAI_COMPUTE_CLUSTER_ID}
21
- ENV CLARIFAI_API_BASE=${CLARIFAI_API_BASE}
22
-
23
- # Copy the current folder into /app/model_dir that the SDK will expect.
24
- COPY . /app/model_dir/${name}
25
-
26
- # Add the model directory to the python path.
27
- ENV PYTHONPATH "${PYTHONPATH}:/app/model_dir/${name}"
28
-
29
- # Finally run the clarifai entrypoint to start the runner loop and local dev server.
30
- # Note(zeiler): we may want to make this a clarifai CLI call.
31
- CMD ["-m", "clarifai.runners.server", "--model_path", "/app/model_dir/${name}"]