clarifai 11.3.0rc2__py3-none-any.whl → 11.4.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 (300) hide show
  1. clarifai/__init__.py +1 -1
  2. clarifai/cli/__main__.py +1 -1
  3. clarifai/cli/base.py +144 -136
  4. clarifai/cli/compute_cluster.py +45 -31
  5. clarifai/cli/deployment.py +93 -76
  6. clarifai/cli/model.py +578 -180
  7. clarifai/cli/nodepool.py +100 -82
  8. clarifai/client/__init__.py +12 -2
  9. clarifai/client/app.py +973 -911
  10. clarifai/client/auth/helper.py +345 -342
  11. clarifai/client/auth/register.py +7 -7
  12. clarifai/client/auth/stub.py +107 -106
  13. clarifai/client/base.py +185 -178
  14. clarifai/client/compute_cluster.py +214 -180
  15. clarifai/client/dataset.py +793 -698
  16. clarifai/client/deployment.py +55 -50
  17. clarifai/client/input.py +1223 -1088
  18. clarifai/client/lister.py +47 -45
  19. clarifai/client/model.py +1939 -1717
  20. clarifai/client/model_client.py +525 -502
  21. clarifai/client/module.py +82 -73
  22. clarifai/client/nodepool.py +358 -213
  23. clarifai/client/runner.py +58 -0
  24. clarifai/client/search.py +342 -309
  25. clarifai/client/user.py +419 -414
  26. clarifai/client/workflow.py +294 -274
  27. clarifai/constants/dataset.py +11 -17
  28. clarifai/constants/model.py +8 -2
  29. clarifai/datasets/export/inputs_annotations.py +233 -217
  30. clarifai/datasets/upload/base.py +63 -51
  31. clarifai/datasets/upload/features.py +43 -38
  32. clarifai/datasets/upload/image.py +237 -207
  33. clarifai/datasets/upload/loaders/coco_captions.py +34 -32
  34. clarifai/datasets/upload/loaders/coco_detection.py +72 -65
  35. clarifai/datasets/upload/loaders/imagenet_classification.py +57 -53
  36. clarifai/datasets/upload/loaders/xview_detection.py +274 -132
  37. clarifai/datasets/upload/multimodal.py +55 -46
  38. clarifai/datasets/upload/text.py +55 -47
  39. clarifai/datasets/upload/utils.py +250 -234
  40. clarifai/errors.py +51 -50
  41. clarifai/models/api.py +260 -238
  42. clarifai/modules/css.py +50 -50
  43. clarifai/modules/pages.py +33 -33
  44. clarifai/rag/rag.py +312 -288
  45. clarifai/rag/utils.py +91 -84
  46. clarifai/runners/models/model_builder.py +906 -802
  47. clarifai/runners/models/model_class.py +370 -331
  48. clarifai/runners/models/model_run_locally.py +459 -419
  49. clarifai/runners/models/model_runner.py +170 -162
  50. clarifai/runners/models/model_servicer.py +78 -70
  51. clarifai/runners/server.py +111 -101
  52. clarifai/runners/utils/code_script.py +225 -187
  53. clarifai/runners/utils/const.py +4 -1
  54. clarifai/runners/utils/data_types/__init__.py +12 -0
  55. clarifai/runners/utils/data_types/data_types.py +598 -0
  56. clarifai/runners/utils/data_utils.py +387 -440
  57. clarifai/runners/utils/loader.py +247 -227
  58. clarifai/runners/utils/method_signatures.py +411 -386
  59. clarifai/runners/utils/openai_convertor.py +108 -109
  60. clarifai/runners/utils/serializers.py +175 -179
  61. clarifai/runners/utils/url_fetcher.py +35 -35
  62. clarifai/schema/search.py +56 -63
  63. clarifai/urls/helper.py +125 -102
  64. clarifai/utils/cli.py +129 -123
  65. clarifai/utils/config.py +127 -87
  66. clarifai/utils/constants.py +49 -0
  67. clarifai/utils/evaluation/helpers.py +503 -466
  68. clarifai/utils/evaluation/main.py +431 -393
  69. clarifai/utils/evaluation/testset_annotation_parser.py +154 -144
  70. clarifai/utils/logging.py +324 -306
  71. clarifai/utils/misc.py +60 -56
  72. clarifai/utils/model_train.py +165 -146
  73. clarifai/utils/protobuf.py +126 -103
  74. clarifai/versions.py +3 -1
  75. clarifai/workflows/export.py +48 -50
  76. clarifai/workflows/utils.py +39 -36
  77. clarifai/workflows/validate.py +55 -43
  78. {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/METADATA +16 -6
  79. clarifai-11.4.0.dist-info/RECORD +109 -0
  80. {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/WHEEL +1 -1
  81. clarifai/__pycache__/__init__.cpython-310.pyc +0 -0
  82. clarifai/__pycache__/__init__.cpython-311.pyc +0 -0
  83. clarifai/__pycache__/__init__.cpython-39.pyc +0 -0
  84. clarifai/__pycache__/errors.cpython-310.pyc +0 -0
  85. clarifai/__pycache__/errors.cpython-311.pyc +0 -0
  86. clarifai/__pycache__/versions.cpython-310.pyc +0 -0
  87. clarifai/__pycache__/versions.cpython-311.pyc +0 -0
  88. clarifai/cli/__pycache__/__init__.cpython-310.pyc +0 -0
  89. clarifai/cli/__pycache__/__init__.cpython-311.pyc +0 -0
  90. clarifai/cli/__pycache__/base.cpython-310.pyc +0 -0
  91. clarifai/cli/__pycache__/base.cpython-311.pyc +0 -0
  92. clarifai/cli/__pycache__/base_cli.cpython-310.pyc +0 -0
  93. clarifai/cli/__pycache__/compute_cluster.cpython-310.pyc +0 -0
  94. clarifai/cli/__pycache__/compute_cluster.cpython-311.pyc +0 -0
  95. clarifai/cli/__pycache__/deployment.cpython-310.pyc +0 -0
  96. clarifai/cli/__pycache__/deployment.cpython-311.pyc +0 -0
  97. clarifai/cli/__pycache__/model.cpython-310.pyc +0 -0
  98. clarifai/cli/__pycache__/model.cpython-311.pyc +0 -0
  99. clarifai/cli/__pycache__/model_cli.cpython-310.pyc +0 -0
  100. clarifai/cli/__pycache__/nodepool.cpython-310.pyc +0 -0
  101. clarifai/cli/__pycache__/nodepool.cpython-311.pyc +0 -0
  102. clarifai/client/__pycache__/__init__.cpython-310.pyc +0 -0
  103. clarifai/client/__pycache__/__init__.cpython-311.pyc +0 -0
  104. clarifai/client/__pycache__/__init__.cpython-39.pyc +0 -0
  105. clarifai/client/__pycache__/app.cpython-310.pyc +0 -0
  106. clarifai/client/__pycache__/app.cpython-311.pyc +0 -0
  107. clarifai/client/__pycache__/app.cpython-39.pyc +0 -0
  108. clarifai/client/__pycache__/base.cpython-310.pyc +0 -0
  109. clarifai/client/__pycache__/base.cpython-311.pyc +0 -0
  110. clarifai/client/__pycache__/compute_cluster.cpython-310.pyc +0 -0
  111. clarifai/client/__pycache__/compute_cluster.cpython-311.pyc +0 -0
  112. clarifai/client/__pycache__/dataset.cpython-310.pyc +0 -0
  113. clarifai/client/__pycache__/dataset.cpython-311.pyc +0 -0
  114. clarifai/client/__pycache__/deployment.cpython-310.pyc +0 -0
  115. clarifai/client/__pycache__/deployment.cpython-311.pyc +0 -0
  116. clarifai/client/__pycache__/input.cpython-310.pyc +0 -0
  117. clarifai/client/__pycache__/input.cpython-311.pyc +0 -0
  118. clarifai/client/__pycache__/lister.cpython-310.pyc +0 -0
  119. clarifai/client/__pycache__/lister.cpython-311.pyc +0 -0
  120. clarifai/client/__pycache__/model.cpython-310.pyc +0 -0
  121. clarifai/client/__pycache__/model.cpython-311.pyc +0 -0
  122. clarifai/client/__pycache__/module.cpython-310.pyc +0 -0
  123. clarifai/client/__pycache__/module.cpython-311.pyc +0 -0
  124. clarifai/client/__pycache__/nodepool.cpython-310.pyc +0 -0
  125. clarifai/client/__pycache__/nodepool.cpython-311.pyc +0 -0
  126. clarifai/client/__pycache__/search.cpython-310.pyc +0 -0
  127. clarifai/client/__pycache__/search.cpython-311.pyc +0 -0
  128. clarifai/client/__pycache__/user.cpython-310.pyc +0 -0
  129. clarifai/client/__pycache__/user.cpython-311.pyc +0 -0
  130. clarifai/client/__pycache__/workflow.cpython-310.pyc +0 -0
  131. clarifai/client/__pycache__/workflow.cpython-311.pyc +0 -0
  132. clarifai/client/auth/__pycache__/__init__.cpython-310.pyc +0 -0
  133. clarifai/client/auth/__pycache__/__init__.cpython-311.pyc +0 -0
  134. clarifai/client/auth/__pycache__/helper.cpython-310.pyc +0 -0
  135. clarifai/client/auth/__pycache__/helper.cpython-311.pyc +0 -0
  136. clarifai/client/auth/__pycache__/register.cpython-310.pyc +0 -0
  137. clarifai/client/auth/__pycache__/register.cpython-311.pyc +0 -0
  138. clarifai/client/auth/__pycache__/stub.cpython-310.pyc +0 -0
  139. clarifai/client/auth/__pycache__/stub.cpython-311.pyc +0 -0
  140. clarifai/client/cli/__init__.py +0 -0
  141. clarifai/client/cli/__pycache__/__init__.cpython-310.pyc +0 -0
  142. clarifai/client/cli/__pycache__/base_cli.cpython-310.pyc +0 -0
  143. clarifai/client/cli/__pycache__/model_cli.cpython-310.pyc +0 -0
  144. clarifai/client/cli/base_cli.py +0 -88
  145. clarifai/client/cli/model_cli.py +0 -29
  146. clarifai/constants/__pycache__/base.cpython-310.pyc +0 -0
  147. clarifai/constants/__pycache__/base.cpython-311.pyc +0 -0
  148. clarifai/constants/__pycache__/dataset.cpython-310.pyc +0 -0
  149. clarifai/constants/__pycache__/dataset.cpython-311.pyc +0 -0
  150. clarifai/constants/__pycache__/input.cpython-310.pyc +0 -0
  151. clarifai/constants/__pycache__/input.cpython-311.pyc +0 -0
  152. clarifai/constants/__pycache__/model.cpython-310.pyc +0 -0
  153. clarifai/constants/__pycache__/model.cpython-311.pyc +0 -0
  154. clarifai/constants/__pycache__/rag.cpython-310.pyc +0 -0
  155. clarifai/constants/__pycache__/rag.cpython-311.pyc +0 -0
  156. clarifai/constants/__pycache__/search.cpython-310.pyc +0 -0
  157. clarifai/constants/__pycache__/search.cpython-311.pyc +0 -0
  158. clarifai/constants/__pycache__/workflow.cpython-310.pyc +0 -0
  159. clarifai/constants/__pycache__/workflow.cpython-311.pyc +0 -0
  160. clarifai/datasets/__pycache__/__init__.cpython-310.pyc +0 -0
  161. clarifai/datasets/__pycache__/__init__.cpython-311.pyc +0 -0
  162. clarifai/datasets/__pycache__/__init__.cpython-39.pyc +0 -0
  163. clarifai/datasets/export/__pycache__/__init__.cpython-310.pyc +0 -0
  164. clarifai/datasets/export/__pycache__/__init__.cpython-311.pyc +0 -0
  165. clarifai/datasets/export/__pycache__/__init__.cpython-39.pyc +0 -0
  166. clarifai/datasets/export/__pycache__/inputs_annotations.cpython-310.pyc +0 -0
  167. clarifai/datasets/export/__pycache__/inputs_annotations.cpython-311.pyc +0 -0
  168. clarifai/datasets/upload/__pycache__/__init__.cpython-310.pyc +0 -0
  169. clarifai/datasets/upload/__pycache__/__init__.cpython-311.pyc +0 -0
  170. clarifai/datasets/upload/__pycache__/__init__.cpython-39.pyc +0 -0
  171. clarifai/datasets/upload/__pycache__/base.cpython-310.pyc +0 -0
  172. clarifai/datasets/upload/__pycache__/base.cpython-311.pyc +0 -0
  173. clarifai/datasets/upload/__pycache__/features.cpython-310.pyc +0 -0
  174. clarifai/datasets/upload/__pycache__/features.cpython-311.pyc +0 -0
  175. clarifai/datasets/upload/__pycache__/image.cpython-310.pyc +0 -0
  176. clarifai/datasets/upload/__pycache__/image.cpython-311.pyc +0 -0
  177. clarifai/datasets/upload/__pycache__/multimodal.cpython-310.pyc +0 -0
  178. clarifai/datasets/upload/__pycache__/multimodal.cpython-311.pyc +0 -0
  179. clarifai/datasets/upload/__pycache__/text.cpython-310.pyc +0 -0
  180. clarifai/datasets/upload/__pycache__/text.cpython-311.pyc +0 -0
  181. clarifai/datasets/upload/__pycache__/utils.cpython-310.pyc +0 -0
  182. clarifai/datasets/upload/__pycache__/utils.cpython-311.pyc +0 -0
  183. clarifai/datasets/upload/loaders/__pycache__/__init__.cpython-311.pyc +0 -0
  184. clarifai/datasets/upload/loaders/__pycache__/__init__.cpython-39.pyc +0 -0
  185. clarifai/datasets/upload/loaders/__pycache__/coco_detection.cpython-311.pyc +0 -0
  186. clarifai/datasets/upload/loaders/__pycache__/imagenet_classification.cpython-311.pyc +0 -0
  187. clarifai/models/__pycache__/__init__.cpython-39.pyc +0 -0
  188. clarifai/modules/__pycache__/__init__.cpython-39.pyc +0 -0
  189. clarifai/rag/__pycache__/__init__.cpython-310.pyc +0 -0
  190. clarifai/rag/__pycache__/__init__.cpython-311.pyc +0 -0
  191. clarifai/rag/__pycache__/__init__.cpython-39.pyc +0 -0
  192. clarifai/rag/__pycache__/rag.cpython-310.pyc +0 -0
  193. clarifai/rag/__pycache__/rag.cpython-311.pyc +0 -0
  194. clarifai/rag/__pycache__/rag.cpython-39.pyc +0 -0
  195. clarifai/rag/__pycache__/utils.cpython-310.pyc +0 -0
  196. clarifai/rag/__pycache__/utils.cpython-311.pyc +0 -0
  197. clarifai/runners/__pycache__/__init__.cpython-310.pyc +0 -0
  198. clarifai/runners/__pycache__/__init__.cpython-311.pyc +0 -0
  199. clarifai/runners/__pycache__/__init__.cpython-39.pyc +0 -0
  200. clarifai/runners/dockerfile_template/Dockerfile.cpu.template +0 -31
  201. clarifai/runners/dockerfile_template/Dockerfile.cuda.template +0 -42
  202. clarifai/runners/dockerfile_template/Dockerfile.nim +0 -71
  203. clarifai/runners/models/__pycache__/__init__.cpython-310.pyc +0 -0
  204. clarifai/runners/models/__pycache__/__init__.cpython-311.pyc +0 -0
  205. clarifai/runners/models/__pycache__/__init__.cpython-39.pyc +0 -0
  206. clarifai/runners/models/__pycache__/base_typed_model.cpython-310.pyc +0 -0
  207. clarifai/runners/models/__pycache__/base_typed_model.cpython-311.pyc +0 -0
  208. clarifai/runners/models/__pycache__/base_typed_model.cpython-39.pyc +0 -0
  209. clarifai/runners/models/__pycache__/model_builder.cpython-311.pyc +0 -0
  210. clarifai/runners/models/__pycache__/model_class.cpython-310.pyc +0 -0
  211. clarifai/runners/models/__pycache__/model_class.cpython-311.pyc +0 -0
  212. clarifai/runners/models/__pycache__/model_run_locally.cpython-310-pytest-7.1.2.pyc +0 -0
  213. clarifai/runners/models/__pycache__/model_run_locally.cpython-310.pyc +0 -0
  214. clarifai/runners/models/__pycache__/model_run_locally.cpython-311.pyc +0 -0
  215. clarifai/runners/models/__pycache__/model_runner.cpython-310.pyc +0 -0
  216. clarifai/runners/models/__pycache__/model_runner.cpython-311.pyc +0 -0
  217. clarifai/runners/models/__pycache__/model_upload.cpython-310.pyc +0 -0
  218. clarifai/runners/models/base_typed_model.py +0 -238
  219. clarifai/runners/models/model_class_refract.py +0 -80
  220. clarifai/runners/models/model_upload.py +0 -607
  221. clarifai/runners/models/temp.py +0 -25
  222. clarifai/runners/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  223. clarifai/runners/utils/__pycache__/__init__.cpython-311.pyc +0 -0
  224. clarifai/runners/utils/__pycache__/__init__.cpython-38.pyc +0 -0
  225. clarifai/runners/utils/__pycache__/__init__.cpython-39.pyc +0 -0
  226. clarifai/runners/utils/__pycache__/buffered_stream.cpython-310.pyc +0 -0
  227. clarifai/runners/utils/__pycache__/buffered_stream.cpython-38.pyc +0 -0
  228. clarifai/runners/utils/__pycache__/buffered_stream.cpython-39.pyc +0 -0
  229. clarifai/runners/utils/__pycache__/const.cpython-310.pyc +0 -0
  230. clarifai/runners/utils/__pycache__/const.cpython-311.pyc +0 -0
  231. clarifai/runners/utils/__pycache__/constants.cpython-310.pyc +0 -0
  232. clarifai/runners/utils/__pycache__/constants.cpython-38.pyc +0 -0
  233. clarifai/runners/utils/__pycache__/constants.cpython-39.pyc +0 -0
  234. clarifai/runners/utils/__pycache__/data_handler.cpython-310.pyc +0 -0
  235. clarifai/runners/utils/__pycache__/data_handler.cpython-311.pyc +0 -0
  236. clarifai/runners/utils/__pycache__/data_handler.cpython-38.pyc +0 -0
  237. clarifai/runners/utils/__pycache__/data_handler.cpython-39.pyc +0 -0
  238. clarifai/runners/utils/__pycache__/data_utils.cpython-310.pyc +0 -0
  239. clarifai/runners/utils/__pycache__/data_utils.cpython-311.pyc +0 -0
  240. clarifai/runners/utils/__pycache__/data_utils.cpython-38.pyc +0 -0
  241. clarifai/runners/utils/__pycache__/data_utils.cpython-39.pyc +0 -0
  242. clarifai/runners/utils/__pycache__/grpc_server.cpython-310.pyc +0 -0
  243. clarifai/runners/utils/__pycache__/grpc_server.cpython-38.pyc +0 -0
  244. clarifai/runners/utils/__pycache__/grpc_server.cpython-39.pyc +0 -0
  245. clarifai/runners/utils/__pycache__/health.cpython-310.pyc +0 -0
  246. clarifai/runners/utils/__pycache__/health.cpython-38.pyc +0 -0
  247. clarifai/runners/utils/__pycache__/health.cpython-39.pyc +0 -0
  248. clarifai/runners/utils/__pycache__/loader.cpython-310.pyc +0 -0
  249. clarifai/runners/utils/__pycache__/loader.cpython-311.pyc +0 -0
  250. clarifai/runners/utils/__pycache__/logging.cpython-310.pyc +0 -0
  251. clarifai/runners/utils/__pycache__/logging.cpython-38.pyc +0 -0
  252. clarifai/runners/utils/__pycache__/logging.cpython-39.pyc +0 -0
  253. clarifai/runners/utils/__pycache__/stream_source.cpython-310.pyc +0 -0
  254. clarifai/runners/utils/__pycache__/stream_source.cpython-39.pyc +0 -0
  255. clarifai/runners/utils/__pycache__/url_fetcher.cpython-310.pyc +0 -0
  256. clarifai/runners/utils/__pycache__/url_fetcher.cpython-311.pyc +0 -0
  257. clarifai/runners/utils/__pycache__/url_fetcher.cpython-38.pyc +0 -0
  258. clarifai/runners/utils/__pycache__/url_fetcher.cpython-39.pyc +0 -0
  259. clarifai/runners/utils/data_handler.py +0 -231
  260. clarifai/runners/utils/data_handler_refract.py +0 -213
  261. clarifai/runners/utils/data_types.py +0 -469
  262. clarifai/runners/utils/logger.py +0 -0
  263. clarifai/runners/utils/openai_format.py +0 -87
  264. clarifai/schema/__pycache__/search.cpython-310.pyc +0 -0
  265. clarifai/schema/__pycache__/search.cpython-311.pyc +0 -0
  266. clarifai/urls/__pycache__/helper.cpython-310.pyc +0 -0
  267. clarifai/urls/__pycache__/helper.cpython-311.pyc +0 -0
  268. clarifai/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  269. clarifai/utils/__pycache__/__init__.cpython-311.pyc +0 -0
  270. clarifai/utils/__pycache__/__init__.cpython-39.pyc +0 -0
  271. clarifai/utils/__pycache__/cli.cpython-310.pyc +0 -0
  272. clarifai/utils/__pycache__/cli.cpython-311.pyc +0 -0
  273. clarifai/utils/__pycache__/config.cpython-311.pyc +0 -0
  274. clarifai/utils/__pycache__/constants.cpython-310.pyc +0 -0
  275. clarifai/utils/__pycache__/constants.cpython-311.pyc +0 -0
  276. clarifai/utils/__pycache__/logging.cpython-310.pyc +0 -0
  277. clarifai/utils/__pycache__/logging.cpython-311.pyc +0 -0
  278. clarifai/utils/__pycache__/misc.cpython-310.pyc +0 -0
  279. clarifai/utils/__pycache__/misc.cpython-311.pyc +0 -0
  280. clarifai/utils/__pycache__/model_train.cpython-310.pyc +0 -0
  281. clarifai/utils/__pycache__/model_train.cpython-311.pyc +0 -0
  282. clarifai/utils/__pycache__/protobuf.cpython-311.pyc +0 -0
  283. clarifai/utils/evaluation/__pycache__/__init__.cpython-311.pyc +0 -0
  284. clarifai/utils/evaluation/__pycache__/__init__.cpython-39.pyc +0 -0
  285. clarifai/utils/evaluation/__pycache__/helpers.cpython-311.pyc +0 -0
  286. clarifai/utils/evaluation/__pycache__/main.cpython-311.pyc +0 -0
  287. clarifai/utils/evaluation/__pycache__/main.cpython-39.pyc +0 -0
  288. clarifai/workflows/__pycache__/__init__.cpython-310.pyc +0 -0
  289. clarifai/workflows/__pycache__/__init__.cpython-311.pyc +0 -0
  290. clarifai/workflows/__pycache__/__init__.cpython-39.pyc +0 -0
  291. clarifai/workflows/__pycache__/export.cpython-310.pyc +0 -0
  292. clarifai/workflows/__pycache__/export.cpython-311.pyc +0 -0
  293. clarifai/workflows/__pycache__/utils.cpython-310.pyc +0 -0
  294. clarifai/workflows/__pycache__/utils.cpython-311.pyc +0 -0
  295. clarifai/workflows/__pycache__/validate.cpython-310.pyc +0 -0
  296. clarifai/workflows/__pycache__/validate.cpython-311.pyc +0 -0
  297. clarifai-11.3.0rc2.dist-info/RECORD +0 -322
  298. {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/entry_points.txt +0 -0
  299. {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info/licenses}/LICENSE +0 -0
  300. {clarifai-11.3.0rc2.dist-info → clarifai-11.4.0.dist-info}/top_level.txt +0 -0
@@ -20,278 +20,298 @@ from clarifai.workflows.export import Exporter
20
20
 
21
21
 
22
22
  class Workflow(Lister, BaseClient):
23
- """Workflow is a class that provides access to Clarifai API endpoints related to Workflow information."""
24
-
25
- def __init__(self,
26
- url: str = None,
27
- workflow_id: str = None,
28
- workflow_version: Dict = {'id': ""},
29
- output_config: Dict = {'min_value': 0},
30
- base_url: str = "https://api.clarifai.com",
31
- pat: str = None,
32
- token: str = None,
33
- root_certificates_path: str = None,
34
- **kwargs):
35
- """Initializes a Workflow object.
36
-
37
- Args:
38
- url (str): The URL to initialize the workflow object.
39
- workflow_id (str): The Workflow ID to interact with.
40
- workflow_version (dict): The Workflow Version to interact with.
41
- output_config (dict): The output config to interact with.
42
- min_value (float): The minimum value of the prediction confidence to filter.
43
- max_concepts (int): The maximum number of concepts to return.
44
- select_concepts (list[Concept]): The concepts to select.
45
- sample_ms (int): The number of milliseconds to sample.
46
- base_url (str): Base API url. Default "https://api.clarifai.com"
47
- pat (str): A personal access token for authentication. Can be set as env var CLARIFAI_PAT
48
- token (str): A session token for authentication. Accepts either a session token or a pat. Can be set as env var CLARIFAI_SESSION_TOKEN
49
- root_certificates_path (str): Path to the SSL root certificates file, used to establish secure gRPC connections.
50
- **kwargs: Additional keyword arguments to be passed to the Workflow.
51
- """
52
- if url and workflow_id:
53
- raise UserError("You can only specify one of url or workflow_id.")
54
- if not url and not workflow_id:
55
- raise UserError("You must specify one of url or workflow_id.")
56
- if url:
57
- user_id, app_id, _, workflow_id, workflow_version_id = ClarifaiUrlHelper.split_clarifai_url(
58
- url)
59
- workflow_version = {'id': workflow_version_id}
60
- kwargs = {'user_id': user_id, 'app_id': app_id}
61
- self.kwargs = {**kwargs, 'id': workflow_id, 'version': workflow_version}
62
- self.output_config = output_config
63
- self.workflow_info = resources_pb2.Workflow(**self.kwargs)
64
- self.logger = logger
65
- self.input_types = None
66
- BaseClient.__init__(
23
+ """Workflow is a class that provides access to Clarifai API endpoints related to Workflow information."""
24
+
25
+ def __init__(
67
26
  self,
68
- user_id=self.user_id,
69
- app_id=self.app_id,
70
- base=base_url,
71
- pat=pat,
72
- token=token,
73
- root_certificates_path=root_certificates_path)
74
- Lister.__init__(self)
75
-
76
- def predict(self, inputs: List[Input], workflow_state_id: str = None):
77
- """Predicts the workflow based on the given inputs.
78
-
79
- Args:
80
- inputs (list[Input]): The inputs to predict.
81
- workflow_state_id (str): key for the workflow state cache that stores the workflow node predictions.
82
- """
83
- if len(inputs) > MAX_WORKFLOW_PREDICT_INPUTS:
84
- raise UserError(f"Too many inputs. Max is {MAX_WORKFLOW_PREDICT_INPUTS}."
85
- ) # TODO Use Chunker for inputs len > 32
86
- request = service_pb2.PostWorkflowResultsRequest(
87
- user_app_id=self.user_app_id,
88
- workflow_id=self.id,
89
- version_id=self.version.id,
90
- inputs=inputs,
91
- output_config=self.output_config)
92
-
93
- if workflow_state_id:
94
- request.workflow_state.id = workflow_state_id
95
-
96
- start_time = time.time()
97
- backoff_iterator = BackoffIterator(10)
98
-
99
- while True:
100
- response = self._grpc_request(self.STUB.PostWorkflowResults, request)
101
-
102
- if status_is_retryable(response.status.code) and \
103
- time.time() - start_time < 60*10: # 10 minutes
104
- self.logger.info(f"{self.id} Workflow is still deploying, please wait...")
105
- time.sleep(next(backoff_iterator))
106
- continue
107
-
108
- if response.status.code != status_code_pb2.SUCCESS:
109
- raise Exception(f"Workflow Predict failed with response {response.status!r}")
110
- else:
111
- break
112
-
113
- return response
114
-
115
- def predict_by_filepath(self, filepath: str, input_type: str = None):
116
- """Predicts the workflow based on the given filepath.
117
-
118
- Args:
119
- filepath (str): The filepath to predict.
120
- input_type (str, optional): The type of input. Can be 'image', 'text', 'video' or 'audio.
121
-
122
- Example:
123
- >>> from clarifai.client.workflow import Workflow
124
- >>> workflow = Workflow("url") # Example: https://clarifai.com/clarifai/main/workflows/Face-Sentiment
125
- or
126
- >>> workflow = Workflow(user_id='user_id', app_id='app_id', workflow_id='workflow_id')
127
- >>> workflow_prediction = workflow.predict_by_filepath('filepath')
128
- """
129
- if not input_type:
130
- self.load_info()
131
- if len(self.input_types) > 1:
132
- raise UserError("Workflow has multiple input types. Please use workflow.predict().")
133
- input_type = self.input_types[0]
134
-
135
- if input_type not in {'image', 'text', 'video', 'audio'}:
136
- raise UserError('Invalid input type it should be image, text, video or audio.')
137
- if not os.path.isfile(filepath):
138
- raise UserError('Invalid filepath.')
139
-
140
- with open(filepath, "rb") as f:
141
- file_bytes = f.read()
142
-
143
- return self.predict_by_bytes(file_bytes, input_type)
144
-
145
- def predict_by_bytes(self, input_bytes: bytes, input_type: str = None):
146
- """Predicts the workflow based on the given bytes.
147
-
148
- Args:
149
- input_bytes (bytes): Bytes to predict on.
150
- input_type (str, optional): The type of input. Can be 'image', 'text', 'video' or 'audio.
151
- """
152
- if not input_type:
153
- self.load_info()
154
- if len(self.input_types) > 1:
155
- raise UserError("Workflow has multiple input types. Please use workflow.predict().")
156
- input_type = self.input_types[0]
157
-
158
- if input_type not in {'image', 'text', 'video', 'audio'}:
159
- raise UserError('Invalid input type it should be image, text, video or audio.')
160
- if not isinstance(input_bytes, bytes):
161
- raise UserError('Invalid bytes.')
162
-
163
- if input_type == "image":
164
- input_proto = Inputs.get_input_from_bytes("", image_bytes=input_bytes)
165
- elif input_type == "text":
166
- input_proto = Inputs.get_input_from_bytes("", text_bytes=input_bytes)
167
- elif input_type == "video":
168
- input_proto = Inputs.get_input_from_bytes("", video_bytes=input_bytes)
169
- elif input_type == "audio":
170
- input_proto = Inputs.get_input_from_bytes("", audio_bytes=input_bytes)
171
-
172
- return self.predict(inputs=[input_proto])
173
-
174
- def predict_by_url(self, url: str, input_type: str = None):
175
- """Predicts the workflow based on the given URL.
176
-
177
- Args:
178
- url (str): The URL to predict.
179
- input_type (str, optional): The type of input. Can be 'image', 'text', 'video' or 'audio.
180
-
181
- Example:
182
- >>> from clarifai.client.workflow import Workflow
183
- >>> workflow = Workflow("url") # Example: https://clarifai.com/clarifai/main/workflows/Face-Sentiment
184
- or
185
- >>> workflow = Workflow(user_id='user_id', app_id='app_id', workflow_id='workflow_id')
186
- >>> workflow_prediction = workflow.predict_by_url('url')
187
- """
188
- if not input_type:
189
- self.load_info()
190
- if len(self.input_types) > 1:
191
- raise UserError("Workflow has multiple input types. Please use workflow.predict().")
192
- input_type = self.input_types[0]
193
-
194
- if input_type not in {'image', 'text', 'video', 'audio'}:
195
- raise UserError('Invalid input type it should be image, text, video or audio.')
196
-
197
- if input_type == "image":
198
- input_proto = Inputs.get_input_from_url("", image_url=url)
199
- elif input_type == "text":
200
- input_proto = Inputs.get_input_from_url("", text_url=url)
201
- elif input_type == "video":
202
- input_proto = Inputs.get_input_from_url("", video_url=url)
203
- elif input_type == "audio":
204
- input_proto = Inputs.get_input_from_url("", audio_url=url)
205
-
206
- return self.predict(inputs=[input_proto])
207
-
208
- def list_versions(self, page_no: int = None,
209
- per_page: int = None) -> Generator['Workflow', None, None]:
210
- """Lists all the versions of the workflow.
211
-
212
- Args:
213
- page_no (int): The page number to list.
214
- per_page (int): The number of items per page.
215
-
216
- Yields:
217
- Workflow: Workflow objects for versions of the workflow.
218
-
219
- Example:
220
- >>> from clarifai.client.workflow import Workflow
221
- >>> workflow = Workflow(user_id='user_id', app_id='app_id', workflow_id='workflow_id')
222
- >>> workflow_versions = list(workflow.list_versions())
223
-
224
- Note:
225
- Defaults to 16 per page if page_no is specified and per_page is not specified.
226
- If both page_no and per_page are None, then lists all the resources.
227
- """
228
- request_data = dict(
229
- user_app_id=self.user_app_id,
230
- workflow_id=self.id,
231
- )
232
- all_workflow_versions_info = self.list_pages_generator(
233
- self.STUB.ListWorkflowVersions,
234
- service_pb2.ListWorkflowVersionsRequest,
235
- request_data,
236
- per_page=per_page,
237
- page_no=page_no)
238
-
239
- for workflow_version_info in all_workflow_versions_info:
240
- workflow_version_info['id'] = workflow_version_info['workflow_version_id']
241
- del workflow_version_info['workflow_version_id']
242
- yield Workflow.from_auth_helper(
243
- auth=self.auth_helper,
244
- workflow_id=self.id,
245
- **dict(self.kwargs, version=workflow_version_info))
246
-
247
- def export(self, out_path: str):
248
- """Exports the workflow to a yaml file.
249
-
250
- Args:
251
- out_path (str): The path to save the yaml file to.
252
-
253
- Example:
254
- >>> from clarifai.client.workflow import Workflow
255
- >>> workflow = Workflow("https://clarifai.com/clarifai/main/workflows/Demographics")
256
- >>> workflow.export('out_path.yml')
257
- """
258
- request = service_pb2.GetWorkflowRequest(user_app_id=self.user_app_id, workflow_id=self.id)
259
- response = self._grpc_request(self.STUB.GetWorkflow, request)
260
- if response.status.code != status_code_pb2.SUCCESS:
261
- raise Exception(f"Workflow Export failed with response {response.status!r}")
262
-
263
- with Exporter(response) as e:
264
- e.parse()
265
- e.export(out_path)
266
-
267
- self.logger.info(f"Exported workflow to {out_path}")
268
-
269
- def load_info(self) -> None:
270
- """Loads the workflow info."""
271
- if not self.input_types:
272
- request = service_pb2.GetWorkflowRequest(user_app_id=self.user_app_id, workflow_id=self.id)
273
- response = self._grpc_request(self.STUB.GetWorkflow, request)
274
- if response.status.code != status_code_pb2.SUCCESS:
275
- raise Exception(f"Workflow Get failed with response {response.status!r}")
276
-
277
- dict_response = MessageToDict(response, preserving_proto_field_name=True)
278
- self.kwargs = self.process_response_keys(dict_response['workflow'])
279
- self.workflow_info = resources_pb2.Workflow(**self.kwargs)
280
-
281
- model = Model(
282
- model_id=self.kwargs['nodes'][0]['model']['id'],
283
- **self.kwargs['nodes'][0]['model'],
284
- pat=self.pat)
285
- model.load_input_types()
286
- self.input_types = model.input_types
287
-
288
- def __getattr__(self, name):
289
- return getattr(self.workflow_info, name)
290
-
291
- def __str__(self):
292
- init_params = [param for param in self.kwargs.keys()]
293
- attribute_strings = [
294
- f"{param}={getattr(self.workflow_info, param)}" for param in init_params
295
- if hasattr(self.workflow_info, param)
296
- ]
297
- return f"Workflow Details: \n{', '.join(attribute_strings)}\n"
27
+ url: str = None,
28
+ workflow_id: str = None,
29
+ workflow_version: Dict = {'id': ""},
30
+ output_config: Dict = {'min_value': 0},
31
+ base_url: str = "https://api.clarifai.com",
32
+ pat: str = None,
33
+ token: str = None,
34
+ root_certificates_path: str = None,
35
+ **kwargs,
36
+ ):
37
+ """Initializes a Workflow object.
38
+
39
+ Args:
40
+ url (str): The URL to initialize the workflow object.
41
+ workflow_id (str): The Workflow ID to interact with.
42
+ workflow_version (dict): The Workflow Version to interact with.
43
+ output_config (dict): The output config to interact with.
44
+ min_value (float): The minimum value of the prediction confidence to filter.
45
+ max_concepts (int): The maximum number of concepts to return.
46
+ select_concepts (list[Concept]): The concepts to select.
47
+ sample_ms (int): The number of milliseconds to sample.
48
+ base_url (str): Base API url. Default "https://api.clarifai.com"
49
+ pat (str): A personal access token for authentication. Can be set as env var CLARIFAI_PAT
50
+ token (str): A session token for authentication. Accepts either a session token or a pat. Can be set as env var CLARIFAI_SESSION_TOKEN
51
+ root_certificates_path (str): Path to the SSL root certificates file, used to establish secure gRPC connections.
52
+ **kwargs: Additional keyword arguments to be passed to the Workflow.
53
+ """
54
+ if url and workflow_id:
55
+ raise UserError("You can only specify one of url or workflow_id.")
56
+ if not url and not workflow_id:
57
+ raise UserError("You must specify one of url or workflow_id.")
58
+ if url:
59
+ user_id, app_id, _, workflow_id, workflow_version_id = (
60
+ ClarifaiUrlHelper.split_clarifai_url(url)
61
+ )
62
+ workflow_version = {'id': workflow_version_id}
63
+ kwargs = {'user_id': user_id, 'app_id': app_id}
64
+ self.kwargs = {**kwargs, 'id': workflow_id, 'version': workflow_version}
65
+ self.output_config = output_config
66
+ self.workflow_info = resources_pb2.Workflow(**self.kwargs)
67
+ self.logger = logger
68
+ self.input_types = None
69
+ BaseClient.__init__(
70
+ self,
71
+ user_id=self.user_id,
72
+ app_id=self.app_id,
73
+ base=base_url,
74
+ pat=pat,
75
+ token=token,
76
+ root_certificates_path=root_certificates_path,
77
+ )
78
+ Lister.__init__(self)
79
+
80
+ def predict(self, inputs: List[Input], workflow_state_id: str = None):
81
+ """Predicts the workflow based on the given inputs.
82
+
83
+ Args:
84
+ inputs (list[Input]): The inputs to predict.
85
+ workflow_state_id (str): key for the workflow state cache that stores the workflow node predictions.
86
+ """
87
+ if len(inputs) > MAX_WORKFLOW_PREDICT_INPUTS:
88
+ raise UserError(
89
+ f"Too many inputs. Max is {MAX_WORKFLOW_PREDICT_INPUTS}."
90
+ ) # TODO Use Chunker for inputs len > 32
91
+ request = service_pb2.PostWorkflowResultsRequest(
92
+ user_app_id=self.user_app_id,
93
+ workflow_id=self.id,
94
+ version_id=self.version.id,
95
+ inputs=inputs,
96
+ output_config=self.output_config,
97
+ )
98
+
99
+ if workflow_state_id:
100
+ request.workflow_state.id = workflow_state_id
101
+
102
+ start_time = time.time()
103
+ backoff_iterator = BackoffIterator(10)
104
+
105
+ while True:
106
+ response = self._grpc_request(self.STUB.PostWorkflowResults, request)
107
+
108
+ if (
109
+ status_is_retryable(response.status.code) and time.time() - start_time < 60 * 10
110
+ ): # 10 minutes
111
+ self.logger.info(f"{self.id} Workflow is still deploying, please wait...")
112
+ time.sleep(next(backoff_iterator))
113
+ continue
114
+
115
+ if response.status.code != status_code_pb2.SUCCESS:
116
+ raise Exception(f"Workflow Predict failed with response {response.status!r}")
117
+ else:
118
+ break
119
+
120
+ return response
121
+
122
+ def predict_by_filepath(self, filepath: str, input_type: str = None):
123
+ """Predicts the workflow based on the given filepath.
124
+
125
+ Args:
126
+ filepath (str): The filepath to predict.
127
+ input_type (str, optional): The type of input. Can be 'image', 'text', 'video' or 'audio.
128
+
129
+ Example:
130
+ >>> from clarifai.client.workflow import Workflow
131
+ >>> workflow = Workflow("url") # Example: https://clarifai.com/clarifai/main/workflows/Face-Sentiment
132
+ or
133
+ >>> workflow = Workflow(user_id='user_id', app_id='app_id', workflow_id='workflow_id')
134
+ >>> workflow_prediction = workflow.predict_by_filepath('filepath')
135
+ """
136
+ if not input_type:
137
+ self.load_info()
138
+ if len(self.input_types) > 1:
139
+ raise UserError(
140
+ "Workflow has multiple input types. Please use workflow.predict()."
141
+ )
142
+ input_type = self.input_types[0]
143
+
144
+ if input_type not in {'image', 'text', 'video', 'audio'}:
145
+ raise UserError('Invalid input type it should be image, text, video or audio.')
146
+ if not os.path.isfile(filepath):
147
+ raise UserError('Invalid filepath.')
148
+
149
+ with open(filepath, "rb") as f:
150
+ file_bytes = f.read()
151
+
152
+ return self.predict_by_bytes(file_bytes, input_type)
153
+
154
+ def predict_by_bytes(self, input_bytes: bytes, input_type: str = None):
155
+ """Predicts the workflow based on the given bytes.
156
+
157
+ Args:
158
+ input_bytes (bytes): Bytes to predict on.
159
+ input_type (str, optional): The type of input. Can be 'image', 'text', 'video' or 'audio.
160
+ """
161
+ if not input_type:
162
+ self.load_info()
163
+ if len(self.input_types) > 1:
164
+ raise UserError(
165
+ "Workflow has multiple input types. Please use workflow.predict()."
166
+ )
167
+ input_type = self.input_types[0]
168
+
169
+ if input_type not in {'image', 'text', 'video', 'audio'}:
170
+ raise UserError('Invalid input type it should be image, text, video or audio.')
171
+ if not isinstance(input_bytes, bytes):
172
+ raise UserError('Invalid bytes.')
173
+
174
+ if input_type == "image":
175
+ input_proto = Inputs.get_input_from_bytes("", image_bytes=input_bytes)
176
+ elif input_type == "text":
177
+ input_proto = Inputs.get_input_from_bytes("", text_bytes=input_bytes)
178
+ elif input_type == "video":
179
+ input_proto = Inputs.get_input_from_bytes("", video_bytes=input_bytes)
180
+ elif input_type == "audio":
181
+ input_proto = Inputs.get_input_from_bytes("", audio_bytes=input_bytes)
182
+
183
+ return self.predict(inputs=[input_proto])
184
+
185
+ def predict_by_url(self, url: str, input_type: str = None):
186
+ """Predicts the workflow based on the given URL.
187
+
188
+ Args:
189
+ url (str): The URL to predict.
190
+ input_type (str, optional): The type of input. Can be 'image', 'text', 'video' or 'audio.
191
+
192
+ Example:
193
+ >>> from clarifai.client.workflow import Workflow
194
+ >>> workflow = Workflow("url") # Example: https://clarifai.com/clarifai/main/workflows/Face-Sentiment
195
+ or
196
+ >>> workflow = Workflow(user_id='user_id', app_id='app_id', workflow_id='workflow_id')
197
+ >>> workflow_prediction = workflow.predict_by_url('url')
198
+ """
199
+ if not input_type:
200
+ self.load_info()
201
+ if len(self.input_types) > 1:
202
+ raise UserError(
203
+ "Workflow has multiple input types. Please use workflow.predict()."
204
+ )
205
+ input_type = self.input_types[0]
206
+
207
+ if input_type not in {'image', 'text', 'video', 'audio'}:
208
+ raise UserError('Invalid input type it should be image, text, video or audio.')
209
+
210
+ if input_type == "image":
211
+ input_proto = Inputs.get_input_from_url("", image_url=url)
212
+ elif input_type == "text":
213
+ input_proto = Inputs.get_input_from_url("", text_url=url)
214
+ elif input_type == "video":
215
+ input_proto = Inputs.get_input_from_url("", video_url=url)
216
+ elif input_type == "audio":
217
+ input_proto = Inputs.get_input_from_url("", audio_url=url)
218
+
219
+ return self.predict(inputs=[input_proto])
220
+
221
+ def list_versions(
222
+ self, page_no: int = None, per_page: int = None
223
+ ) -> Generator['Workflow', None, None]:
224
+ """Lists all the versions of the workflow.
225
+
226
+ Args:
227
+ page_no (int): The page number to list.
228
+ per_page (int): The number of items per page.
229
+
230
+ Yields:
231
+ Workflow: Workflow objects for versions of the workflow.
232
+
233
+ Example:
234
+ >>> from clarifai.client.workflow import Workflow
235
+ >>> workflow = Workflow(user_id='user_id', app_id='app_id', workflow_id='workflow_id')
236
+ >>> workflow_versions = list(workflow.list_versions())
237
+
238
+ Note:
239
+ Defaults to 16 per page if page_no is specified and per_page is not specified.
240
+ If both page_no and per_page are None, then lists all the resources.
241
+ """
242
+ request_data = dict(
243
+ user_app_id=self.user_app_id,
244
+ workflow_id=self.id,
245
+ )
246
+ all_workflow_versions_info = self.list_pages_generator(
247
+ self.STUB.ListWorkflowVersions,
248
+ service_pb2.ListWorkflowVersionsRequest,
249
+ request_data,
250
+ per_page=per_page,
251
+ page_no=page_no,
252
+ )
253
+
254
+ for workflow_version_info in all_workflow_versions_info:
255
+ workflow_version_info['id'] = workflow_version_info['workflow_version_id']
256
+ del workflow_version_info['workflow_version_id']
257
+ yield Workflow.from_auth_helper(
258
+ auth=self.auth_helper,
259
+ workflow_id=self.id,
260
+ **dict(self.kwargs, version=workflow_version_info),
261
+ )
262
+
263
+ def export(self, out_path: str):
264
+ """Exports the workflow to a yaml file.
265
+
266
+ Args:
267
+ out_path (str): The path to save the yaml file to.
268
+
269
+ Example:
270
+ >>> from clarifai.client.workflow import Workflow
271
+ >>> workflow = Workflow("https://clarifai.com/clarifai/main/workflows/Demographics")
272
+ >>> workflow.export('out_path.yml')
273
+ """
274
+ request = service_pb2.GetWorkflowRequest(user_app_id=self.user_app_id, workflow_id=self.id)
275
+ response = self._grpc_request(self.STUB.GetWorkflow, request)
276
+ if response.status.code != status_code_pb2.SUCCESS:
277
+ raise Exception(f"Workflow Export failed with response {response.status!r}")
278
+
279
+ with Exporter(response) as e:
280
+ e.parse()
281
+ e.export(out_path)
282
+
283
+ self.logger.info(f"Exported workflow to {out_path}")
284
+
285
+ def load_info(self) -> None:
286
+ """Loads the workflow info."""
287
+ if not self.input_types:
288
+ request = service_pb2.GetWorkflowRequest(
289
+ user_app_id=self.user_app_id, workflow_id=self.id
290
+ )
291
+ response = self._grpc_request(self.STUB.GetWorkflow, request)
292
+ if response.status.code != status_code_pb2.SUCCESS:
293
+ raise Exception(f"Workflow Get failed with response {response.status!r}")
294
+
295
+ dict_response = MessageToDict(response, preserving_proto_field_name=True)
296
+ self.kwargs = self.process_response_keys(dict_response['workflow'])
297
+ self.workflow_info = resources_pb2.Workflow(**self.kwargs)
298
+
299
+ model = Model(
300
+ model_id=self.kwargs['nodes'][0]['model']['id'],
301
+ **self.kwargs['nodes'][0]['model'],
302
+ pat=self.pat,
303
+ )
304
+ model.load_input_types()
305
+ self.input_types = model.input_types
306
+
307
+ def __getattr__(self, name):
308
+ return getattr(self.workflow_info, name)
309
+
310
+ def __str__(self):
311
+ init_params = [param for param in self.kwargs.keys()]
312
+ attribute_strings = [
313
+ f"{param}={getattr(self.workflow_info, param)}"
314
+ for param in init_params
315
+ if hasattr(self.workflow_info, param)
316
+ ]
317
+ return f"Workflow Details: \n{', '.join(attribute_strings)}\n"
@@ -1,24 +1,18 @@
1
1
  DATASET_UPLOAD_TASKS = [
2
- "visual_classification", "text_classification", "visual_detection", "visual_segmentation",
3
- "visual_captioning", "multimodal_dataset"
2
+ "visual_classification",
3
+ "text_classification",
4
+ "visual_detection",
5
+ "visual_segmentation",
6
+ "visual_captioning",
7
+ "multimodal_dataset",
4
8
  ]
5
9
 
6
10
  TASK_TO_ANNOTATION_TYPE = {
7
- "visual_classification": {
8
- "concepts": "labels"
9
- },
10
- "text_classification": {
11
- "concepts": "labels"
12
- },
13
- "visual_captioning": {
14
- "concepts": "labels"
15
- },
16
- "visual_detection": {
17
- "bboxes": "bboxes"
18
- },
19
- "visual_segmentation": {
20
- "polygons": "polygons"
21
- },
11
+ "visual_classification": {"concepts": "labels"},
12
+ "text_classification": {"concepts": "labels"},
13
+ "visual_captioning": {"concepts": "labels"},
14
+ "visual_detection": {"bboxes": "bboxes"},
15
+ "visual_segmentation": {"polygons": "polygons"},
22
16
  }
23
17
 
24
18
  MAX_RETRIES = 2
@@ -1,6 +1,12 @@
1
1
  TRAINABLE_MODEL_TYPES = [
2
- 'visual-classifier', 'visual-detector', 'visual-segmenter', 'visual-embedder', 'clusterer',
3
- 'text-classifier', 'embedding-classifier', 'text-to-text'
2
+ 'visual-classifier',
3
+ 'visual-detector',
4
+ 'visual-segmenter',
5
+ 'visual-embedder',
6
+ 'clusterer',
7
+ 'text-classifier',
8
+ 'embedding-classifier',
9
+ 'text-to-text',
4
10
  ]
5
11
  MAX_MODEL_PREDICT_INPUTS = 128
6
12
  MODEL_EXPORT_TIMEOUT = 1800