clarifai 11.1.5rc7__py3-none-any.whl → 11.1.6__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 (122) hide show
  1. clarifai/__init__.py +1 -1
  2. clarifai/cli/model.py +40 -50
  3. clarifai/client/model.py +365 -95
  4. clarifai/runners/__init__.py +7 -2
  5. clarifai/runners/dockerfile_template/Dockerfile.template +1 -4
  6. clarifai/runners/models/base_typed_model.py +238 -0
  7. clarifai/runners/models/model_builder.py +9 -26
  8. clarifai/runners/models/model_class.py +28 -273
  9. clarifai/runners/models/model_run_locally.py +78 -3
  10. clarifai/runners/models/model_runner.py +0 -2
  11. clarifai/runners/models/model_servicer.py +2 -11
  12. clarifai/runners/utils/data_handler.py +205 -308
  13. {clarifai-11.1.5rc7.dist-info → clarifai-11.1.6.dist-info}/METADATA +26 -16
  14. clarifai-11.1.6.dist-info/RECORD +101 -0
  15. {clarifai-11.1.5rc7.dist-info → clarifai-11.1.6.dist-info}/WHEEL +1 -1
  16. clarifai/__pycache__/__init__.cpython-310.pyc +0 -0
  17. clarifai/__pycache__/errors.cpython-310.pyc +0 -0
  18. clarifai/__pycache__/versions.cpython-310.pyc +0 -0
  19. clarifai/cli/__main__.py~ +0 -4
  20. clarifai/cli/__pycache__/__init__.cpython-310.pyc +0 -0
  21. clarifai/cli/__pycache__/__main__.cpython-310.pyc +0 -0
  22. clarifai/cli/__pycache__/base.cpython-310.pyc +0 -0
  23. clarifai/cli/__pycache__/compute_cluster.cpython-310.pyc +0 -0
  24. clarifai/cli/__pycache__/deployment.cpython-310.pyc +0 -0
  25. clarifai/cli/__pycache__/model.cpython-310.pyc +0 -0
  26. clarifai/cli/__pycache__/nodepool.cpython-310.pyc +0 -0
  27. clarifai/client/__pycache__/__init__.cpython-310.pyc +0 -0
  28. clarifai/client/__pycache__/app.cpython-310.pyc +0 -0
  29. clarifai/client/__pycache__/base.cpython-310.pyc +0 -0
  30. clarifai/client/__pycache__/dataset.cpython-310.pyc +0 -0
  31. clarifai/client/__pycache__/input.cpython-310.pyc +0 -0
  32. clarifai/client/__pycache__/lister.cpython-310.pyc +0 -0
  33. clarifai/client/__pycache__/model.cpython-310.pyc +0 -0
  34. clarifai/client/__pycache__/module.cpython-310.pyc +0 -0
  35. clarifai/client/__pycache__/runner.cpython-310.pyc +0 -0
  36. clarifai/client/__pycache__/search.cpython-310.pyc +0 -0
  37. clarifai/client/__pycache__/user.cpython-310.pyc +0 -0
  38. clarifai/client/__pycache__/workflow.cpython-310.pyc +0 -0
  39. clarifai/client/auth/__pycache__/__init__.cpython-310.pyc +0 -0
  40. clarifai/client/auth/__pycache__/helper.cpython-310.pyc +0 -0
  41. clarifai/client/auth/__pycache__/register.cpython-310.pyc +0 -0
  42. clarifai/client/auth/__pycache__/stub.cpython-310.pyc +0 -0
  43. clarifai/client/model_client.py +0 -432
  44. clarifai/constants/__pycache__/dataset.cpython-310.pyc +0 -0
  45. clarifai/constants/__pycache__/model.cpython-310.pyc +0 -0
  46. clarifai/constants/__pycache__/search.cpython-310.pyc +0 -0
  47. clarifai/datasets/__pycache__/__init__.cpython-310.pyc +0 -0
  48. clarifai/datasets/export/__pycache__/__init__.cpython-310.pyc +0 -0
  49. clarifai/datasets/export/__pycache__/inputs_annotations.cpython-310.pyc +0 -0
  50. clarifai/datasets/upload/__pycache__/__init__.cpython-310.pyc +0 -0
  51. clarifai/datasets/upload/__pycache__/base.cpython-310.pyc +0 -0
  52. clarifai/datasets/upload/__pycache__/features.cpython-310.pyc +0 -0
  53. clarifai/datasets/upload/__pycache__/image.cpython-310.pyc +0 -0
  54. clarifai/datasets/upload/__pycache__/text.cpython-310.pyc +0 -0
  55. clarifai/datasets/upload/__pycache__/utils.cpython-310.pyc +0 -0
  56. clarifai/datasets/upload/loaders/__pycache__/__init__.cpython-310.pyc +0 -0
  57. clarifai/datasets/upload/loaders/__pycache__/coco_detection.cpython-310.pyc +0 -0
  58. clarifai/models/__pycache__/__init__.cpython-310.pyc +0 -0
  59. clarifai/models/model_serving/__pycache__/__init__.cpython-310.pyc +0 -0
  60. clarifai/models/model_serving/__pycache__/constants.cpython-310.pyc +0 -0
  61. clarifai/models/model_serving/cli/__pycache__/__init__.cpython-310.pyc +0 -0
  62. clarifai/models/model_serving/cli/__pycache__/_utils.cpython-310.pyc +0 -0
  63. clarifai/models/model_serving/cli/__pycache__/base.cpython-310.pyc +0 -0
  64. clarifai/models/model_serving/cli/__pycache__/build.cpython-310.pyc +0 -0
  65. clarifai/models/model_serving/cli/__pycache__/create.cpython-310.pyc +0 -0
  66. clarifai/models/model_serving/model_config/__pycache__/__init__.cpython-310.pyc +0 -0
  67. clarifai/models/model_serving/model_config/__pycache__/base.cpython-310.pyc +0 -0
  68. clarifai/models/model_serving/model_config/__pycache__/config.cpython-310.pyc +0 -0
  69. clarifai/models/model_serving/model_config/__pycache__/inference_parameter.cpython-310.pyc +0 -0
  70. clarifai/models/model_serving/model_config/__pycache__/output.cpython-310.pyc +0 -0
  71. clarifai/models/model_serving/model_config/triton/__pycache__/__init__.cpython-310.pyc +0 -0
  72. clarifai/models/model_serving/model_config/triton/__pycache__/serializer.cpython-310.pyc +0 -0
  73. clarifai/models/model_serving/model_config/triton/__pycache__/triton_config.cpython-310.pyc +0 -0
  74. clarifai/models/model_serving/model_config/triton/__pycache__/wrappers.cpython-310.pyc +0 -0
  75. clarifai/models/model_serving/repo_build/__pycache__/__init__.cpython-310.pyc +0 -0
  76. clarifai/models/model_serving/repo_build/__pycache__/build.cpython-310.pyc +0 -0
  77. clarifai/models/model_serving/repo_build/static_files/__pycache__/base_test.cpython-310-pytest-7.2.0.pyc +0 -0
  78. clarifai/rag/__pycache__/__init__.cpython-310.pyc +0 -0
  79. clarifai/rag/__pycache__/rag.cpython-310.pyc +0 -0
  80. clarifai/rag/__pycache__/utils.cpython-310.pyc +0 -0
  81. clarifai/runners/__pycache__/__init__.cpython-310.pyc +0 -0
  82. clarifai/runners/__pycache__/server.cpython-310.pyc +0 -0
  83. clarifai/runners/dockerfile_template/Dockerfile.debug +0 -11
  84. clarifai/runners/dockerfile_template/Dockerfile.debug~ +0 -9
  85. clarifai/runners/models/__pycache__/__init__.cpython-310.pyc +0 -0
  86. clarifai/runners/models/__pycache__/base_typed_model.cpython-310.pyc +0 -0
  87. clarifai/runners/models/__pycache__/model_builder.cpython-310.pyc +0 -0
  88. clarifai/runners/models/__pycache__/model_class.cpython-310.pyc +0 -0
  89. clarifai/runners/models/__pycache__/model_run_locally.cpython-310.pyc +0 -0
  90. clarifai/runners/models/__pycache__/model_runner.cpython-310.pyc +0 -0
  91. clarifai/runners/models/__pycache__/model_servicer.cpython-310.pyc +0 -0
  92. clarifai/runners/models/__pycache__/model_upload.cpython-310.pyc +0 -0
  93. clarifai/runners/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  94. clarifai/runners/utils/__pycache__/const.cpython-310.pyc +0 -0
  95. clarifai/runners/utils/__pycache__/data_handler.cpython-310.pyc +0 -0
  96. clarifai/runners/utils/__pycache__/data_types.cpython-310.pyc +0 -0
  97. clarifai/runners/utils/__pycache__/data_utils.cpython-310.pyc +0 -0
  98. clarifai/runners/utils/__pycache__/loader.cpython-310.pyc +0 -0
  99. clarifai/runners/utils/__pycache__/logging.cpython-310.pyc +0 -0
  100. clarifai/runners/utils/__pycache__/method_signatures.cpython-310.pyc +0 -0
  101. clarifai/runners/utils/__pycache__/serializers.cpython-310.pyc +0 -0
  102. clarifai/runners/utils/__pycache__/url_fetcher.cpython-310.pyc +0 -0
  103. clarifai/runners/utils/data_types.py +0 -334
  104. clarifai/runners/utils/method_signatures.py +0 -452
  105. clarifai/runners/utils/serializers.py +0 -132
  106. clarifai/schema/__pycache__/search.cpython-310.pyc +0 -0
  107. clarifai/urls/__pycache__/helper.cpython-310.pyc +0 -0
  108. clarifai/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  109. clarifai/utils/__pycache__/logging.cpython-310.pyc +0 -0
  110. clarifai/utils/__pycache__/misc.cpython-310.pyc +0 -0
  111. clarifai/utils/__pycache__/model_train.cpython-310.pyc +0 -0
  112. clarifai/utils/evaluation/__pycache__/__init__.cpython-310.pyc +0 -0
  113. clarifai/utils/evaluation/__pycache__/helpers.cpython-310.pyc +0 -0
  114. clarifai/utils/evaluation/__pycache__/main.cpython-310.pyc +0 -0
  115. clarifai/workflows/__pycache__/__init__.cpython-310.pyc +0 -0
  116. clarifai/workflows/__pycache__/export.cpython-310.pyc +0 -0
  117. clarifai/workflows/__pycache__/utils.cpython-310.pyc +0 -0
  118. clarifai/workflows/__pycache__/validate.cpython-310.pyc +0 -0
  119. clarifai-11.1.5rc7.dist-info/RECORD +0 -203
  120. {clarifai-11.1.5rc7.dist-info → clarifai-11.1.6.dist-info}/LICENSE +0 -0
  121. {clarifai-11.1.5rc7.dist-info → clarifai-11.1.6.dist-info}/entry_points.txt +0 -0
  122. {clarifai-11.1.5rc7.dist-info → clarifai-11.1.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,101 @@
1
+ clarifai/__init__.py,sha256=ldRQaqTsdqcJQt47pUKJthC_un4FYM-2IH6Yt9-cyVs,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=eaUsp7S1e2dslC437Hjk7gUBQsng13ID3N3lkYotB2U,3403
9
+ clarifai/cli/compute_cluster.py,sha256=N2dNQNJEPg9nxsb8x2igEzYuGRzjn7l4kNttjFIxmhI,1827
10
+ clarifai/cli/deployment.py,sha256=sUEuz5-rtozMx8deVcJXLi6lHsP2jc8x3y2MpUAVfqY,2506
11
+ clarifai/cli/model.py,sha256=9tSR_IiyZcSdTwrXOfv36MqaQ_61wLltpwsggh3yE4w,11677
12
+ clarifai/cli/nodepool.py,sha256=yihxS_rIFoBBKzRlqBX8Ab42iPpBMJrJFsk8saph6ms,3049
13
+ clarifai/client/__init__.py,sha256=xI1U0l5AZdRThvQAXCLsd9axxyFzXXJ22m8LHqVjQRU,662
14
+ clarifai/client/app.py,sha256=6pckYme1urV2YJjLIYfeZ-vH0Z5YSQa51jzIMcEfwug,38342
15
+ clarifai/client/base.py,sha256=hSHOqkXbSKyaRDeylMMnkhUHCAHhEqno4KI0CXGziBA,7536
16
+ clarifai/client/compute_cluster.py,sha256=EvW9TJjPvInUlggfg1A98sxoWH8_PY5rCVXZhsj6ac0,8705
17
+ clarifai/client/dataset.py,sha256=y3zKT_VhP1gyN3OO-b3cPeW21ZXyKbQ7ZJkEG06bsTU,32096
18
+ clarifai/client/deployment.py,sha256=w7Y6pA1rYG4KRK1SwusRZc2sQRXlG8wezuVdzSWpCo0,2586
19
+ clarifai/client/input.py,sha256=obMAHMDU1OwfXZ8KraOnGFlWzlW-3F7Ob_2lcOQMlhY,46339
20
+ clarifai/client/lister.py,sha256=03KGMvs5RVyYqxLsSrWhNc34I8kiF1Ph0NeyEwu7nMU,2082
21
+ clarifai/client/model.py,sha256=vb8ETvr_FTgMeQ68Wp5D1dogx6lOEM5cWirkRAV46Wo,88675
22
+ clarifai/client/module.py,sha256=FTkm8s9m-EaTKN7g9MnLhGJ9eETUfKG7aWZ3o1RshYs,4204
23
+ clarifai/client/nodepool.py,sha256=la3vTFrO4LX8zm2eQ5jqf2L0-kQ63Dano8FibadoZbk,10152
24
+ clarifai/client/search.py,sha256=GaPWN6JmTQGZaCHr6U1yv0zqR6wKFl7i9IVLg2ul1CI,14254
25
+ clarifai/client/user.py,sha256=WOv66ww2wx9isIge3V-xTHCkqC6akl2jEGAxzT_Ugfs,17642
26
+ clarifai/client/workflow.py,sha256=5VjZ2D8cudLznR8yhrwNawOmjxUhkJllZMKM6pn-4gs,12170
27
+ clarifai/client/auth/__init__.py,sha256=7EwR0NrozkAUwpUnCsqXvE_p0wqx_SelXlSpKShKJK0,136
28
+ clarifai/client/auth/helper.py,sha256=Ngw5IDkOWvnOz5YwViVk55z3mC52MyezLc0G3WxLqok,14643
29
+ clarifai/client/auth/register.py,sha256=2CMdBsoVLoTfjyksE6j7BM2tiEc73WKYvxnwDDgNn1k,536
30
+ clarifai/client/auth/stub.py,sha256=xy4-fV0W8keCgXld4eOVzFQEIKxOktNwtL5bLztReug,4940
31
+ clarifai/constants/base.py,sha256=ogmFSZYoF0YhGjHg5aiOc3MLqPr_poKAls6xaD0_C3U,89
32
+ clarifai/constants/dataset.py,sha256=vjK3IlgXu31HycuvjRSzEQSqhU6xfj5TIgo6IpyUWoc,609
33
+ clarifai/constants/input.py,sha256=WcHwToUVIK9ItAhDefaSohQHCLNeR55PSjZ0BFnoZ3U,28
34
+ clarifai/constants/model.py,sha256=Um1hLfMFlh5R_vtP3Z6P-o6zon-tdbLcKVIl4PucrV4,438
35
+ clarifai/constants/rag.py,sha256=WcHwToUVIK9ItAhDefaSohQHCLNeR55PSjZ0BFnoZ3U,28
36
+ clarifai/constants/search.py,sha256=yYEqTaFg-KdnpJE_Ytp-EPVHIIC395iNtZrpVlLIf4o,101
37
+ clarifai/constants/workflow.py,sha256=cECq1xdvf44MCdtK2AbkiuuwhyL-6OWZdQfYbsLKy_o,33
38
+ clarifai/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ clarifai/datasets/export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
+ clarifai/datasets/export/inputs_annotations.py,sha256=3AtUBrMIjw8H3ehDsJFYcBFoAZ1QKQo1hXTMsHh8f20,10159
41
+ clarifai/datasets/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
+ clarifai/datasets/upload/base.py,sha256=UIc0ufyIBCrb83_sFpv21L8FshsX4nwsLYQkdlJfzD4,2357
43
+ clarifai/datasets/upload/features.py,sha256=GK69WvUYnks5G26Z5L5XSisBIZILLv7lYhS2y8BJCt0,2031
44
+ clarifai/datasets/upload/image.py,sha256=HlCsfEMu_C4GVecGSv52RUJ6laLW8H64Pfj_FQyX6qg,8580
45
+ clarifai/datasets/upload/multimodal.py,sha256=_NpNQak9KMn0NOiOr48MYnXL0GQZ1LXKhwdYF1HhrHs,2377
46
+ clarifai/datasets/upload/text.py,sha256=dpRMNz49EyKau0kwksEaNV6TLBUf5lSr7t5g3pG2byM,2298
47
+ clarifai/datasets/upload/utils.py,sha256=BerWhq40ZUN30z6VImlc93eZtT-1vI18AMgSOuNzJEM,9647
48
+ clarifai/datasets/upload/loaders/README.md,sha256=aNRutSCTzLp2ruIZx74ZkN5AxpzwKOxMa7OzabnKpwg,2980
49
+ clarifai/datasets/upload/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
+ clarifai/datasets/upload/loaders/coco_captions.py,sha256=YfuNXplbdoH8N9ph7RyN9MfJTtOcJBG4ie1ow6-mELA,1516
51
+ clarifai/datasets/upload/loaders/coco_detection.py,sha256=_I_yThw435KS9SH7zheBbJDK3zFgjTImBsES__ijjMk,2831
52
+ clarifai/datasets/upload/loaders/imagenet_classification.py,sha256=i7W5F6FTB3LwLmhPgjZHmbCbS3l4LmjsuBFKtjxl1pU,1962
53
+ clarifai/datasets/upload/loaders/xview_detection.py,sha256=hk8cZdYZimm4KOaZvBjYcC6ikURZMn51xmn7pXZT3HE,6052
54
+ clarifai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ clarifai/models/api.py,sha256=d3FQQlG0mNDLrfEvchqaVcq4Tgb_TqryNnJtwp3c7sE,10961
56
+ clarifai/modules/README.md,sha256=mx8pVx6cPp-pP4LcFPT_nX3ngGmhygVK0WiXeD3cbIo,367
57
+ clarifai/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
+ clarifai/modules/css.py,sha256=kadCEunmyh5h2yf0-4aysE3ZcZ6qaQcxuAgDXS96yF8,2020
59
+ clarifai/modules/pages.py,sha256=iOoM3RNRMgXlV0qBqcdQofxoXo2RuRQh0h9c9BIS0-I,1383
60
+ clarifai/modules/style.css,sha256=j7FNPZVhLPj35vvBksAJ90RuX5sLuqzDR5iM2WIEhiA,6073
61
+ clarifai/rag/__init__.py,sha256=wu3PzAzo7uqgrEzuaC9lY_3gj1HFiR3GU3elZIKTT5g,40
62
+ clarifai/rag/rag.py,sha256=bqUWnfdf91OYMucEK0_rJXDwg0oKjz5c7eda-9CPXu8,12680
63
+ clarifai/rag/utils.py,sha256=yr1jAcbpws4vFGBqlAwPPE7v1DRba48g8gixLFw8OhQ,4070
64
+ clarifai/runners/__init__.py,sha256=FcTqyCvPn9lJFDsi2eGZ-YL8LgPhJmRAS8K5Wobk03s,411
65
+ clarifai/runners/server.py,sha256=xHDLdhQApCgYG19QOKXqJNCGNyw1Vsvobq3UdryDrVc,4132
66
+ clarifai/runners/dockerfile_template/Dockerfile.template,sha256=5cjv7U8PmWa3DB_5B1CqSYh_6GE0E0np52TIAa7EIDE,2312
67
+ clarifai/runners/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
+ clarifai/runners/models/base_typed_model.py,sha256=0QCWxch8CcyJSKvE1D4PILd2RSnQZHTmx4DXlQQ6dpo,7856
69
+ clarifai/runners/models/model_builder.py,sha256=CSGUbznix7xn4CMuRAH4BLfX9O91xAJ4GXFw3EzXgbY,32518
70
+ clarifai/runners/models/model_class.py,sha256=9JSPAr4U4K7xI0kSl-q0mHB06zknm2OR-8XIgBCto94,1611
71
+ clarifai/runners/models/model_run_locally.py,sha256=V770O-7yQQQlh80u48NZTEHkX3gj1HyclHbu1tjvaQ8,20864
72
+ clarifai/runners/models/model_runner.py,sha256=PyxwK-33hLlhkD07tTXkjWZ_iNlZHl9_8AZ2W7WfExI,6097
73
+ clarifai/runners/models/model_servicer.py,sha256=jtQmtGeQlvQ5ttMvVw7CMnNzq-rLkTaxR2IWF9SnHwk,2808
74
+ clarifai/runners/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
+ clarifai/runners/utils/const.py,sha256=bwj-Pcw558-pasdIFbNhnkn-9oiCdojYH1fNTTUG2gU,1048
76
+ clarifai/runners/utils/data_handler.py,sha256=sxy9zlAgI6ETuxCQhUgEXAn2GCsaW1GxpK6GTaMne0g,6966
77
+ clarifai/runners/utils/data_utils.py,sha256=R1iQ82TuQ9JwxCJk8yEB1Lyb0BYVhVbWJI9YDi1zGOs,318
78
+ clarifai/runners/utils/loader.py,sha256=SgNHMwRmCCymFQm8aDp73NmIUHhM-N60CBlTKbPzmVc,7470
79
+ clarifai/runners/utils/url_fetcher.py,sha256=v_8JOWmkyFAzsBulsieKX7Nfjy1Yg7wGSZeqfEvw2cg,1640
80
+ clarifai/schema/search.py,sha256=JjTi8ammJgZZ2OGl4K6tIA4zEJ1Fr2ASZARXavI1j5c,2448
81
+ clarifai/urls/helper.py,sha256=tjoMGGHuWX68DUB0pk4MEjrmFsClUAQj2jmVEM_Sy78,4751
82
+ clarifai/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
+ clarifai/utils/cli.py,sha256=CdcLsF00KdfA-BgMIbO-u88gUF9Ts1n0TDDZS-oImp8,1949
84
+ clarifai/utils/constants.py,sha256=MG_iHnSwNEyUZOpvsrTicNwaT4CIjmlK_Ixk_qqEX8g,142
85
+ clarifai/utils/logging.py,sha256=CVy8OsLrlbg-b8qe88kb1yO_9wi9wRYfF-QkIaN9xE8,11936
86
+ clarifai/utils/misc.py,sha256=4aNOHPTNdX-WGxuNab8qKePoCMUnscd-aN_dQEIVSWk,2933
87
+ clarifai/utils/model_train.py,sha256=Mndqy5GNu7kjQHjDyNVyamL0hQFLGSHcWhOuPyOvr1w,8005
88
+ clarifai/utils/evaluation/__init__.py,sha256=PYkurUrXrGevByj7RFb6CoU1iC7fllyQSfnnlo9WnY8,69
89
+ clarifai/utils/evaluation/helpers.py,sha256=aZeHLI7oSmU5YDWQp5GdkYW5qbHx37nV9xwunKTAwWM,18549
90
+ clarifai/utils/evaluation/main.py,sha256=sQAuMk0lPclXCYvy_rS7rYteo2xh9Ju13VNvbyGt_VM,15779
91
+ clarifai/utils/evaluation/testset_annotation_parser.py,sha256=iZfLw6oR1qgJ3MHMbOZXcGBLu7btSDn0VqdiAzpIm4g,5002
92
+ clarifai/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
+ clarifai/workflows/export.py,sha256=vICRhIreqDSShxLKjHNM2JwzKsf1B4fdXB0ciMcA70k,1945
94
+ clarifai/workflows/utils.py,sha256=nGeB_yjVgUO9kOeKTg4OBBaBz-AwXI3m-huSVj-9W18,1924
95
+ clarifai/workflows/validate.py,sha256=yJq03MaJqi5AK3alKGJJBR89xmmjAQ31sVufJUiOqY8,2556
96
+ clarifai-11.1.6.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
97
+ clarifai-11.1.6.dist-info/METADATA,sha256=Uq4Isp9jEUM8KhEXM2i6hcEOmnTBRkveVG7FLVQ8x6o,22419
98
+ clarifai-11.1.6.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
99
+ clarifai-11.1.6.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
100
+ clarifai-11.1.6.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
101
+ clarifai-11.1.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
Binary file
clarifai/cli/__main__.py~ DELETED
@@ -1,4 +0,0 @@
1
- from my_cli_tool.cli import main
2
-
3
- if __name__ == "__main__":
4
- main()
@@ -1,432 +0,0 @@
1
- import inspect
2
- import time
3
- from typing import Any, Dict, Iterator, List
4
-
5
- from clarifai_grpc.grpc.api import resources_pb2, service_pb2
6
- from clarifai_grpc.grpc.api.status import status_code_pb2
7
-
8
- from clarifai.constants.model import MAX_MODEL_PREDICT_INPUTS
9
- from clarifai.errors import UserError
10
- from clarifai.runners.utils.method_signatures import (deserialize, get_stream_from_signature,
11
- serialize, signatures_from_json,
12
- unflatten_nested_keys)
13
- from clarifai.utils.misc import BackoffIterator, status_is_retryable
14
-
15
-
16
- class ModelClient:
17
- '''
18
- Client for calling model predict, generate, and stream methods.
19
- '''
20
-
21
- def __init__(self, stub, request_template: service_pb2.PostModelOutputsRequest = None):
22
- '''
23
- Initialize the model client.
24
-
25
- Args:
26
- stub: The gRPC stub for the model.
27
- request_template: The template for the request to send to the model, including
28
- common fields like model_id, model_version, cluster, etc.
29
- '''
30
- self.STUB = stub
31
- self.request_template = request_template or service_pb2.PostModelOutputsRequest()
32
- self._fetch_signatures()
33
- self._define_functions()
34
-
35
- def _fetch_signatures(self):
36
- '''
37
- Fetch the method signatures from the model.
38
-
39
- Returns:
40
- Dict: The method signatures.
41
- '''
42
- #request = resources_pb2.GetModelSignaturesRequest()
43
- #response = self.stub.GetModelSignatures(request)
44
- #self._method_signatures = json.loads(response.signatures) # or define protos
45
- # TODO this could use a new endpoint to get the signatures
46
- # for local grpc models, we'll also have to add the endpoint to the model servicer
47
- # for now we'll just use the predict endpoint with a special method name
48
-
49
- request = service_pb2.PostModelOutputsRequest()
50
- request.CopyFrom(self.request_template)
51
- # request.model.model_version.output_info.params['_method_name'] = '_GET_SIGNATURES'
52
- inp = request.inputs.add() # empty input for this method
53
- inp.data.parts.add() # empty part for this input
54
- inp.data.metadata['_method_name'] = '_GET_SIGNATURES'
55
- start_time = time.time()
56
- backoff_iterator = BackoffIterator(10)
57
- while True:
58
- response = self.STUB.PostModelOutputs(request)
59
- if status_is_retryable(
60
- response.status.code) and time.time() - start_time < 60 * 10: # 10 minutes
61
- self.logger.info(f"Retrying model info fetch with response {response.status!r}")
62
- time.sleep(next(backoff_iterator))
63
- continue
64
- break
65
- if response.status.code == status_code_pb2.INPUT_UNSUPPORTED_FORMAT:
66
- # return code from older models that don't support _GET_SIGNATURES
67
- self._method_signatures = {}
68
- return
69
- if response.status.code != status_code_pb2.SUCCESS:
70
- raise Exception(f"Model failed with response {response!r}")
71
- self._method_signatures = signatures_from_json(response.outputs[0].data.text.raw)
72
- import pdb
73
- pdb.set_trace()
74
-
75
- def _define_functions(self):
76
- '''
77
- Define the functions based on the method signatures.
78
- '''
79
- for method_name, method_signature in self._method_signatures.items():
80
- # define the function in this client instance
81
- if method_signature.method_type == 'predict':
82
- call_func = self._predict
83
- elif method_signature.method_type == 'generate':
84
- call_func = self._generate
85
- elif method_signature.method_type == 'stream':
86
- call_func = self._stream
87
- else:
88
- raise ValueError(f"Unknown method type {method_signature.method_type}")
89
-
90
- # method argnames, in order, collapsing nested keys to corresponding user function args
91
- method_argnames = []
92
- for var in method_signature.inputs:
93
- outer = var.name.split('.', 1)[0]
94
- if outer in method_argnames:
95
- continue
96
- method_argnames.append(outer)
97
-
98
- def bind_f(method_name, method_argnames, call_func):
99
-
100
- def f(*args, **kwargs):
101
- if len(args) > len(method_argnames):
102
- raise TypeError(
103
- f"{method_name}() takes {len(method_argnames)} positional arguments but {len(args)} were given"
104
- )
105
- for name, arg in zip(method_argnames, args): # handle positional with zip shortest
106
- if name in kwargs:
107
- raise TypeError(f"Multiple values for argument {name}")
108
- kwargs[name] = arg
109
- return call_func(kwargs, method_name)
110
-
111
- return f
112
-
113
- # need to bind method_name to the value, not the mutating loop variable
114
- f = bind_f(method_name, method_argnames, call_func)
115
-
116
- # set names, annotations and docstrings
117
- f.__name__ = method_name
118
- f.__qualname__ = f'{self.__class__.__name__}.{method_name}'
119
- input_annos = {var.name: var.data_type for var in method_signature.inputs}
120
- output_annos = {var.name: var.data_type for var in method_signature.outputs}
121
- # unflatten nested keys to match the user function args for docs
122
- input_annos = unflatten_nested_keys(input_annos, method_signature.inputs, is_output=False)
123
- output_annos = unflatten_nested_keys(output_annos, method_signature.outputs, is_output=True)
124
-
125
- # add Stream[] to the stream input annotations for docs
126
- input_stream_argname, _ = get_stream_from_signature(method_signature.inputs)
127
- if input_stream_argname:
128
- input_annos[input_stream_argname] = 'Stream[' + str(
129
- input_annos[input_stream_argname]) + ']'
130
-
131
- # handle multiple outputs in the return annotation
132
- return_annotation = output_annos
133
- name = next(iter(output_annos.keys()))
134
- if len(output_annos) == 1 and name == 'return':
135
- # single output
136
- return_annotation = output_annos[name]
137
- elif name.startswith('return.') and name.split('.', 1)[1].isnumeric():
138
- # tuple output
139
- return_annotation = '(' + ", ".join(output_annos[f'return.{i}']
140
- for i in range(len(output_annos))) + ')'
141
- else:
142
- # named output
143
- return_annotation = f'Output({", ".join(f"{k}={t}" for k, t in output_annos.items())})'
144
- if method_signature.method_type in ['generate', 'stream']:
145
- return_annotation = f'Stream[{return_annotation}]'
146
-
147
- # set annotations and docstrings
148
- sig = inspect.signature(f).replace(
149
- parameters=[
150
- inspect.Parameter(k, inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=v)
151
- for k, v in input_annos.items()
152
- ],
153
- return_annotation=return_annotation,
154
- )
155
- f.__signature__ = sig
156
- f.__doc__ = method_signature.docstring
157
- setattr(self, method_name, f)
158
-
159
- def _predict(
160
- self,
161
- inputs, # TODO set up functions according to fetched signatures?
162
- method_name: str = 'predict',
163
- ) -> Any:
164
- input_signature = self._method_signatures[method_name].inputs
165
- output_signature = self._method_signatures[method_name].outputs
166
-
167
- batch_input = True
168
- if isinstance(inputs, dict):
169
- inputs = [inputs]
170
- batch_input = False
171
-
172
- proto_inputs = []
173
- for input in inputs:
174
- proto = resources_pb2.Input()
175
- serialize(input, input_signature, proto.data)
176
- proto_inputs.append(proto)
177
-
178
- response = self._predict_by_proto(proto_inputs, method_name)
179
- #print(response)
180
-
181
- outputs = []
182
- for output in response.outputs:
183
- outputs.append(deserialize(output.data, output_signature, is_output=True))
184
- if batch_input:
185
- return outputs
186
- return outputs[0]
187
-
188
- def _predict_by_proto(
189
- self,
190
- inputs: List[resources_pb2.Input],
191
- method_name: str = None,
192
- inference_params: Dict = None,
193
- output_config: Dict = None,
194
- ) -> service_pb2.MultiOutputResponse:
195
- """Predicts the model based on the given inputs.
196
-
197
- Args:
198
- inputs (List[resources_pb2.Input]): The inputs to predict.
199
- method_name (str): The remote method name to call.
200
- inference_params (Dict): Inference parameters to override.
201
- output_config (Dict): Output configuration to override.
202
-
203
- Returns:
204
- service_pb2.MultiOutputResponse: The prediction response(s).
205
- """
206
- if not isinstance(inputs, list):
207
- raise UserError('Invalid inputs, inputs must be a list of Input objects.')
208
- if len(inputs) > MAX_MODEL_PREDICT_INPUTS:
209
- raise UserError(f"Too many inputs. Max is {MAX_MODEL_PREDICT_INPUTS}.")
210
-
211
- request = service_pb2.PostModelOutputsRequest()
212
- request.CopyFrom(self.request_template)
213
-
214
- request.inputs.extend(inputs)
215
-
216
- if method_name:
217
- for inp in inputs:
218
- inp.data.metadata['_method_name'] = method_name
219
- # TODO put in new proto field?
220
- # request.model.model_version.output_info.params['_method_name'] = method_name
221
- if inference_params:
222
- request.model.model_version.output_info.params.update(inference_params)
223
- if output_config:
224
- request.model.model_version.output_info.output_config.MergeFrom(
225
- resources_pb2.OutputConfig(**output_config))
226
-
227
- start_time = time.time()
228
- backoff_iterator = BackoffIterator(10)
229
- while True:
230
- response = self.STUB.PostModelOutputs(request)
231
- if status_is_retryable(
232
- response.status.code) and time.time() - start_time < 60 * 10: # 10 minutes
233
- self.logger.info(f"Model predict failed with response {response!r}")
234
- time.sleep(next(backoff_iterator))
235
- continue
236
-
237
- if response.status.code != status_code_pb2.SUCCESS:
238
- raise Exception(f"Model predict failed with response {response!r}")
239
- break
240
-
241
- return response
242
-
243
- def _generate(
244
- self,
245
- inputs, # TODO set up functions according to fetched signatures?
246
- method_name: str = 'generate',
247
- ) -> Any:
248
- input_signature = self._method_signatures[method_name].inputs
249
- output_signature = self._method_signatures[method_name].outputs
250
-
251
- batch_input = True
252
- if isinstance(inputs, dict):
253
- inputs = [inputs]
254
- batch_input = False
255
-
256
- proto_inputs = []
257
- for input in inputs:
258
- proto = resources_pb2.Input()
259
- serialize(input, input_signature, proto.data)
260
- proto_inputs.append(proto)
261
-
262
- response_stream = self._generate_by_proto(proto_inputs, method_name)
263
- #print(response)
264
-
265
- for response in response_stream:
266
- outputs = []
267
- for output in response.outputs:
268
- outputs.append(deserialize(output.data, output_signature, is_output=True))
269
- if batch_input:
270
- yield outputs
271
- yield outputs[0]
272
-
273
- def _generate_by_proto(
274
- self,
275
- inputs: List[resources_pb2.Input],
276
- method_name: str = None,
277
- inference_params: Dict = {},
278
- output_config: Dict = {},
279
- ):
280
- """Generate the stream output on model based on the given inputs.
281
-
282
- Args:
283
- inputs (list[Input]): The inputs to generate, must be less than 128.
284
- method_name (str): The remote method name to call.
285
- inference_params (dict): The inference params to override.
286
- output_config (dict): The output config to override.
287
- """
288
- if not isinstance(inputs, list):
289
- raise UserError('Invalid inputs, inputs must be a list of Input objects.')
290
- if len(inputs) > MAX_MODEL_PREDICT_INPUTS:
291
- raise UserError(f"Too many inputs. Max is {MAX_MODEL_PREDICT_INPUTS}."
292
- ) # TODO Use Chunker for inputs len > 128
293
-
294
- request = service_pb2.PostModelOutputsRequest()
295
- request.CopyFrom(self.request_template)
296
-
297
- request.inputs.extend(inputs)
298
-
299
- if method_name:
300
- # TODO put in new proto field?
301
- for inp in inputs:
302
- inp.data.metadata['_method_name'] = method_name
303
- # request.model.model_version.output_info.params['_method_name'] = method_name
304
- if inference_params:
305
- request.model.model_version.output_info.params.update(inference_params)
306
- if output_config:
307
- request.model.model_version.output_info.output_config.MergeFromDict(output_config)
308
-
309
- start_time = time.time()
310
- backoff_iterator = BackoffIterator(10)
311
- started = False
312
- while not started:
313
- stream_response = self.STUB.GenerateModelOutputs(request)
314
- try:
315
- response = next(stream_response) # get the first response
316
- except StopIteration:
317
- raise Exception("Model Generate failed with no response")
318
- if status_is_retryable(response.status.code) and \
319
- time.time() - start_time < 60 * 10:
320
- self.logger.info("Model is still deploying, please wait...")
321
- time.sleep(next(backoff_iterator))
322
- continue
323
- if response.status.code != status_code_pb2.SUCCESS:
324
- raise Exception(f"Model Generate failed with response {response.status!r}")
325
- started = True
326
-
327
- yield response # yield the first response
328
-
329
- for response in stream_response:
330
- if response.status.code != status_code_pb2.SUCCESS:
331
- raise Exception(f"Model Generate failed with response {response.status!r}")
332
- yield response
333
-
334
- def _stream(
335
- self,
336
- inputs,
337
- method_name: str = 'stream',
338
- ) -> Any:
339
- input_signature = self._method_signatures[method_name].inputs
340
- output_signature = self._method_signatures[method_name].outputs
341
-
342
- if isinstance(inputs, list):
343
- assert len(inputs) == 1, 'streaming methods do not support batched calls'
344
- inputs = inputs[0]
345
- assert isinstance(inputs, dict)
346
- kwargs = inputs
347
-
348
- # find the streaming vars in the input signature, and the streaming input python param
349
- stream_argname, streaming_var_signatures = get_stream_from_signature(input_signature)
350
-
351
- # get the streaming input generator from the user-provided function arg values
352
- user_inputs_generator = kwargs.pop(stream_argname)
353
-
354
- def _input_proto_stream():
355
- # first item contains all the inputs and the first stream item
356
- proto = resources_pb2.Input()
357
- try:
358
- item = next(user_inputs_generator)
359
- except StopIteration:
360
- return # no items to stream
361
- kwargs[stream_argname] = item
362
- serialize(kwargs, input_signature, proto.data)
363
-
364
- yield proto
365
-
366
- # subsequent items are just the stream items
367
- for item in user_inputs_generator:
368
- proto = resources_pb2.Input()
369
- serialize({stream_argname: item}, streaming_var_signatures, proto.data)
370
- yield proto
371
-
372
- response_stream = self._stream_by_proto(_input_proto_stream(), method_name)
373
- #print(response)
374
-
375
- for response in response_stream:
376
- assert len(response.outputs) == 1, 'streaming methods must have exactly one output'
377
- yield deserialize(response.outputs[0].data, output_signature, is_output=True)
378
-
379
- def _req_iterator(self,
380
- input_iterator: Iterator[List[resources_pb2.Input]],
381
- method_name: str = None,
382
- inference_params: Dict = {},
383
- output_config: Dict = {}):
384
- request = service_pb2.PostModelOutputsRequest()
385
- request.CopyFrom(self.request_template)
386
- # request.model.model_version.output_info.params['_method_name'] = method_name
387
- if inference_params:
388
- request.model.model_version.output_info.params.update(inference_params)
389
- if output_config:
390
- request.model.model_version.output_info.output_config.MergeFromDict(output_config)
391
- for inputs in input_iterator:
392
- req = service_pb2.PostModelOutputsRequest()
393
- req.CopyFrom(request)
394
- if isinstance(inputs, list):
395
- req.inputs.extend(inputs)
396
- else:
397
- req.inputs.append(inputs)
398
- for inp in req.inputs:
399
- inp.data.metadata['_method_name'] = method_name
400
- yield req
401
-
402
- def _stream_by_proto(self,
403
- inputs: Iterator[List[resources_pb2.Input]],
404
- method_name: str = None,
405
- inference_params: Dict = {},
406
- output_config: Dict = {}):
407
- """Generate the stream output on model based on the given stream of inputs.
408
- """
409
- # if not isinstance(inputs, Iterator[List[Input]]):
410
- # raise UserError('Invalid inputs, inputs must be a iterator of list of Input objects.')
411
-
412
- request = self._req_iterator(inputs, method_name, inference_params, output_config)
413
-
414
- start_time = time.time()
415
- backoff_iterator = BackoffIterator(10)
416
- generation_started = False
417
- while True:
418
- if generation_started:
419
- break
420
- stream_response = self.STUB.StreamModelOutputs(request)
421
- for response in stream_response:
422
- if status_is_retryable(response.status.code) and \
423
- time.time() - start_time < 60 * 10:
424
- self.logger.info("Model is still deploying, please wait...")
425
- time.sleep(next(backoff_iterator))
426
- break
427
- if response.status.code != status_code_pb2.SUCCESS:
428
- raise Exception(f"Model Predict failed with response {response.status!r}")
429
- else:
430
- if not generation_started:
431
- generation_started = True
432
- yield response