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
@@ -18,223 +18,239 @@ from clarifai.utils.logging import logger
18
18
 
19
19
 
20
20
  class DatasetExportReader:
21
-
22
- def __init__(self,
23
- session: requests.Session = None,
24
- archive_url: Optional[str] = None,
25
- local_archive_path: Optional[str] = None):
26
- """Download/Reads the zipfile archive and yields every api.Input object.
27
-
28
- Args:
29
- session: requests.Session object
30
- archive_url: URL of the DatasetVersionExport archive
31
- local_archive_path: Path to the DatasetVersionExport archive
32
- """
33
- self.input_count = None
34
- self.temp_file = None
35
- self.session = session
36
- if not self.session:
37
- self.session = requests.Session()
38
-
39
- assert archive_url or local_archive_path, UserError(
40
- "Either archive_url or local_archive_path must be provided.")
41
- assert not (archive_url and local_archive_path), UserError(
42
- "Only one of archive_url or local_archive_path must be provided.")
43
-
44
- if archive_url:
45
- logger.info('url: %s' % archive_url)
46
- self.temp_file = self._download_temp_archive(archive_url)
47
- self.archive = zipfile.ZipFile(self.temp_file)
48
- else:
49
- logger.info("path: %s" % local_archive_path)
50
- self.archive = zipfile.ZipFile(local_archive_path)
51
-
52
- self.file_name_list = self.archive.namelist()
53
- assert "mimetype" in self.file_name_list, "Missing mimetype file in the dataset export archive."
54
- assert self.archive.read("mimetype") == b"application/x.clarifai-data+protobuf"
55
- self.file_name_list.remove("mimetype")
56
-
57
- logger.info("Obtained file name list. %d entries." % len(self.file_name_list))
58
- self.split_dir = os.path.dirname(self.file_name_list[0]) if len(self.file_name_list) else ""
59
-
60
- def _download_temp_archive(self, archive_url: str,
61
- chunk_size: int = 128) -> tempfile.TemporaryFile:
62
- """Downloads the temp archive of InputBatches."""
63
- r = self.session.get(archive_url, stream=True)
64
- if r.headers['content-type'] == CONTENT_TYPE['json']:
65
- raise Exception("File is a json file :\n {}".format(r.json()))
66
- elif r.headers['content-type'] != CONTENT_TYPE['zip']:
67
- raise Exception('File is not a zip file')
68
- temp_file = tempfile.TemporaryFile()
69
- for chunk in r.iter_content(chunk_size=chunk_size):
70
- temp_file.write(chunk)
71
-
72
- return temp_file
73
-
74
- def __len__(self) -> int:
75
- if self.input_count is None:
76
- input_count = 0
77
- if self.file_name_list is not None:
78
- for filename in self.file_name_list:
79
- input_count += int(filename.split('_n')[-1])
80
- self.input_count = input_count
81
-
82
- return self.input_count
83
-
84
- def __iter__(self) -> Iterator[resources_pb2.Input]:
85
- """Loops through all InputBatches in the DatasetVersionExport and yields every api.Input object"""
86
- if self.file_name_list is not None:
87
- for filename in self.file_name_list:
88
- db = resources_pb2.InputBatch().FromString(self.archive.read(filename))
89
- for db_input in db.inputs:
90
- yield db_input
91
-
92
- def __enter__(self) -> 'DatasetExportReader':
93
- return self
94
-
95
- def __exit__(self, *args: Any) -> None:
96
- self.close()
97
-
98
- def close(self) -> None:
99
- logger.info("closing file objects.")
100
- self.archive.close()
101
- if self.temp_file:
102
- self.temp_file.close()
21
+ def __init__(
22
+ self,
23
+ session: requests.Session = None,
24
+ archive_url: Optional[str] = None,
25
+ local_archive_path: Optional[str] = None,
26
+ ):
27
+ """Download/Reads the zipfile archive and yields every api.Input object.
28
+
29
+ Args:
30
+ session: requests.Session object
31
+ archive_url: URL of the DatasetVersionExport archive
32
+ local_archive_path: Path to the DatasetVersionExport archive
33
+ """
34
+ self.input_count = None
35
+ self.temp_file = None
36
+ self.session = session
37
+ if not self.session:
38
+ self.session = requests.Session()
39
+
40
+ assert archive_url or local_archive_path, UserError(
41
+ "Either archive_url or local_archive_path must be provided."
42
+ )
43
+ assert not (archive_url and local_archive_path), UserError(
44
+ "Only one of archive_url or local_archive_path must be provided."
45
+ )
46
+
47
+ if archive_url:
48
+ logger.info('url: %s' % archive_url)
49
+ self.temp_file = self._download_temp_archive(archive_url)
50
+ self.archive = zipfile.ZipFile(self.temp_file)
51
+ else:
52
+ logger.info("path: %s" % local_archive_path)
53
+ self.archive = zipfile.ZipFile(local_archive_path)
54
+
55
+ self.file_name_list = self.archive.namelist()
56
+ assert "mimetype" in self.file_name_list, (
57
+ "Missing mimetype file in the dataset export archive."
58
+ )
59
+ assert self.archive.read("mimetype") == b"application/x.clarifai-data+protobuf"
60
+ self.file_name_list.remove("mimetype")
61
+
62
+ logger.info("Obtained file name list. %d entries." % len(self.file_name_list))
63
+ self.split_dir = (
64
+ os.path.dirname(self.file_name_list[0]) if len(self.file_name_list) else ""
65
+ )
66
+
67
+ def _download_temp_archive(
68
+ self, archive_url: str, chunk_size: int = 128
69
+ ) -> tempfile.TemporaryFile:
70
+ """Downloads the temp archive of InputBatches."""
71
+ r = self.session.get(archive_url, stream=True)
72
+ if r.headers['content-type'] == CONTENT_TYPE['json']:
73
+ raise Exception("File is a json file :\n {}".format(r.json()))
74
+ elif r.headers['content-type'] != CONTENT_TYPE['zip']:
75
+ raise Exception('File is not a zip file')
76
+ temp_file = tempfile.TemporaryFile()
77
+ for chunk in r.iter_content(chunk_size=chunk_size):
78
+ temp_file.write(chunk)
79
+
80
+ return temp_file
81
+
82
+ def __len__(self) -> int:
83
+ if self.input_count is None:
84
+ input_count = 0
85
+ if self.file_name_list is not None:
86
+ for filename in self.file_name_list:
87
+ input_count += int(filename.split('_n')[-1])
88
+ self.input_count = input_count
89
+
90
+ return self.input_count
91
+
92
+ def __iter__(self) -> Iterator[resources_pb2.Input]:
93
+ """Loops through all InputBatches in the DatasetVersionExport and yields every api.Input object"""
94
+ if self.file_name_list is not None:
95
+ for filename in self.file_name_list:
96
+ db = resources_pb2.InputBatch().FromString(self.archive.read(filename))
97
+ for db_input in db.inputs:
98
+ yield db_input
99
+
100
+ def __enter__(self) -> 'DatasetExportReader':
101
+ return self
102
+
103
+ def __exit__(self, *args: Any) -> None:
104
+ self.close()
105
+
106
+ def close(self) -> None:
107
+ logger.info("closing file objects.")
108
+ self.archive.close()
109
+ if self.temp_file:
110
+ self.temp_file.close()
103
111
 
