clarifai 10.8.4__py3-none-any.whl → 10.8.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 (61) hide show
  1. clarifai/__init__.py +1 -1
  2. clarifai/client/dataset.py +9 -3
  3. clarifai/constants/dataset.py +1 -1
  4. clarifai/datasets/upload/base.py +6 -3
  5. clarifai/datasets/upload/features.py +10 -0
  6. clarifai/datasets/upload/image.py +22 -13
  7. clarifai/datasets/upload/multimodal.py +70 -0
  8. clarifai/datasets/upload/text.py +8 -5
  9. clarifai/runners/models/model_upload.py +67 -31
  10. clarifai/runners/utils/loader.py +0 -1
  11. clarifai/utils/misc.py +6 -0
  12. {clarifai-10.8.4.dist-info → clarifai-10.8.6.dist-info}/METADATA +2 -1
  13. {clarifai-10.8.4.dist-info → clarifai-10.8.6.dist-info}/RECORD +17 -60
  14. clarifai/models/model_serving/README.md +0 -158
  15. clarifai/models/model_serving/__init__.py +0 -14
  16. clarifai/models/model_serving/cli/__init__.py +0 -12
  17. clarifai/models/model_serving/cli/_utils.py +0 -53
  18. clarifai/models/model_serving/cli/base.py +0 -14
  19. clarifai/models/model_serving/cli/build.py +0 -79
  20. clarifai/models/model_serving/cli/clarifai_clis.py +0 -33
  21. clarifai/models/model_serving/cli/create.py +0 -171
  22. clarifai/models/model_serving/cli/example_cli.py +0 -34
  23. clarifai/models/model_serving/cli/login.py +0 -26
  24. clarifai/models/model_serving/cli/upload.py +0 -183
  25. clarifai/models/model_serving/constants.py +0 -21
  26. clarifai/models/model_serving/docs/cli.md +0 -161
  27. clarifai/models/model_serving/docs/concepts.md +0 -229
  28. clarifai/models/model_serving/docs/dependencies.md +0 -11
  29. clarifai/models/model_serving/docs/inference_parameters.md +0 -139
  30. clarifai/models/model_serving/docs/model_types.md +0 -19
  31. clarifai/models/model_serving/model_config/__init__.py +0 -16
  32. clarifai/models/model_serving/model_config/base.py +0 -369
  33. clarifai/models/model_serving/model_config/config.py +0 -312
  34. clarifai/models/model_serving/model_config/inference_parameter.py +0 -129
  35. clarifai/models/model_serving/model_config/model_types_config/multimodal-embedder.yaml +0 -25
  36. clarifai/models/model_serving/model_config/model_types_config/text-classifier.yaml +0 -19
  37. clarifai/models/model_serving/model_config/model_types_config/text-embedder.yaml +0 -20
  38. clarifai/models/model_serving/model_config/model_types_config/text-to-image.yaml +0 -19
  39. clarifai/models/model_serving/model_config/model_types_config/text-to-text.yaml +0 -19
  40. clarifai/models/model_serving/model_config/model_types_config/visual-classifier.yaml +0 -22
  41. clarifai/models/model_serving/model_config/model_types_config/visual-detector.yaml +0 -32
  42. clarifai/models/model_serving/model_config/model_types_config/visual-embedder.yaml +0 -19
  43. clarifai/models/model_serving/model_config/model_types_config/visual-segmenter.yaml +0 -19
  44. clarifai/models/model_serving/model_config/output.py +0 -133
  45. clarifai/models/model_serving/model_config/triton/__init__.py +0 -14
  46. clarifai/models/model_serving/model_config/triton/serializer.py +0 -136
  47. clarifai/models/model_serving/model_config/triton/triton_config.py +0 -182
  48. clarifai/models/model_serving/model_config/triton/wrappers.py +0 -281
  49. clarifai/models/model_serving/repo_build/__init__.py +0 -14
  50. clarifai/models/model_serving/repo_build/build.py +0 -198
  51. clarifai/models/model_serving/repo_build/static_files/_requirements.txt +0 -2
  52. clarifai/models/model_serving/repo_build/static_files/base_test.py +0 -169
  53. clarifai/models/model_serving/repo_build/static_files/inference.py +0 -26
  54. clarifai/models/model_serving/repo_build/static_files/sample_clarifai_config.yaml +0 -25
  55. clarifai/models/model_serving/repo_build/static_files/test.py +0 -40
  56. clarifai/models/model_serving/repo_build/static_files/triton/model.py +0 -75
  57. clarifai/models/model_serving/utils.py +0 -31
  58. {clarifai-10.8.4.dist-info → clarifai-10.8.6.dist-info}/LICENSE +0 -0
  59. {clarifai-10.8.4.dist-info → clarifai-10.8.6.dist-info}/WHEEL +0 -0
  60. {clarifai-10.8.4.dist-info → clarifai-10.8.6.dist-info}/entry_points.txt +0 -0
  61. {clarifai-10.8.4.dist-info → clarifai-10.8.6.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,11 @@
1
- clarifai/__init__.py,sha256=HSKp-CWoewa1bRsD-uVM7lGOdBh9yxh5X4Qc8hkw9ak,23
1
+ clarifai/__init__.py,sha256=5gJxqMyHfStgLsUbgDyNI4zTcQbFwffphiPw6fZhAHk,23
2
2
  clarifai/cli.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  clarifai/errors.py,sha256=RwzTajwds51wLD0MVlMC5kcpBnzRpreDLlazPSBZxrg,2605
4
4
  clarifai/versions.py,sha256=jctnczzfGk_S3EnVqb2FjRKfSREkNmvNEwAAa_VoKiQ,222
5
5
  clarifai/client/__init__.py,sha256=xI1U0l5AZdRThvQAXCLsd9axxyFzXXJ22m8LHqVjQRU,662
6
6
  clarifai/client/app.py,sha256=VC5TqeYVNUyENPxOOKNSAl0q3ivPiqg-gtRr77ACIIM,38424
7
7
  clarifai/client/base.py,sha256=JXbbjg2CXo8rOdw-XgKWWtLVAhPv3OZua5LFT5w4U2Q,7380
8
- clarifai/client/dataset.py,sha256=XX-J-9Ict1CQrEycq-JbdxUTuucSgLeDSvnlHE1ucQY,29903
8
+ clarifai/client/dataset.py,sha256=AmkeYdZI7oe7ZCEh4odTuzC5r4ESCmkdHHo4v23dSeQ,30204
9
9
  clarifai/client/input.py,sha256=ZLqa1jGx4NgCbunOTpJxCq4lDQ5xAf4GQ0rsZY8AHCM,44456
10
10
  clarifai/client/lister.py,sha256=03KGMvs5RVyYqxLsSrWhNc34I8kiF1Ph0NeyEwu7nMU,2082
11
11
  clarifai/client/model.py,sha256=YqeCwk1v_Rs2L6OTZSkDZvxGaxMoFMYuxVV7s9jdd0I,74416
@@ -17,7 +17,7 @@ clarifai/client/auth/__init__.py,sha256=7EwR0NrozkAUwpUnCsqXvE_p0wqx_SelXlSpKShK
17
17
  clarifai/client/auth/helper.py,sha256=hqwI7Zlsvivc-O9aAdtxyJT3zkpuMvbxjRaiCTsWYGk,14183
18
18
  clarifai/client/auth/register.py,sha256=2CMdBsoVLoTfjyksE6j7BM2tiEc73WKYvxnwDDgNn1k,536
19
19
  clarifai/client/auth/stub.py,sha256=xy4-fV0W8keCgXld4eOVzFQEIKxOktNwtL5bLztReug,4940
20
- clarifai/constants/dataset.py,sha256=Puz6_FfTm30G5FVBb1GJsobMkNtbg0Y2Soy7eyHjvtI,587
20
+ clarifai/constants/dataset.py,sha256=vjK3IlgXu31HycuvjRSzEQSqhU6xfj5TIgo6IpyUWoc,609
21
21
  clarifai/constants/input.py,sha256=WcHwToUVIK9ItAhDefaSohQHCLNeR55PSjZ0BFnoZ3U,28
22
22
  clarifai/constants/model.py,sha256=Um1hLfMFlh5R_vtP3Z6P-o6zon-tdbLcKVIl4PucrV4,438
23
23
  clarifai/constants/rag.py,sha256=WcHwToUVIK9ItAhDefaSohQHCLNeR55PSjZ0BFnoZ3U,28
@@ -27,10 +27,11 @@ clarifai/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
27
27
  clarifai/datasets/export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  clarifai/datasets/export/inputs_annotations.py,sha256=7c6HWdATI4aPCRoCPZetUBNNEz9dBhbyYX1QqX-xYe4,9744
29
29
  clarifai/datasets/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- clarifai/datasets/upload/base.py,sha256=IP4sdBRfThk2l0W1rDWciFrAJnKwVsM-gu4zEslJ2_E,2198
31
- clarifai/datasets/upload/features.py,sha256=oq0PGpAw8LEafiSkdMMl0yn-NJeZ7K_CKzpJ71b0H40,1731
32
- clarifai/datasets/upload/image.py,sha256=pNFTThEVGIK9RNIsUuSSQE59LfO-tKkhsXSR7CONAEg,8293
33
- clarifai/datasets/upload/text.py,sha256=KM_LupAqYYxmbl1Q5nTsr3eV1RAYDfr-2xzf4cP6rfY,2083
30
+ clarifai/datasets/upload/base.py,sha256=UIc0ufyIBCrb83_sFpv21L8FshsX4nwsLYQkdlJfzD4,2357
31
+ clarifai/datasets/upload/features.py,sha256=jv2x7jGZKS-LMt87sEZNBwwOskHbP26XTMjoiaSA5pg,2024
32
+ clarifai/datasets/upload/image.py,sha256=HlCsfEMu_C4GVecGSv52RUJ6laLW8H64Pfj_FQyX6qg,8580
33
+ clarifai/datasets/upload/multimodal.py,sha256=2_s4SCotzacVMdnqkM7upSR3Ovxh3b9oW1hSWhKyxO4,2373
34
+ clarifai/datasets/upload/text.py,sha256=boVJenfQZKf79aXu8CEP4g_ANzX5ROdd06g07O7RnXU,2198
34
35
  clarifai/datasets/upload/utils.py,sha256=h7mtN9FZXhQQbf47EXczgb-NTY2uOE9AJlE9u4-hDwI,9627
35
36
  clarifai/datasets/upload/loaders/README.md,sha256=aNRutSCTzLp2ruIZx74ZkN5AxpzwKOxMa7OzabnKpwg,2980
36
37
  clarifai/datasets/upload/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -40,50 +41,6 @@ clarifai/datasets/upload/loaders/imagenet_classification.py,sha256=LuylazxpI5V8f
40
41
  clarifai/datasets/upload/loaders/xview_detection.py,sha256=hk8cZdYZimm4KOaZvBjYcC6ikURZMn51xmn7pXZT3HE,6052
41
42
  clarifai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
43
  clarifai/models/api.py,sha256=d3FQQlG0mNDLrfEvchqaVcq4Tgb_TqryNnJtwp3c7sE,10961
43
- clarifai/models/model_serving/README.md,sha256=zXnKybVoIF_LYHKKY2vijTCaGcb2-GJ5kef2uB1WFrs,4241
44
- clarifai/models/model_serving/__init__.py,sha256=78fiK9LvdGvpMxICmZWqSIyS6BFATjW2s5R6_GgtbPA,645
45
- clarifai/models/model_serving/constants.py,sha256=8eVT6iYGRF4s4SKoHFUmDwCX6C2EiEiCOP1MIgtcc6A,692
46
- clarifai/models/model_serving/utils.py,sha256=vdFLyxvcDJhgFdw2jaOsVNVmLlw87ymGTgQachVleOU,1089
47
- clarifai/models/model_serving/cli/__init__.py,sha256=Nls28G-fedNw2oQZIkPQSN__TgjJXbG9RDzzuHIM0VI,575
48
- clarifai/models/model_serving/cli/_utils.py,sha256=CZTKKiaoO1Mg5MKQS2Qhgy4JRjnkEHqy8zY5U6b6C0w,1734
49
- clarifai/models/model_serving/cli/base.py,sha256=k4ARNU1koNzGAi9ach6Vpk7hpISZySiYHyKjkBLuHLg,283
50
- clarifai/models/model_serving/cli/build.py,sha256=-C4PBt-9xO9YsyUagz3kF4J0_PsYb6YVKFY8y-VmY5I,2786
51
- clarifai/models/model_serving/cli/clarifai_clis.py,sha256=sGDDj7MrlU3goWLQm4H9dCf4lPD2Ojx50_jdIoxb5QM,663
52
- clarifai/models/model_serving/cli/create.py,sha256=wtKcVi8XSPN-Fx0RrSUxEwH1hm5TbZ_FrCEMIS9yszM,5598
53
- clarifai/models/model_serving/cli/example_cli.py,sha256=tCm0J4EI0kuuSRhEiPTuraSA-bUYwtEFEHcL1eOXzRI,1039
54
- clarifai/models/model_serving/cli/login.py,sha256=IQHL3SdERThnCTGPp5HnI41B0-BTzzGb2wx0P8-KIIA,771
55
- clarifai/models/model_serving/cli/upload.py,sha256=kOz8OOEobo6sLUkS1xg0672PTmMkx0aWxjKMhSRlMwM,7013
56
- clarifai/models/model_serving/docs/cli.md,sha256=fLgyY8sYMPjYQW_q8Q9yJYB_ryDVGbzj2VouJgvkEFw,4564
57
- clarifai/models/model_serving/docs/concepts.md,sha256=ppQADibKQInf9JpfcH7wIpcMndTZ3618or5yzMhGNOE,9376
58
- clarifai/models/model_serving/docs/dependencies.md,sha256=apwg_IxDBzovtQYXRpWMU9pUqdf0VaS10yMVOYYXhoc,728
59
- clarifai/models/model_serving/docs/inference_parameters.md,sha256=EFBQs3OGQNH512zoLJKMfFD6WXE_Tzt_Uvts877VvpQ,4111
60
- clarifai/models/model_serving/docs/model_types.md,sha256=3sALugeBTMspEnlPNWXI8xtWCxjMDQYjrAji_jgqHVo,1013
61
- clarifai/models/model_serving/model_config/__init__.py,sha256=MLnCl4U2UlL8hkvKbKifFX2nKRjVN63687-gxiKf8g4,734
62
- clarifai/models/model_serving/model_config/base.py,sha256=Jow6cFvREtWRaaXw1hobWJks0uYsOi9oL973ZPEfIkk,14636
63
- clarifai/models/model_serving/model_config/config.py,sha256=EWkPcui370QEYJAjlzuLupLlaZF2BgFbK0Jhx_JDHnk,10188
64
- clarifai/models/model_serving/model_config/inference_parameter.py,sha256=fDPRkwsntaGZWQWOiCW8x0tcyHPeSCYZwBZoZb2oBzw,3924
65
- clarifai/models/model_serving/model_config/output.py,sha256=uyXY-B9mmoe8lizTpYEBRYI1KDNQh3ihEiEB4Ne65uc,4634
66
- clarifai/models/model_serving/model_config/model_types_config/multimodal-embedder.yaml,sha256=4wFQ2R8PiJrXR_8AEgUDD-22gY9sK93y9r68mSOOVnw,541
67
- clarifai/models/model_serving/model_config/model_types_config/text-classifier.yaml,sha256=0hicyQM-R2Za62RaBexdNCkHBDdacwMRVAL8Yk_sVzs,421
68
- clarifai/models/model_serving/model_config/model_types_config/text-embedder.yaml,sha256=MEnVsO3-SAOFSW7-b0BOSxgUNxdhXfmE98hXstBt104,395
69
- clarifai/models/model_serving/model_config/model_types_config/text-to-image.yaml,sha256=FPO9ic0R_mcFa3nIGon9z3negy1q6LsPRNmJ-wqGhyw,383
70
- clarifai/models/model_serving/model_config/model_types_config/text-to-text.yaml,sha256=7u_0kdiR2iEuXTKHtErUzZZ8ghUdep-RuWmJd9i8BdY,371
71
- clarifai/models/model_serving/model_config/model_types_config/visual-classifier.yaml,sha256=UDq-VtnnnhuI7NCJOYM19kFvcMS0aOvDDMSblPk5iYY,468
72
- clarifai/models/model_serving/model_config/model_types_config/visual-detector.yaml,sha256=cJsalUTzXclXpgzH9CutpWQqseJNg9FrI7WjU3wpfuQ,852
73
- clarifai/models/model_serving/model_config/model_types_config/visual-embedder.yaml,sha256=OQYdrY81rD3WNooHRkOiQASvL3XfGG9GGzT61jEsrT8,406
74
- clarifai/models/model_serving/model_config/model_types_config/visual-segmenter.yaml,sha256=mQLwA1JnnvWZwp26lVxzwfhp1GS7hH9yHh7mtOUt9rY,474
75
- clarifai/models/model_serving/model_config/triton/__init__.py,sha256=uJUjpRauhVp6_9sN5DRQi7bwIKEtHPKyQqcCVj6Aj2g,719
76
- clarifai/models/model_serving/model_config/triton/serializer.py,sha256=eYwXfaJkeXMaiQq_EDG4vWOCc1CKfnC_U6dSp2Urak0,4278
77
- clarifai/models/model_serving/model_config/triton/triton_config.py,sha256=mDZafUByvEgM1vd0QZL8nM-cOCqeR-06iOC2T6x8hr4,4696
78
- clarifai/models/model_serving/model_config/triton/wrappers.py,sha256=-O8t2AEJXvqJlUNtKtr8CUlxLjheV2GfBtM0sB_B1v0,8660
79
- clarifai/models/model_serving/repo_build/__init__.py,sha256=jFb0RNG4Jh63TH35_Urv0EyNXVMW8FEC2NVHXhlbvqg,673
80
- clarifai/models/model_serving/repo_build/build.py,sha256=IlJTjt5YI1alAGv1Fw3kPZeh3yqi45R20rKbWN9vV1s,7195
81
- clarifai/models/model_serving/repo_build/static_files/_requirements.txt,sha256=lIXMfxC4BP6QA5hraObPOwUS3PK9F2mA0Gf8KvlijQE,34
82
- clarifai/models/model_serving/repo_build/static_files/base_test.py,sha256=Ne5H5JKTQTBuHYl_0g_d5JmUxW7gSECp9te7W1zcVIc,6785
83
- clarifai/models/model_serving/repo_build/static_files/inference.py,sha256=TejkXZw43mcZD-M9TkfuqMuABz_cliJgf53_Teodtf0,721
84
- clarifai/models/model_serving/repo_build/static_files/sample_clarifai_config.yaml,sha256=VOFSSb7D_CgRRcqi-plaCH-6hoFO8NAGDNXVSOJGylo,678
85
- clarifai/models/model_serving/repo_build/static_files/test.py,sha256=GunBqWgTyo0aF5W9ckKz55tGS-wkL9S9TRfytIjB7Eo,1505
86
- clarifai/models/model_serving/repo_build/static_files/triton/model.py,sha256=l9lkwyeXw9H_K4Om9dGcuylnj4hAlzohspUZkSnQ7Qg,2429
87
44
  clarifai/modules/README.md,sha256=mx8pVx6cPp-pP4LcFPT_nX3ngGmhygVK0WiXeD3cbIo,367
88
45
  clarifai/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
46
  clarifai/modules/css.py,sha256=kadCEunmyh5h2yf0-4aysE3ZcZ6qaQcxuAgDXS96yF8,2020
@@ -101,11 +58,11 @@ clarifai/runners/models/base_typed_model.py,sha256=OnAk08Lo2Y1fGiBc6JJ6UvJ8P435c
101
58
  clarifai/runners/models/model_class.py,sha256=9JSPAr4U4K7xI0kSl-q0mHB06zknm2OR-8XIgBCto94,1611
102
59
  clarifai/runners/models/model_runner.py,sha256=3vzoastQxkGRDK8T9aojDsLNBb9A3IiKm6YmbFrE9S0,6241
103
60
  clarifai/runners/models/model_servicer.py,sha256=i10oxz4pb1NsTQwkyhccJ3URg88Qn63XiuoBRCnJn9w,2737
104
- clarifai/runners/models/model_upload.py,sha256=JlvB9vOiGYVS6xY2i9iMRWD5I4BX8CifNDpJ62Wh-T8,12164
61
+ clarifai/runners/models/model_upload.py,sha256=PsCHO4CsJ2N6kBdeo7uUNjxWooXUgLepW_NfjU_YJ1A,13899
105
62
  clarifai/runners/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
63
  clarifai/runners/utils/data_handler.py,sha256=sxy9zlAgI6ETuxCQhUgEXAn2GCsaW1GxpK6GTaMne0g,6966
107
64
  clarifai/runners/utils/data_utils.py,sha256=R1iQ82TuQ9JwxCJk8yEB1Lyb0BYVhVbWJI9YDi1zGOs,318
108
- clarifai/runners/utils/loader.py,sha256=2U-96wBE8WjtAI978QUWDy4Xkk6j5up8aMAEFVT-VI8,2533
65
+ clarifai/runners/utils/loader.py,sha256=r1FFfN7fE3GXPLOGaJAqmSpwETESkOAVZViOI8IpXNk,2532
109
66
  clarifai/runners/utils/logging.py,sha256=xan5ZQH5XHVyNIIjUAQoc_bS3MrjQjEvBYuo0CQKdho,153
110
67
  clarifai/runners/utils/url_fetcher.py,sha256=6u7tPRXuBe-4a2LYxRNJ5WTrNMH2kYXsk73Zuo14qb4,1432
111
68
  clarifai/schema/search.py,sha256=JjTi8ammJgZZ2OGl4K6tIA4zEJ1Fr2ASZARXavI1j5c,2448
@@ -113,7 +70,7 @@ clarifai/urls/helper.py,sha256=tjoMGGHuWX68DUB0pk4MEjrmFsClUAQj2jmVEM_Sy78,4751
113
70
  clarifai/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
71
  clarifai/utils/constants.py,sha256=MG_iHnSwNEyUZOpvsrTicNwaT4CIjmlK_Ixk_qqEX8g,142
115
72
  clarifai/utils/logging.py,sha256=_nzRyXu3fUa_5X8vXig5dV392YkNESDTc3ZoiwVOGZY,11359
116
- clarifai/utils/misc.py,sha256=WV3KGM5_MwHySVthjUK4O93x6F_kE1h3-xT4zE4EvnU,2150
73
+ clarifai/utils/misc.py,sha256=ptjt1NtteDT0EhrPoyQ7mgWtvoAQ-XNncQaZvNHb0KI,2253
117
74
  clarifai/utils/model_train.py,sha256=Mndqy5GNu7kjQHjDyNVyamL0hQFLGSHcWhOuPyOvr1w,8005
118
75
  clarifai/utils/evaluation/__init__.py,sha256=PYkurUrXrGevByj7RFb6CoU1iC7fllyQSfnnlo9WnY8,69
119
76
  clarifai/utils/evaluation/helpers.py,sha256=d_dcASRI_lhsHIRukAF1S-w7XazLpK9y6E_ug3l50t4,18440
@@ -123,9 +80,9 @@ clarifai/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
123
80
  clarifai/workflows/export.py,sha256=vICRhIreqDSShxLKjHNM2JwzKsf1B4fdXB0ciMcA70k,1945
124
81
  clarifai/workflows/utils.py,sha256=nGeB_yjVgUO9kOeKTg4OBBaBz-AwXI3m-huSVj-9W18,1924
125
82
  clarifai/workflows/validate.py,sha256=yJq03MaJqi5AK3alKGJJBR89xmmjAQ31sVufJUiOqY8,2556
126
- clarifai-10.8.4.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
127
- clarifai-10.8.4.dist-info/METADATA,sha256=hkbzljAgU7J6ey53Lk-70304H-VlkHBD89z68FvJK4Y,19446
128
- clarifai-10.8.4.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
129
- clarifai-10.8.4.dist-info/entry_points.txt,sha256=qZOr_MIPG0dBBE1zringDJS_wXNGTAA_SQ-zcbmDHOw,82
130
- clarifai-10.8.4.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
131
- clarifai-10.8.4.dist-info/RECORD,,
83
+ clarifai-10.8.6.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
84
+ clarifai-10.8.6.dist-info/METADATA,sha256=u7wP6djeaOnVhlz_RBIE2aDEretrTZuJWHbfC_UVHpY,19479
85
+ clarifai-10.8.6.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
86
+ clarifai-10.8.6.dist-info/entry_points.txt,sha256=qZOr_MIPG0dBBE1zringDJS_wXNGTAA_SQ-zcbmDHOw,82
87
+ clarifai-10.8.6.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
88
+ clarifai-10.8.6.dist-info/RECORD,,
@@ -1,158 +0,0 @@
1
- # Clarifai Model Serving
2
-
3
- ## Overview
4
-
5
- Model Serving is a part of user journey at Clarifai offers a user-friendly interface for deploying your local model into production with Clarifai, featuring:
6
-
7
- * A convenient command-line interface (CLI)
8
- * Easy implementation and testing in Python
9
- * No need for MLops expertise.
10
-
11
- ## Quickstart Guide
12
-
13
- Quick example for deploying a `text-to-text` model
14
-
15
- ### Initialize a Clarifai model repository
16
-
17
- Suppose your working directory name is `your_model_dir`. Then run
18
-
19
- ```bash
20
- $ clarifai create model --type text-to-text --working-dir your_model_dir
21
- $ cd your_model_dir
22
- ```
23
-
24
- In `your_model_dir` folder you will see essential files for deployment process
25
-
26
- ```bash
27
- your_model_dir
28
- ├── clarifai_config.yaml
29
- ├── inference.py
30
- ├── test.py
31
- └── requirements.txt
32
- ```
33
-
34
- ### Implementation
35
-
36
- Write your code in class `InferenceModel` which is an interface between your model and Clarifai server in `inference.py`, there are 2 functions you must implement:
37
-
38
- * `__init__`: load your model checkpoint once.
39
- * `predict`: make prediction, called everytime when you make request from API.
40
-
41
- For example, a complete implementation of a hf text-generation model
42
-
43
- ```python
44
- import os
45
- from typing import Dict, Union
46
- from clarifai.models.model_serving.model_config import *
47
-
48
- import torch
49
- from transformers import AutoTokenizer
50
- import transformers
51
-
52
- class InferenceModel(TextToText):
53
- """User model inference class."""
54
-
55
- def __init__(self) -> None:
56
- """
57
- Load inference time artifacts that are called frequently .e.g. models, tokenizers, etc.
58
- in this method so they are loaded only once for faster inference.
59
- """
60
- # current directory
61
- self.base_path = os.path.dirname(__file__)
62
- # where you save hf checkpoint in your working dir e.i. `your_model_dir`
63
- model_path = os.path.join(self.base_path, "checkpoint")
64
- self.tokenizer = AutoTokenizer.from_pretrained(model_path)
65
- self.pipeline = transformers.pipeline(
66
- "text-generation",
67
- model=model_path,
68
- torch_dtype=torch.float16,
69
- device_map="auto",
70
- )
71
-
72
- def predict(self, input_data: list,
73
- inference_parameters: Dict[str, Union[str, float, int]]) -> list:
74
- """ Custom prediction function for `text-to-text` (also called as `text generation`) model.
75
-
76
- Args:
77
- input_data (List[str]): List of text
78
- inference_parameters (Dict[str, Union[str, float, int]]): your inference parameters
79
-
80
- Returns:
81
- list of TextOutput
82
-
83
- """
84
- output_sequences = self.pipeline(
85
- input_data,
86
- eos_token_id=self.tokenizer.eos_token_id,
87
- **inference_parameters)
88
-
89
- # wrap outputs in Clarifai defined output
90
- return [TextOutput(each[0]) for each in output_sequences]
91
- ```
92
-
93
- Update dependencies in `requirements.txt`
94
-
95
- ```
96
- clarifai
97
- torch=2.1.1
98
- transformers==4.36.2
99
- accelerate==0.26.1
100
- ```
101
-
102
- ### Test (optional)
103
-
104
- > NOTE: Running `test` is also involved in `build` and `upload` command.
105
-
106
- Test and play with your implementation by executing `test.py`.
107
-
108
- Install pytest
109
-
110
- ```bash
111
- $ pip install pytest
112
- ```
113
-
114
- Execute test
115
-
116
- ```bash
117
- $ pytest test.py
118
- ```
119
-
120
- ### Build
121
-
122
- Prepare for deployment step. Run:
123
-
124
- ```bash
125
- $ clarifai build model
126
- ```
127
-
128
- You will obtain `*.clarifai` file, it's simply a zip having all nessecary files in it to get your model work on Clarifai platform.
129
-
130
- `NOTE`: you need to upload your built file to cloud storage to get direct download `url` for next step
131
-
132
- ### Deployment
133
-
134
- Login to Clarifai
135
-
136
- ```bash
137
- $ clarifai login
138
- Get your PAT from https://clarifai.com/settings/security and pass it here: <insert your pat here>
139
- ```
140
-
141
- Upload
142
-
143
- ```bash
144
- # upload built file directly
145
- $ clarifai upload model <your-working-dir> --user-app <your_user_id>/<your_app_id> --id <your_model_id>
146
- # or using direct download url of cloud storage
147
- $ clarifai upload model --url <url> --user-app <your_user_id>/<your_app_id> --id <your_model_id>
148
- ```
149
-
150
- ## Learn More
151
-
152
- * [Detail Instruction](./docs/concepts.md)
153
- * [Examples](https://github.com/Clarifai/examples/tree/main/model_upload)
154
- * [Initialize from example](./docs/cli.md)
155
- * [CLI usage](./docs/cli.md)
156
- * [Inference parameters](./docs/inference_parameters.md)
157
- * [Model Types](./docs/model_types.md)
158
- * [Dependencies](./docs/dependencies.md)
@@ -1,14 +0,0 @@
1
- # Copyright 2023 Clarifai, Inc.
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- #
8
- # Unless required by applicable law or agreed to in writing, software
9
- # distributed under the License is distributed on an "AS IS" BASIS,
10
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- # See the License for the specific language governing permissions and
12
- # limitations under the License.
13
- from .model_config import * # noqa
14
- from .repo_build import * # noqa
@@ -1,12 +0,0 @@
1
- # Copyright 2023 Clarifai, Inc.
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- #
8
- # Unless required by applicable law or agreed to in writing, software
9
- # distributed under the License is distributed on an "AS IS" BASIS,
10
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- # See the License for the specific language governing permissions and
12
- # limitations under the License.
@@ -1,53 +0,0 @@
1
- from __future__ import annotations # isort: skip
2
- import os
3
- import shutil
4
- import subprocess
5
- from typing import Dict, Union
6
-
7
- from ..constants import (CLARIFAI_EXAMPLES_REPO, CLARIFAI_EXAMPLES_REPO_PATH,
8
- MODEL_UPLOAD_EXAMPLE_FOLDER)
9
-
10
-
11
- def download_examples_repo(forced_download: bool = False):
12
-
13
- def _pull():
14
- subprocess.run(f"git clone {CLARIFAI_EXAMPLES_REPO} {CLARIFAI_EXAMPLES_REPO_PATH}", shell=True)
15
-
16
- if not os.path.isdir(CLARIFAI_EXAMPLES_REPO_PATH):
17
- print(f"Download examples to {CLARIFAI_EXAMPLES_REPO_PATH}")
18
- _pull()
19
- else:
20
- if forced_download:
21
-
22
- def _rm_dir_readonly(func, path, _):
23
- import stat
24
- os.chmod(path, stat.S_IWRITE)
25
- func(path)
26
-
27
- print("Removing old examples...")
28
- shutil.rmtree(CLARIFAI_EXAMPLES_REPO_PATH, onerror=_rm_dir_readonly)
29
- _pull()
30
-
31
-
32
- def list_model_upload_examples(
33
- forced_download: bool = False) -> Dict[str, tuple[str, Union[str, None]]]:
34
- download_examples_repo(forced_download)
35
- model_upload_folder = MODEL_UPLOAD_EXAMPLE_FOLDER
36
- model_upload_path = os.path.join(CLARIFAI_EXAMPLES_REPO_PATH, model_upload_folder)
37
- examples = {}
38
- for model_type_ex in os.listdir(model_upload_path):
39
- _folder = os.path.join(model_upload_path, model_type_ex)
40
- if os.path.isdir(_folder):
41
- _walk = list(os.walk(_folder))
42
- if len(_walk) > 0:
43
- _, model_names, _files = _walk[0]
44
- readme = [item for item in _files if "readme" in item.lower()]
45
- for name in model_names:
46
- examples.update({
47
- f"{model_type_ex}/{name}": [
48
- os.path.join(_folder, name),
49
- os.path.join(_folder, readme[0]) or None
50
- ]
51
- })
52
-
53
- return examples
@@ -1,14 +0,0 @@
1
- from abc import ABC, abstractmethod
2
- from argparse import _SubParsersAction
3
-
4
-
5
- class BaseClarifaiCli(ABC):
6
-
7
- @staticmethod
8
- @abstractmethod
9
- def register(parser: _SubParsersAction):
10
- raise NotImplementedError()
11
-
12
- @abstractmethod
13
- def run(self):
14
- raise NotImplementedError()
@@ -1,79 +0,0 @@
1
- # Copyright 2023 Clarifai, Inc.
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- #
8
- # Unless required by applicable law or agreed to in writing, software
9
- # distributed under the License is distributed on an "AS IS" BASIS,
10
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- # See the License for the specific language governing permissions and
12
- # limitations under the License.
13
- """Commandline interface for model upload utils."""
14
- import argparse
15
- import os
16
- import subprocess
17
-
18
- from ..repo_build import RepositoryBuilder
19
- from .base import BaseClarifaiCli
20
-
21
-
22
- class BuildCli(BaseClarifaiCli):
23
-
24
- @staticmethod
25
- def register(parser: argparse._SubParsersAction):
26
- parser = parser.add_parser("build", help="Build clarifai model for uploading")
27
- sub_parser = parser.add_subparsers()
28
-
29
- BuildModelSubCli.register(sub_parser)
30
-
31
- parser.set_defaults(func=BuildCli)
32
-
33
-
34
- class BuildModelSubCli(BaseClarifaiCli):
35
-
36
- @staticmethod
37
- def register(parser: argparse._SubParsersAction):
38
- sub_parser = parser.add_parser("model", help="Build Clarifai model")
39
- sub_parser.add_argument(
40
- "path",
41
- type=str,
42
- nargs='?',
43
- help="Path to working directory, default is current directory",
44
- default=".")
45
- sub_parser.add_argument(
46
- "--out-path", type=str, required=False, help="Output path of built model", default=None)
47
- sub_parser.add_argument(
48
- "--name",
49
- type=str,
50
- required=False,
51
- help="Name of built file, default is `clarifai_model_id` in config if set or `model`",
52
- default=None)
53
- sub_parser.add_argument(
54
- "--no-test",
55
- action="store_true",
56
- help="Trigger this flag to skip testing before uploading")
57
- sub_parser.set_defaults(func=BuildModelSubCli)
58
-
59
- def __init__(self, args: argparse.Namespace) -> None:
60
- self.path = args.path
61
- self.no_test = args.no_test
62
- self.test_path = os.path.join(self.path, "test.py")
63
- self.output_path = args.out_path or self.path
64
- self.serving_backend = "triton"
65
- self.name = args.name
66
-
67
- def run(self):
68
-
69
- # Run test before uploading
70
- if not self.no_test:
71
- assert os.path.exists(
72
- self.test_path), FileNotFoundError(f"Could not find `test.py` in {self.path}")
73
- result = subprocess.run(f"pytest -s --log-level=INFO {self.test_path}", shell=True)
74
- assert result.returncode == 0, "Test has failed. Please make sure no error exists in your code."
75
-
76
- # build
77
- print("Start building...")
78
- RepositoryBuilder.build(
79
- self.path, backend=self.serving_backend, output_dir=self.output_path, name=self.name)
@@ -1,33 +0,0 @@
1
- from argparse import ArgumentParser
2
-
3
- from .build import BuildCli
4
- from .create import CreateCli
5
- from .example_cli import ExampleCli
6
- from .login import LoginCli
7
- from .upload import UploadCli
8
-
9
-
10
- def main():
11
-
12
- parser = ArgumentParser("clarifai")
13
- cmd_parser = parser.add_subparsers(help="Clarifai cli helpers")
14
-
15
- UploadCli.register(cmd_parser)
16
- CreateCli.register(cmd_parser)
17
- LoginCli.register(cmd_parser)
18
- ExampleCli.register(cmd_parser)
19
- BuildCli.register(cmd_parser)
20
-
21
- args = parser.parse_args()
22
-
23
- if not hasattr(args, "func"):
24
- parser.print_help()
25
- exit(1)
26
-
27
- # Run
28
- service = args.func(args)
29
- service.run()
30
-
31
-
32
- if __name__ == "__main__":
33
- main()
@@ -1,171 +0,0 @@
1
- import os
2
- import shutil
3
- from argparse import Namespace, _SubParsersAction
4
- from typing import List
5
-
6
- from InquirerPy import prompt
7
-
8
- from ..model_config import MODEL_TYPES
9
- from ..repo_build import RepositoryBuilder
10
- from ._utils import list_model_upload_examples
11
- from .base import BaseClarifaiCli
12
-
13
-
14
- class CreateCli(BaseClarifaiCli):
15
-
16
- @staticmethod
17
- def register(parser: _SubParsersAction):
18
- creator_parser = parser.add_parser("create", help="Create component of Clarifai platform")
19
- sub_creator_parser = creator_parser.add_subparsers()
20
-
21
- SubCreateModelCli.register(sub_creator_parser)
22
-
23
- creator_parser.set_defaults(func=CreateCli)
24
-
25
-
26
- class SubCreateModelCli(BaseClarifaiCli):
27
-
28
- @staticmethod
29
- def register(parser: _SubParsersAction):
30
- model_parser = parser.add_parser("model")
31
- model_parser.add_argument(
32
- "--working-dir",
33
- type=str,
34
- required=True,
35
- help="Path to your working dir. Create new dir if it does not exist")
36
- model_parser.add_argument(
37
- "--from-example",
38
- required=False,
39
- action="store_true",
40
- help="Create repository from example")
41
- model_parser.add_argument(
42
- "--example-id",
43
- required=False,
44
- type=str,
45
- help="Example id, run `clarifai example list` to list of examples")
46
-
47
- model_parser.add_argument(
48
- "--type",
49
- type=str,
50
- choices=MODEL_TYPES,
51
- required=False,
52
- help="Clarifai supported model types.")
53
- model_parser.add_argument(
54
- "--image-shape",
55
- nargs='+',
56
- type=int,
57
- required=False,
58
- help="H W dims for models with an image input type. H and W each have a max value of 1024",
59
- default=[-1, -1])
60
- model_parser.add_argument(
61
- "--max-bs", type=int, default=1, required=False, help="Max batch size")
62
-
63
- model_parser.add_argument(
64
- "--overwrite", action="store_true", help="Overwrite working-dir if exists")
65
-
66
- model_parser.set_defaults(func=SubCreateModelCli)
67
-
68
- def __init__(self, args: Namespace) -> None:
69
- self.working_dir: str = args.working_dir
70
- self.from_example = args.from_example
71
- self.example_id = args.example_id
72
- self.overwrite = args.overwrite
73
-
74
- if os.path.exists(self.working_dir):
75
- if self.overwrite:
76
- print(f"Overwrite {self.working_dir}")
77
- else:
78
- raise FileExistsError(
79
- f"{self.working_dir} exists. If you want to overwrite it, please set `--overwrite` flag"
80
- )
81
-
82
- # prevent wrong args when creating from example
83
- if not self.from_example:
84
- self.image_shape: List[int] = args.image_shape
85
-
86
- self.type: str = args.type
87
- self.max_bs: int = args.max_bs
88
-
89
- else:
90
- if not self.example_id:
91
- questions = [
92
- {
93
- "type": "list",
94
- "message": "Select an example:",
95
- "choices": list_model_upload_examples(),
96
- },
97
- ]
98
- result = prompt(questions)
99
- self.example_id = result[0]
100
-
101
- else:
102
- available_examples = list(list_model_upload_examples().keys())
103
- assert self.example_id in available_examples, f"Available examples are: {available_examples}, got {self.example_id}."
104
-
105
- def run(self):
106
- if self.from_example:
107
- os.makedirs(self.working_dir, exist_ok=True)
108
- model_repo, readme = list_model_upload_examples()[self.example_id]
109
- shutil.copytree(model_repo, self.working_dir, dirs_exist_ok=True)
110
- if readme:
111
- shutil.copy(readme, os.path.join(self.working_dir, "readme.md"))
112
-
113
- else:
114
- RepositoryBuilder.init_repository(
115
- self.type,
116
- self.working_dir,
117
- backend="triton",
118
- max_batch_size=self.max_bs,
119
- image_shape=self.image_shape)
120
-
121
- from itertools import islice
122
- from pathlib import Path
123
-
124
- def tree(dir_path: Path,
125
- level: int = -1,
126
- limit_to_directories: bool = False,
127
- length_limit: int = 1000):
128
- # prefix components:
129
- space = ' '
130
- branch = '│ '
131
- # pointers:
132
- tee = '├── '
133
- last = '└── '
134
- """Given a directory Path object print a visual tree structure"""
135
- dir_path = Path(dir_path) # accept string coerceable to Path
136
- files = 0
137
- directories = 0
138
-
139
- def inner(dir_path: Path, prefix: str = '', level=-1):
140
- nonlocal files, directories
141
- if not level:
142
- return # 0, stop iterating
143
- if limit_to_directories:
144
- contents = [d for d in dir_path.iterdir() if d.is_dir()]
145
- else:
146
- contents = list(dir_path.iterdir())
147
- pointers = [tee] * (len(contents) - 1) + [last]
148
- for pointer, path in zip(pointers, contents):
149
- if path.is_dir():
150
- yield prefix + pointer + path.name
151
- directories += 1
152
- extension = branch if pointer == tee else space
153
- yield from inner(path, prefix=prefix + extension, level=level - 1)
154
- elif not limit_to_directories:
155
- yield prefix + pointer + path.name
156
- files += 1
157
-
158
- print(dir_path.name)
159
- iterator = inner(dir_path, level=level)
160
- for line in islice(iterator, length_limit):
161
- print(line)
162
- if next(iterator, None):
163
- print(f'... length_limit, {length_limit}, reached, counted:')
164
- print(f'\n{directories} directories' + (f', {files} files' if files else ''))
165
-
166
- print("-" * 75)
167
- print(f"* Created repository at: {self.working_dir}")
168
- tree(self.working_dir)
169
- print()
170
- print("* Please make sure your code is tested using `test.py` before uploading")
171
- print("-" * 75)