104
112
 
105
113
  class InputAnnotationDownloader:
106
-
107
- def __init__(self,
108
- session: requests.Session,
109
- input_iterator: DatasetExportReader,
110
- num_workers: int = 4):
111
- """Downloads the archive from the URL into an archive of inputs, annotations in the directory format
112
- {split}/inputs and {split}/annotations.
113
-
114
- Args:
115
- session: requests.Session object
116
- input_iterator: Iterable of DatasetExportReader object
117
- num_workers: Number of threads to use for downloading
118
- """
119
- self.input_iterator = input_iterator
120
- self.num_workers = min(num_workers, 10) # Max 10 threads
121
- self.num_inputs = 0
122
- self.num_annotations = 0
123
- self.split_prefix = None
124
- self.session = session
125
- self.input_ext = dict(image=".png", text=".txt", audio=".mp3", video=".mp4")
126
- if isinstance(self.input_iterator, DatasetExportReader):
127
- self.split_prefix = self.input_iterator.split_dir
128
-
129
- def _save_image_to_archive(self, new_archive: zipfile.ZipFile, hosted_url: str,
130
- file_name: str) -> None:
131
- """Use PIL ImageFile to return image parsed from the response bytestring (from requests) and append to zip file."""
132
- p = ImageFile.Parser()
133
- p.feed(self.session.get(hosted_url).content)
134
- image = p.close()
135
- image_file = BytesIO()
136
- image.save(image_file, 'PNG')
137
- new_archive.writestr(file_name, image_file.getvalue())
138
-
139
- def _save_text_to_archive(self, new_archive: zipfile.ZipFile, hosted_url: str,
140
- file_name: str) -> None:
141
- """Gets the text response bytestring (from requests) and append to zip file."""
142
- text_content = self.session.get(hosted_url).content
143
- new_archive.writestr(file_name, text_content)
144
-
145
- def _save_audio_to_archive(self, new_archive: zipfile.ZipFile, hosted_url: str,
146
- file_name: str) -> None:
147
- """Gets the audio response bytestring (from requests) as chunks and append to zip file."""
148
- audio_response = self.session.get(hosted_url, stream=True)
149
- audio_stream = BytesIO()
150
- # Retrieve the audio content in chunks and write to the BytesIO object
151
- for chunk in audio_response.iter_content(chunk_size=128):
152
- audio_stream.write(chunk)
153
- new_archive.writestr(file_name, audio_stream.getvalue())
154
-
155
- def _save_video_to_archive(self, new_archive: zipfile.ZipFile, hosted_url: str,
156
- file_name: str) -> None:
157
- """Gets the video response bytestring (from requests) as chunks and append to zip file."""
158
- video_response = self.session.get(hosted_url)
159
- video_stream = BytesIO()
160
- # Retrieve the video content in chunks and write to the BytesIO object
161
- for chunk in video_response.iter_content(chunk_size=128):
162
- video_stream.write(chunk)
163
- new_archive.writestr(file_name, video_stream.getvalue())
164
-
165
- def _save_annotation_to_archive(self, new_archive: zipfile.ZipFile, annot_data: List[Dict],
166
- file_name: str) -> None:
167
- """Gets the annotation response bytestring (from requests) and append to zip file."""
168
- # Fill zero values for missing bounding box keys
169
- for annot in annot_data:
170
- if annot.get('regionInfo') and annot['regionInfo'].get('boundingBox'):
171
- bbox = annot['regionInfo']['boundingBox']
172
- bbox.setdefault('topRow', 0)
173
- bbox.setdefault('leftCol', 0)
174
- bbox.setdefault('bottomRow', 0)
175
- bbox.setdefault('rightCol', 0)
176
- # Serialize the dictionary to a JSON string
177
- json_str = json.dumps(annot_data)
178
- # Convert the JSON string to bytes
179
- bytes_object = json_str.encode()
180
-
181
- new_archive.writestr(file_name, bytes_object)
182
-
183
- def _write_archive(self, input_, new_archive, split: Optional[str] = None) -> None:
184
- """Writes the input, annotation archive into prefix dir."""
185
- data_dict = MessageToDict(input_.data)
186
- input_type = list(filter(lambda x: x in list(data_dict.keys()),
187
- list(self.input_ext.keys())))[0]
188
- hosted = getattr(input_.data, input_type).hosted
189
- if hosted.prefix:
190
- assert 'orig' in hosted.sizes
191
- hosted_url = f"{hosted.prefix}/orig/{hosted.suffix}"
192
- file_name = os.path.join(split, "inputs", input_.id + self.input_ext[input_type])
193
- if input_type == "image":
194
- self._save_image_to_archive(new_archive, hosted_url, file_name)
195
- elif input_type == "text":
196
- self._save_text_to_archive(new_archive, hosted_url, file_name)
197
- elif input_type == "audio":
198
- self._save_audio_to_archive(new_archive, hosted_url, file_name)
199
- elif input_type == "video":
200
- self._save_video_to_archive(new_archive, hosted_url, file_name)
201
- self.num_inputs += 1
202
-
203
- if data_dict.get("metadata") or data_dict.get("concepts") or data_dict.get("regions"):
204
- file_name = os.path.join(split, "annotations", input_.id + ".json")
205
- annot_data = [{
206
- "metadata": data_dict.get("metadata", {})
207
- }] + data_dict.get("regions", []) + data_dict.get("concepts", [])
208
-
209
- self._save_annotation_to_archive(new_archive, annot_data, file_name)
210
- self.num_annotations += 1
211
-
212
- def _check_output_archive(self, save_path: str) -> None:
213
- try:
214
- archive = zipfile.ZipFile(save_path, 'r')
215
- except zipfile.BadZipFile as e:
216
- raise e
217
- assert len(
218
- archive.namelist()
219
- ) == self.num_inputs + self.num_annotations, "Archive has %d inputs+annotations | expecting %d inputs+annotations" % (
220
- len(archive.namelist()), self.num_inputs + self.num_annotations)
221
-
222
- def download_archive(self, save_path: str, split: Optional[str] = None) -> None:
223
- """Downloads the archive from the URL into an archive of inputs, annotations in the directory format
224
- {split}/inputs and {split}/annotations.
225
- """
226
- with zipfile.ZipFile(save_path, "a") as new_archive:
227
- with ThreadPoolExecutor(max_workers=self.num_workers) as executor:
228
- with tqdm(total=len(self.input_iterator), desc='Downloading Dataset') as progress:
229
- # Submit all jobs to the executor and store the returned futures
230
- futures = [
231
- executor.submit(self._write_archive, input_, new_archive, split)
232
- for input_ in self.input_iterator
233
- ]
234
-
235
- for _ in as_completed(futures):
236
- progress.update()
237
-
238
- self._check_output_archive(save_path)
239
- logger.info("Downloaded %d inputs and %d annotations to %s" %
240
- (self.num_inputs, self.num_annotations, save_path))
114
+ def __init__(
115
+ self, session: requests.Session, input_iterator: DatasetExportReader, num_workers: int = 4
116
+ ):
117
+ """Downloads the archive from the URL into an archive of inputs, annotations in the directory format
118
+ {split}/inputs and {split}/annotations.
119
+
120
+ Args:
121
+ session: requests.Session object
122
+ input_iterator: Iterable of DatasetExportReader object
123
+ num_workers: Number of threads to use for downloading
124
+ """
125
+ self.input_iterator = input_iterator
126
+ self.num_workers = min(num_workers, 10) # Max 10 threads
127
+ self.num_inputs = 0
128
+ self.num_annotations = 0
129
+ self.split_prefix = None
130
+ self.session = session
131
+ self.input_ext = dict(image=".png", text=".txt", audio=".mp3", video=".mp4")
132
+ if isinstance(self.input_iterator, DatasetExportReader):
133
+ self.split_prefix = self.input_iterator.split_dir
134
+
135
+ def _save_image_to_archive(
136
+ self, new_archive: zipfile.ZipFile, hosted_url: str, file_name: str
137
+ ) -> None:
138
+ """Use PIL ImageFile to return image parsed from the response bytestring (from requests) and append to zip file."""
139
+ p = ImageFile.Parser()
140
+ p.feed(self.session.get(hosted_url).content)
141
+ image = p.close()
142
+ image_file = BytesIO()
143
+ image.save(image_file, 'PNG')
144
+ new_archive.writestr(file_name, image_file.getvalue())
145
+
146
+ def _save_text_to_archive(
147
+ self, new_archive: zipfile.ZipFile, hosted_url: str, file_name: str
148
+ ) -> None:
149
+ """Gets the text response bytestring (from requests) and append to zip file."""
150
+ text_content = self.session.get(hosted_url).content
151
+ new_archive.writestr(file_name, text_content)
152
+
153
+ def _save_audio_to_archive(
154
+ self, new_archive: zipfile.ZipFile, hosted_url: str, file_name: str
155
+ ) -> None:
156
+ """Gets the audio response bytestring (from requests) as chunks and append to zip file."""
157
+ audio_response = self.session.get(hosted_url, stream=True)
158
+ audio_stream = BytesIO()
159
+ # Retrieve the audio content in chunks and write to the BytesIO object
160
+ for chunk in audio_response.iter_content(chunk_size=128):
161
+ audio_stream.write(chunk)
162
+ new_archive.writestr(file_name, audio_stream.getvalue())
163
+
164
+ def _save_video_to_archive(
165
+ self, new_archive: zipfile.ZipFile, hosted_url: str, file_name: str
166
+ ) -> None:
167
+ """Gets the video response bytestring (from requests) as chunks and append to zip file."""
168
+ video_response = self.session.get(hosted_url)
169
+ video_stream = BytesIO()
170
+ # Retrieve the video content in chunks and write to the BytesIO object
171
+ for chunk in video_response.iter_content(chunk_size=128):
172
+ video_stream.write(chunk)
173
+ new_archive.writestr(file_name, video_stream.getvalue())
174
+
175
+ def _save_annotation_to_archive(
176
+ self, new_archive: zipfile.ZipFile, annot_data: List[Dict], file_name: str
177
+ ) -> None:
178
+ """Gets the annotation response bytestring (from requests) and append to zip file."""
179
+ # Fill zero values for missing bounding box keys
180
+ for annot in annot_data:
181
+ if annot.get('regionInfo') and annot['regionInfo'].get('boundingBox'):
182
+ bbox = annot['regionInfo']['boundingBox']
183
+ bbox.setdefault('topRow', 0)
184
+ bbox.setdefault('leftCol', 0)
185
+ bbox.setdefault('bottomRow', 0)
186
+ bbox.setdefault('rightCol', 0)
187
+ # Serialize the dictionary to a JSON string
188
+ json_str = json.dumps(annot_data)
189
+ # Convert the JSON string to bytes
190
+ bytes_object = json_str.encode()
191
+
192
+ new_archive.writestr(file_name, bytes_object)
193
+
194
+ def _write_archive(self, input_, new_archive, split: Optional[str] = None) -> None:
195
+ """Writes the input, annotation archive into prefix dir."""
196
+ data_dict = MessageToDict(input_.data)
197
+ input_type = list(
198
+ filter(lambda x: x in list(data_dict.keys()), list(self.input_ext.keys()))
199
+ )[0]
200
+ hosted = getattr(input_.data, input_type).hosted
201
+ if hosted.prefix:
202
+ assert 'orig' in hosted.sizes
203
+ hosted_url = f"{hosted.prefix}/orig/{hosted.suffix}"
204
+ file_name = os.path.join(split, "inputs", input_.id + self.input_ext[input_type])
205
+ if input_type == "image":
206
+ self._save_image_to_archive(new_archive, hosted_url, file_name)
207
+ elif input_type == "text":
208
+ self._save_text_to_archive(new_archive, hosted_url, file_name)
209
+ elif input_type == "audio":
210
+ self._save_audio_to_archive(new_archive, hosted_url, file_name)
211
+ elif input_type == "video":
212
+ self._save_video_to_archive(new_archive, hosted_url, file_name)
213
+ self.num_inputs += 1
214
+
215
+ if data_dict.get("metadata") or data_dict.get("concepts") or data_dict.get("regions"):
216
+ file_name = os.path.join(split, "annotations", input_.id + ".json")
217
+ annot_data = (
218
+ [{"metadata": data_dict.get("metadata", {})}]
219
+ + data_dict.get("regions", [])
220
+ + data_dict.get("concepts", [])
221
+ )
222
+
223
+ self._save_annotation_to_archive(new_archive, annot_data, file_name)
224
+ self.num_annotations += 1
225
+
226
+ def _check_output_archive(self, save_path: str) -> None:
227
+ try:
228
+ archive = zipfile.ZipFile(save_path, 'r')
229
+ except zipfile.BadZipFile as e:
230
+ raise e
231
+ assert len(archive.namelist()) == self.num_inputs + self.num_annotations, (
232
+ "Archive has %d inputs+annotations | expecting %d inputs+annotations"
233
+ % (len(archive.namelist()), self.num_inputs + self.num_annotations)
234
+ )
235
+
236
+ def download_archive(self, save_path: str, split: Optional[str] = None) -> None:
237
+ """Downloads the archive from the URL into an archive of inputs, annotations in the directory format
238
+ {split}/inputs and {split}/annotations.
239
+ """
240
+ with zipfile.ZipFile(save_path, "a") as new_archive:
241
+ with ThreadPoolExecutor(max_workers=self.num_workers) as executor:
242
+ with tqdm(total=len(self.input_iterator), desc='Downloading Dataset') as progress:
243
+ # Submit all jobs to the executor and store the returned futures
244
+ futures = [
245
+ executor.submit(self._write_archive, input_, new_archive, split)
246
+ for input_ in self.input_iterator
247
+ ]
248
+
249
+ for _ in as_completed(futures):
250
+ progress.update()
251
+
252
+ self._check_output_archive(save_path)
253
+ logger.info(
254
+ "Downloaded %d inputs and %d annotations to %s"
255
+ % (self.num_inputs, self.num_annotations, save_path)
256
+ )
@@ -4,68 +4,80 @@ from typing import Iterator, List, Tuple, TypeVar, Union
4
4
  from clarifai_grpc.grpc.api import resources_pb2
5
5
 
6
6
  from clarifai.constants.dataset import DATASET_UPLOAD_TASKS
7
- from clarifai.datasets.upload.features import (MultiModalFeatures, TextFeatures,
8
- VisualClassificationFeatures,
9
- VisualDetectionFeatures, VisualSegmentationFeatures)
7
+ from clarifai.datasets.upload.features import (
8
+ MultiModalFeatures,
9
+ TextFeatures,
10
+ VisualClassificationFeatures,
11
+ VisualDetectionFeatures,
12
+ VisualSegmentationFeatures,
13
+ )
10
14
 
11
15
  OutputFeaturesType = TypeVar(
12
16
  'OutputFeaturesType',
13
- bound=Union[TextFeatures, VisualClassificationFeatures, VisualDetectionFeatures,
14
- VisualSegmentationFeatures, MultiModalFeatures])
17
+ bound=Union[
18
+ TextFeatures,
19
+ VisualClassificationFeatures,
20
+ VisualDetectionFeatures,
21
+ VisualSegmentationFeatures,
22
+ MultiModalFeatures,
23
+ ],
24
+ )
15
25
 
16
26
 
17
27
  class ClarifaiDataset:
18
- """Clarifai datasets base class."""
19
-
20
- def __init__(self, data_generator: 'ClarifaiDataLoader', dataset_id: str,
21
- max_workers: int = 4) -> None:
22
- self.data_generator = data_generator
23
- self.dataset_id = dataset_id
24
- self.max_workers = max_workers
25
- self.all_input_ids = {}
26
- self._all_input_protos = {}
27
- self._all_annotation_protos = defaultdict(list)
28
-
29
- def __len__(self) -> int:
30
- """Get size of all input protos"""
31
- return len(self.data_generator)
32
-
33
- def _to_list(self, input_protos: Iterator) -> List:
34
- """Parse protos iterator to list."""
35
- return list(input_protos)
36
-
37
- def _extract_protos(self) -> None:
38
- """Create input image protos for each data generator item."""
39
- raise NotImplementedError()
40
-
41
- def get_protos(self, input_ids: List[int]
42
- ) -> Tuple[List[resources_pb2.Input], List[resources_pb2.Annotation]]:
43
- """Get input and annotation protos based on input_ids.
44
- Args:
45
- input_ids: List of input IDs to retrieve the protos for.
46
- Returns:
47
- Input and Annotation proto iterators for the specified input IDs.
48
- """
49
- input_protos, annotation_protos = self._extract_protos(input_ids)
50
-
51
- return input_protos, annotation_protos
28
+ """Clarifai datasets base class."""
29
+
30
+ def __init__(
31
+ self, data_generator: 'ClarifaiDataLoader', dataset_id: str, max_workers: int = 4
32
+ ) -> None:
33
+ self.data_generator = data_generator
34
+ self.dataset_id = dataset_id
35
+ self.max_workers = max_workers
36
+ self.all_input_ids = {}
37
+ self._all_input_protos = {}
38
+ self._all_annotation_protos = defaultdict(list)
39
+
40
+ def __len__(self) -> int:
41
+ """Get size of all input protos"""
42
+ return len(self.data_generator)
43
+
44
+ def _to_list(self, input_protos: Iterator) -> List:
45
+ """Parse protos iterator to list."""
46
+ return list(input_protos)
47
+
48
+ def _extract_protos(self) -> None:
49
+ """Create input image protos for each data generator item."""
50
+ raise NotImplementedError()
51
+
52
+ def get_protos(
53
+ self, input_ids: List[int]
54
+ ) -> Tuple[List[resources_pb2.Input], List[resources_pb2.Annotation]]:
55
+ """Get input and annotation protos based on input_ids.
56
+ Args:
57
+ input_ids: List of input IDs to retrieve the protos for.
58
+ Returns:
59
+ Input and Annotation proto iterators for the specified input IDs.
60
+ """
61
+ input_protos, annotation_protos = self._extract_protos(input_ids)
62
+
63
+ return input_protos, annotation_protos
52
64
 
53
65
 
54
66
  class ClarifaiDataLoader:
55
- """Clarifai data loader base class."""
67
+ """Clarifai data loader base class."""
56
68
 
57
- def __init__(self) -> None:
58
- pass
69
+ def __init__(self) -> None:
70
+ pass
59
71
 
60
- @property
61
- def task(self):
62
- raise NotImplementedError("Task should be one of {}".format(DATASET_UPLOAD_TASKS))
72
+ @property
73
+ def task(self):
74
+ raise NotImplementedError("Task should be one of {}".format(DATASET_UPLOAD_TASKS))
63
75
 
64
- def load_data(self) -> None:
65
- raise NotImplementedError()
76
+ def load_data(self) -> None:
77
+ raise NotImplementedError()
66
78
 
67
- def __len__(self) -> int:
68
- raise NotImplementedError()
79
+ def __len__(self) -> int:
80
+ raise NotImplementedError()
69
81
 
70
- def __getitem__(self, index: int) -> OutputFeaturesType:
71
- raise NotImplementedError()
82
+ def __getitem__(self, index: int) -> OutputFeaturesType:
83
+ raise NotImplementedError()