inference-models 0.18.3__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 (195) hide show
  1. inference_models/__init__.py +36 -0
  2. inference_models/configuration.py +72 -0
  3. inference_models/constants.py +2 -0
  4. inference_models/entities.py +5 -0
  5. inference_models/errors.py +137 -0
  6. inference_models/logger.py +52 -0
  7. inference_models/model_pipelines/__init__.py +0 -0
  8. inference_models/model_pipelines/auto_loaders/__init__.py +0 -0
  9. inference_models/model_pipelines/auto_loaders/core.py +120 -0
  10. inference_models/model_pipelines/auto_loaders/pipelines_registry.py +36 -0
  11. inference_models/model_pipelines/face_and_gaze_detection/__init__.py +0 -0
  12. inference_models/model_pipelines/face_and_gaze_detection/mediapipe_l2cs.py +200 -0
  13. inference_models/models/__init__.py +0 -0
  14. inference_models/models/auto_loaders/__init__.py +0 -0
  15. inference_models/models/auto_loaders/access_manager.py +168 -0
  16. inference_models/models/auto_loaders/auto_negotiation.py +1329 -0
  17. inference_models/models/auto_loaders/auto_resolution_cache.py +129 -0
  18. inference_models/models/auto_loaders/constants.py +7 -0
  19. inference_models/models/auto_loaders/core.py +1341 -0
  20. inference_models/models/auto_loaders/dependency_models.py +52 -0
  21. inference_models/models/auto_loaders/entities.py +57 -0
  22. inference_models/models/auto_loaders/models_registry.py +497 -0
  23. inference_models/models/auto_loaders/presentation_utils.py +333 -0
  24. inference_models/models/auto_loaders/ranking.py +413 -0
  25. inference_models/models/auto_loaders/utils.py +31 -0
  26. inference_models/models/base/__init__.py +0 -0
  27. inference_models/models/base/classification.py +123 -0
  28. inference_models/models/base/depth_estimation.py +62 -0
  29. inference_models/models/base/documents_parsing.py +111 -0
  30. inference_models/models/base/embeddings.py +66 -0
  31. inference_models/models/base/instance_segmentation.py +87 -0
  32. inference_models/models/base/keypoints_detection.py +93 -0
  33. inference_models/models/base/object_detection.py +143 -0
  34. inference_models/models/base/semantic_segmentation.py +74 -0
  35. inference_models/models/base/types.py +5 -0
  36. inference_models/models/clip/__init__.py +0 -0
  37. inference_models/models/clip/clip_onnx.py +148 -0
  38. inference_models/models/clip/clip_pytorch.py +104 -0
  39. inference_models/models/clip/preprocessing.py +162 -0
  40. inference_models/models/common/__init__.py +0 -0
  41. inference_models/models/common/cuda.py +30 -0
  42. inference_models/models/common/model_packages.py +25 -0
  43. inference_models/models/common/onnx.py +379 -0
  44. inference_models/models/common/roboflow/__init__.py +0 -0
  45. inference_models/models/common/roboflow/model_packages.py +361 -0
  46. inference_models/models/common/roboflow/post_processing.py +436 -0
  47. inference_models/models/common/roboflow/pre_processing.py +1332 -0
  48. inference_models/models/common/torch.py +20 -0
  49. inference_models/models/common/trt.py +266 -0
  50. inference_models/models/deep_lab_v3_plus/__init__.py +0 -0
  51. inference_models/models/deep_lab_v3_plus/deep_lab_v3_plus_segmentation_onnx.py +282 -0
  52. inference_models/models/deep_lab_v3_plus/deep_lab_v3_plus_segmentation_torch.py +264 -0
  53. inference_models/models/deep_lab_v3_plus/deep_lab_v3_plus_segmentation_trt.py +313 -0
  54. inference_models/models/depth_anything_v2/__init__.py +0 -0
  55. inference_models/models/depth_anything_v2/depth_anything_v2_hf.py +77 -0
  56. inference_models/models/dinov3/__init__.py +0 -0
  57. inference_models/models/dinov3/dinov3_classification_onnx.py +348 -0
  58. inference_models/models/dinov3/dinov3_classification_torch.py +323 -0
  59. inference_models/models/doctr/__init__.py +0 -0
  60. inference_models/models/doctr/doctr_torch.py +304 -0
  61. inference_models/models/easy_ocr/__init__.py +0 -0
  62. inference_models/models/easy_ocr/easy_ocr_torch.py +222 -0
  63. inference_models/models/florence2/__init__.py +0 -0
  64. inference_models/models/florence2/florence2_hf.py +897 -0
  65. inference_models/models/grounding_dino/__init__.py +0 -0
  66. inference_models/models/grounding_dino/grounding_dino_torch.py +227 -0
  67. inference_models/models/l2cs/__init__.py +0 -0
  68. inference_models/models/l2cs/l2cs_onnx.py +216 -0
  69. inference_models/models/mediapipe_face_detection/__init__.py +0 -0
  70. inference_models/models/mediapipe_face_detection/face_detection.py +203 -0
  71. inference_models/models/moondream2/__init__.py +0 -0
  72. inference_models/models/moondream2/moondream2_hf.py +281 -0
  73. inference_models/models/owlv2/__init__.py +0 -0
  74. inference_models/models/owlv2/cache.py +182 -0
  75. inference_models/models/owlv2/entities.py +112 -0
  76. inference_models/models/owlv2/owlv2_hf.py +695 -0
  77. inference_models/models/owlv2/reference_dataset.py +291 -0
  78. inference_models/models/paligemma/__init__.py +0 -0
  79. inference_models/models/paligemma/paligemma_hf.py +209 -0
  80. inference_models/models/perception_encoder/__init__.py +0 -0
  81. inference_models/models/perception_encoder/perception_encoder_pytorch.py +197 -0
  82. inference_models/models/perception_encoder/vision_encoder/__init__.py +0 -0
  83. inference_models/models/perception_encoder/vision_encoder/config.py +160 -0
  84. inference_models/models/perception_encoder/vision_encoder/pe.py +742 -0
  85. inference_models/models/perception_encoder/vision_encoder/rope.py +344 -0
  86. inference_models/models/perception_encoder/vision_encoder/tokenizer.py +342 -0
  87. inference_models/models/perception_encoder/vision_encoder/transforms.py +33 -0
  88. inference_models/models/qwen25vl/__init__.py +1 -0
  89. inference_models/models/qwen25vl/qwen25vl_hf.py +285 -0
  90. inference_models/models/resnet/__init__.py +0 -0
  91. inference_models/models/resnet/resnet_classification_onnx.py +330 -0
  92. inference_models/models/resnet/resnet_classification_torch.py +305 -0
  93. inference_models/models/resnet/resnet_classification_trt.py +369 -0
  94. inference_models/models/rfdetr/__init__.py +0 -0
  95. inference_models/models/rfdetr/backbone_builder.py +101 -0
  96. inference_models/models/rfdetr/class_remapping.py +41 -0
  97. inference_models/models/rfdetr/common.py +115 -0
  98. inference_models/models/rfdetr/default_labels.py +108 -0
  99. inference_models/models/rfdetr/dinov2_with_windowed_attn.py +1330 -0
  100. inference_models/models/rfdetr/misc.py +26 -0
  101. inference_models/models/rfdetr/ms_deform_attn.py +180 -0
  102. inference_models/models/rfdetr/ms_deform_attn_func.py +60 -0
  103. inference_models/models/rfdetr/position_encoding.py +166 -0
  104. inference_models/models/rfdetr/post_processor.py +83 -0
  105. inference_models/models/rfdetr/projector.py +373 -0
  106. inference_models/models/rfdetr/rfdetr_backbone_pytorch.py +394 -0
  107. inference_models/models/rfdetr/rfdetr_base_pytorch.py +807 -0
  108. inference_models/models/rfdetr/rfdetr_instance_segmentation_onnx.py +206 -0
  109. inference_models/models/rfdetr/rfdetr_instance_segmentation_pytorch.py +373 -0
  110. inference_models/models/rfdetr/rfdetr_instance_segmentation_trt.py +227 -0
  111. inference_models/models/rfdetr/rfdetr_object_detection_onnx.py +244 -0
  112. inference_models/models/rfdetr/rfdetr_object_detection_pytorch.py +470 -0
  113. inference_models/models/rfdetr/rfdetr_object_detection_trt.py +270 -0
  114. inference_models/models/rfdetr/segmentation_head.py +273 -0
  115. inference_models/models/rfdetr/transformer.py +767 -0
  116. inference_models/models/roboflow_instant/__init__.py +0 -0
  117. inference_models/models/roboflow_instant/roboflow_instant_hf.py +141 -0
  118. inference_models/models/sam/__init__.py +0 -0
  119. inference_models/models/sam/cache.py +147 -0
  120. inference_models/models/sam/entities.py +25 -0
  121. inference_models/models/sam/sam_torch.py +675 -0
  122. inference_models/models/sam2/__init__.py +0 -0
  123. inference_models/models/sam2/cache.py +162 -0
  124. inference_models/models/sam2/entities.py +43 -0
  125. inference_models/models/sam2/sam2_torch.py +905 -0
  126. inference_models/models/sam2_rt/__init__.py +0 -0
  127. inference_models/models/sam2_rt/sam2_pytorch.py +119 -0
  128. inference_models/models/smolvlm/__init__.py +0 -0
  129. inference_models/models/smolvlm/smolvlm_hf.py +245 -0
  130. inference_models/models/trocr/__init__.py +0 -0
  131. inference_models/models/trocr/trocr_hf.py +53 -0
  132. inference_models/models/vit/__init__.py +0 -0
  133. inference_models/models/vit/vit_classification_huggingface.py +319 -0
  134. inference_models/models/vit/vit_classification_onnx.py +326 -0
  135. inference_models/models/vit/vit_classification_trt.py +365 -0
  136. inference_models/models/yolact/__init__.py +1 -0
  137. inference_models/models/yolact/yolact_instance_segmentation_onnx.py +336 -0
  138. inference_models/models/yolact/yolact_instance_segmentation_trt.py +361 -0
  139. inference_models/models/yolo_world/__init__.py +1 -0
  140. inference_models/models/yolonas/__init__.py +0 -0
  141. inference_models/models/yolonas/nms.py +44 -0
  142. inference_models/models/yolonas/yolonas_object_detection_onnx.py +204 -0
  143. inference_models/models/yolonas/yolonas_object_detection_trt.py +230 -0
  144. inference_models/models/yolov10/__init__.py +0 -0
  145. inference_models/models/yolov10/yolov10_object_detection_onnx.py +187 -0
  146. inference_models/models/yolov10/yolov10_object_detection_trt.py +215 -0
  147. inference_models/models/yolov11/__init__.py +0 -0
  148. inference_models/models/yolov11/yolov11_onnx.py +28 -0
  149. inference_models/models/yolov11/yolov11_torch_script.py +25 -0
  150. inference_models/models/yolov11/yolov11_trt.py +21 -0
  151. inference_models/models/yolov12/__init__.py +0 -0
  152. inference_models/models/yolov12/yolov12_onnx.py +7 -0
  153. inference_models/models/yolov12/yolov12_torch_script.py +7 -0
  154. inference_models/models/yolov12/yolov12_trt.py +7 -0
  155. inference_models/models/yolov5/__init__.py +0 -0
  156. inference_models/models/yolov5/nms.py +99 -0
  157. inference_models/models/yolov5/yolov5_instance_segmentation_onnx.py +225 -0
  158. inference_models/models/yolov5/yolov5_instance_segmentation_trt.py +255 -0
  159. inference_models/models/yolov5/yolov5_object_detection_onnx.py +192 -0
  160. inference_models/models/yolov5/yolov5_object_detection_trt.py +218 -0
  161. inference_models/models/yolov7/__init__.py +0 -0
  162. inference_models/models/yolov7/yolov7_instance_segmentation_onnx.py +226 -0
  163. inference_models/models/yolov7/yolov7_instance_segmentation_trt.py +253 -0
  164. inference_models/models/yolov8/__init__.py +0 -0
  165. inference_models/models/yolov8/yolov8_classification_onnx.py +181 -0
  166. inference_models/models/yolov8/yolov8_instance_segmentation_onnx.py +239 -0
  167. inference_models/models/yolov8/yolov8_instance_segmentation_torch_script.py +201 -0
  168. inference_models/models/yolov8/yolov8_instance_segmentation_trt.py +268 -0
  169. inference_models/models/yolov8/yolov8_key_points_detection_onnx.py +263 -0
  170. inference_models/models/yolov8/yolov8_key_points_detection_torch_script.py +218 -0
  171. inference_models/models/yolov8/yolov8_key_points_detection_trt.py +287 -0
  172. inference_models/models/yolov8/yolov8_object_detection_onnx.py +213 -0
  173. inference_models/models/yolov8/yolov8_object_detection_torch_script.py +166 -0
  174. inference_models/models/yolov8/yolov8_object_detection_trt.py +231 -0
  175. inference_models/models/yolov9/__init__.py +0 -0
  176. inference_models/models/yolov9/yolov9_onnx.py +7 -0
  177. inference_models/models/yolov9/yolov9_torch_script.py +7 -0
  178. inference_models/models/yolov9/yolov9_trt.py +7 -0
  179. inference_models/runtime_introspection/__init__.py +0 -0
  180. inference_models/runtime_introspection/core.py +410 -0
  181. inference_models/utils/__init__.py +0 -0
  182. inference_models/utils/download.py +608 -0
  183. inference_models/utils/environment.py +28 -0
  184. inference_models/utils/file_system.py +51 -0
  185. inference_models/utils/hashing.py +7 -0
  186. inference_models/utils/imports.py +48 -0
  187. inference_models/utils/onnx_introspection.py +17 -0
  188. inference_models/weights_providers/__init__.py +0 -0
  189. inference_models/weights_providers/core.py +20 -0
  190. inference_models/weights_providers/entities.py +159 -0
  191. inference_models/weights_providers/roboflow.py +601 -0
  192. inference_models-0.18.3.dist-info/METADATA +466 -0
  193. inference_models-0.18.3.dist-info/RECORD +195 -0
  194. inference_models-0.18.3.dist-info/WHEEL +5 -0
  195. inference_models-0.18.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,466 @@
1
+ Metadata-Version: 2.4
2
+ Name: inference-models
3
+ Version: 0.18.3
4
+ Summary: The new inference engine for Computer Vision models
5
+ Requires-Python: <3.13,>=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: numpy
8
+ Requires-Dist: torch<3.0.0,>=2.0.0
9
+ Requires-Dist: torchvision
10
+ Requires-Dist: opencv-python>=4.8.1.78
11
+ Requires-Dist: requests<3.0.0,>=2.32.0
12
+ Requires-Dist: supervision>=0.26.0
13
+ Requires-Dist: backoff~=2.2.0
14
+ Requires-Dist: transformers<5.0.0,>=4.56.0
15
+ Requires-Dist: timm<2.0.0,>=1.0.0
16
+ Requires-Dist: accelerate<2.0.0,>=1.0.0
17
+ Requires-Dist: einops<1.0.0,>=0.7.0
18
+ Requires-Dist: peft<0.18.0,>=0.11.1
19
+ Requires-Dist: num2words~=0.5.14
20
+ Requires-Dist: bitsandbytes<0.48.0,>=0.42.0; sys_platform != "darwin"
21
+ Requires-Dist: pyvips<3.0.0,>=2.2.3
22
+ Requires-Dist: rf-clip==1.1
23
+ Requires-Dist: python-doctr[torch]<=0.11.0,>=0.10.0
24
+ Requires-Dist: packaging>=24.0.0
25
+ Requires-Dist: rich<15.0.0,>=13.0.0
26
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
27
+ Requires-Dist: filelock<4.0.0,>=3.12.0
28
+ Requires-Dist: rich<15.0.0,>=14.1.0
29
+ Requires-Dist: segmentation-models-pytorch<1.0.0,>=0.5.0
30
+ Requires-Dist: scikit-image<0.26.0,>=0.24.0
31
+ Requires-Dist: easyocr~=1.7.2
32
+ Requires-Dist: sentencepiece<0.3.0,>=0.2.0
33
+ Requires-Dist: rf_groundingdino==0.3.0
34
+ Requires-Dist: tldextract~=5.1.2
35
+ Requires-Dist: pybase64~=1.0.0
36
+ Requires-Dist: rf-segment-anything==1.0
37
+ Requires-Dist: rf-sam-2==1.0.2
38
+ Requires-Dist: argon2-cffi<26.0.0,>=25.1.0
39
+ Provides-Extra: torch-cpu
40
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "torch-cpu"
41
+ Requires-Dist: torchvision; extra == "torch-cpu"
42
+ Provides-Extra: torch-cu118
43
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "torch-cu118"
44
+ Requires-Dist: torchvision; extra == "torch-cu118"
45
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; (platform_system != "darwin" and python_version >= "3.10") and extra == "torch-cu118"
46
+ Provides-Extra: torch-cu124
47
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "torch-cu124"
48
+ Requires-Dist: torchvision; extra == "torch-cu124"
49
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; (platform_system != "darwin" and python_version >= "3.10") and extra == "torch-cu124"
50
+ Provides-Extra: torch-cu126
51
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "torch-cu126"
52
+ Requires-Dist: torchvision; extra == "torch-cu126"
53
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; (platform_system != "darwin" and python_version >= "3.10") and extra == "torch-cu126"
54
+ Provides-Extra: torch-cu128
55
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "torch-cu128"
56
+ Requires-Dist: torchvision; extra == "torch-cu128"
57
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; (platform_system != "darwin" and python_version >= "3.10") and extra == "torch-cu128"
58
+ Provides-Extra: torch-jp6-cu126
59
+ Requires-Dist: numpy<2.0.0; extra == "torch-jp6-cu126"
60
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "torch-jp6-cu126"
61
+ Requires-Dist: torchvision; extra == "torch-jp6-cu126"
62
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; extra == "torch-jp6-cu126"
63
+ Provides-Extra: onnx-cpu
64
+ Requires-Dist: onnxruntime<1.23.0,>=1.15.1; extra == "onnx-cpu"
65
+ Provides-Extra: onnx-cu118
66
+ Requires-Dist: onnxruntime-gpu<1.23.0,>=1.15.1; platform_system != "darwin" and extra == "onnx-cu118"
67
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; platform_system != "darwin" and extra == "onnx-cu118"
68
+ Provides-Extra: onnx-cu12
69
+ Requires-Dist: onnxruntime-gpu<1.23.0,>=1.17.0; platform_system != "darwin" and extra == "onnx-cu12"
70
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; platform_system != "darwin" and extra == "onnx-cu12"
71
+ Provides-Extra: onnx-jp6-cu126
72
+ Requires-Dist: numpy<2.0.0; (platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.10") and extra == "onnx-jp6-cu126"
73
+ Requires-Dist: onnxruntime-gpu<1.24.0,>=1.17.0; (platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.10") and extra == "onnx-jp6-cu126"
74
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; (platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.10") and extra == "onnx-jp6-cu126"
75
+ Provides-Extra: mediapipe
76
+ Requires-Dist: rf-mediapipe<0.11.0,>=0.9; extra == "mediapipe"
77
+ Provides-Extra: trt10
78
+ Requires-Dist: tensorrt-cu12<11.0.0,>=10.0.0; (platform_system == "Linux" or platform_system == "Windows") and extra == "trt10"
79
+ Requires-Dist: tensorrt-lean-cu12<11.0.0,>=10.0.0; (platform_system == "Linux" or platform_system == "Windows") and extra == "trt10"
80
+ Requires-Dist: pycuda<2026.0.0,>=2025.0.0; (platform_system != "darwin" and python_version >= "3.10") and extra == "trt10"
81
+ Provides-Extra: test
82
+ Requires-Dist: pytest>=8.0.0; extra == "test"
83
+ Requires-Dist: pytest-timeout==2.4.0; extra == "test"
84
+ Requires-Dist: pytest-xdist>=3.0.0; extra == "test"
85
+ Requires-Dist: pytest-timeout; extra == "test"
86
+ Requires-Dist: requests-mock>=1.12.1; extra == "test"
87
+
88
+ # Experimental version of inference
89
+
90
+ ## 🚀 Introducing `inference-models` - the evolution of `inference`
91
+
92
+ At Roboflow, we’re taking a bold step toward a new generation of `inference` — designed to be faster,
93
+ more reliable, and more user-friendly. With this vision in mind, we’re building a new library called `inference-models`.
94
+
95
+ This is an early-stage project, and we’re sharing initial versions to gather valuable community feedback.
96
+ Your input will help us shape and steer this initiative in the right direction.
97
+
98
+ We’re excited to have you join us on this journey — let’s build something great together! 🤝
99
+
100
+ > [!CAUTION]
101
+ > The `inference-models` package **is an experimental preview** of upcoming inference capabilities.
102
+ > * Features may change, break, or be removed without notice.
103
+ > * We **do not guarantee backward compatibility** between releases.
104
+ >
105
+ > ❗ **We strongly advise against** using `inference-models` in production systems - for such purposes
106
+ > please **continue to use the stable `inference` package.**
107
+
108
+ ## ⚡ Installation
109
+
110
+ > [!TIP]
111
+ > We recommend using `uv` to install `inference-models`. To install the tool, follow
112
+ > [official guide](https://docs.astral.sh/uv/getting-started/installation/) or use the snippet below:
113
+ > ```bash
114
+ > curl -LsSf https://astral.sh/uv/install.sh | sh
115
+ > ```
116
+
117
+ Use the following command to install `inference-models` on **CPU machine 💻** (below you can find more advanced options):
118
+
119
+ ```bash
120
+ uv pip install inference-models
121
+ # or - if you use pip
122
+ pip install inference-models
123
+ ```
124
+
125
+ <details>
126
+ <summary>👉 GPU installation</summary>
127
+
128
+ As you may learn from [📜 Principles and Assumptions](#-principles-and-assumptions), `inference-models` is designed to
129
+ compose the build out of different [extras](#-extra-dependencies) defined for the package. Some extras bring new
130
+ models, while others - ability to run models created for specific backend. To get the most out of the installation
131
+ on GPU machine, we recommend including TRT and ONNX extensions, as well as select `torch-cu*` extras to install
132
+ torch compliant with version of CUDA installed on the machine. ONNX backend is particularly important when running
133
+ models trained on Roboflow platform.
134
+
135
+ ```bash
136
+ uv pip install "inference-models[torch-cu128,onnx-cu12,trt10]" "tensorrt==10.12.0.36"
137
+ # or - if you use pip
138
+ pip install "inference-models[torch-cu128,onnx-cu12,trt10]" "tensorrt==10.12.0.36"
139
+ ```
140
+
141
+ > To avoid clashes with external packages, `pyproject.toml` defines quite loose restrictions for the dependent packages.
142
+ > Some packages, like `tensorrt` are good to be kept under more strict control (as some TRT engines will only work
143
+ > when there is an exact match of environment that runs the model with the one that compiled it) - that's why we
144
+ > recommend fixing `tensorrt` version to the one we currently use to compile TRT artefacts.
145
+ >
146
+ > Additionally, library defines set of `torch-*` extras which, thanks to `uv` deliver extra packages indexes adjusted
147
+ > for specific CUDA version: `torch-cu118`, `torch-cu124`, `torch-cu126`, `torch-cu128`, `torch-jp6-cu126`.
148
+
149
+ </details>
150
+
151
+ <details>
152
+ <summary>👉 CPU installation - enabling <b>models trained with Roboflow</b></summary>
153
+
154
+ For CPU installations, we recommend installing ONNX backed, as the majority of models trained on Roboflow platform
155
+ are exported to ONNX and not available:
156
+ ```bash
157
+ # to install with ONNX backend
158
+ uv pip install "inference-models[onnx-cpu]"
159
+ # or - to install only base dependencies
160
+ uv pip install inference-models
161
+ ```
162
+
163
+ </details>
164
+
165
+
166
+ <details>
167
+ <summary>👉 Reproducibility of installation</summary>
168
+
169
+ > Using `uv pip install ...` or `pip install`, it is possible to get non-reproducible builds (as `pyproject.toml`
170
+ > defines quite loose restrictions for the dependent packages). If you care about strict control of dependencies -
171
+ > follow the installation method based on `uv.lock` which is demonstrated in official [docker builds](./dockerfiles)
172
+ > of the library.
173
+
174
+ </details>
175
+
176
+
177
+ ## 📖 Basic Usage
178
+
179
+ ```python
180
+ from inference_models import AutoModel
181
+ import cv2
182
+ import supervision as sv
183
+
184
+ # loads model from Roboflow API (loading from local dir also available)
185
+ model = AutoModel.from_pretrained("rfdetr-base")
186
+ image = cv2.imread("<path-to-your-image>")
187
+ predictions = model(image)
188
+
189
+ # integration with supervision
190
+ annotator = sv.BoxAnnotator()
191
+ annotated = annotator.annotate(image.copy(), predictions[0].to_supervision())
192
+ ```
193
+
194
+ > [!TIP]
195
+ > Model **failed to load,** and you see error prompting you to **install additional dependencies**?
196
+ >
197
+ > Take a look at [📜 Principles and Assumptions](#-principles-and-assumptions) to understand why this happens and
198
+ > navigate to [extras](#-extra-dependencies) section to find out which extra dependency you need to install.
199
+ > The common issue is lack of ONNX backend required to run models trained on Roboflow platform.
200
+
201
+
202
+ ## 📜 Principles and Assumptions
203
+
204
+ * We define a **model** as weights trained on a dataset, which can be exported or compiled into multiple equivalent
205
+ **model packages**, each optimized for specific environments (e.g., speed, flexibility).
206
+
207
+ * The new inference library is **multi-backend**, able to run model packages in different formats
208
+ depending on the installed dependencies - with the scope of supported models dependent on the choice of package
209
+ *extras* made during installation
210
+
211
+ * We aim to keep the **extra dependencies minimal** while covering as broad a range of models as possible.
212
+
213
+ * By default, we include **PyTorch** and **Hugging Face Transformers**; optional extras are available for
214
+ **TensorRT (TRT)** and **ONNX** backends, with a runtime preference order: TRT → Torch → ONNX. We wish new models
215
+ are mostly based on Torch.
216
+
217
+ * Backend selection happens **dynamically at runtime**, based on model metadata and environment checks,
218
+ but can be fully overridden by the user when needed.
219
+
220
+
221
+ ## 🔌 Extra Dependencies
222
+
223
+ Extras dependencies are optional features of the package that can be installed with:
224
+
225
+ ```bash
226
+ uv pip install "inference-models[extras-name-1,extras-name-1]"
227
+ # or - if you use pip
228
+ pip install "inference-models[extras-name-1,extras-name-2]"
229
+ ```
230
+
231
+ In case of `inference-models`, extras bring either additional **backends** (dependencies to run AI models of different type,
232
+ like TensorRT engines) or additional **models**.
233
+
234
+ ### Backends
235
+ | Extras names | Backend | Description |
236
+ |-------------------------------------------------------------------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
237
+ | `torch-cu118`, `torch-cu124`, `torch-cu126`, `torch-cu128`, `torch-jp6-cu126` | PyTorch | Provide specific variants of `torch` to match installed CUDA version, only works with `uv` which is capable of reading extra indexes from `pyproject.toml`, when using with `pip`, use `--extra-index-url`. By default, CPU version of `torch` is installed with the library. Torch backend is a default one for the library. Extras named `torch-cu*` are relevant for GPU servers with certain CUDA version, whereas extras like `torch-jp6-cu126` are to be installed on Jetson with specific Jetpack and CUDA versions. |
238
+ | `onnx-cpu`, `onnx-cu118`, `onnx-cu12`, `onnx-jp6-cu126` | ONNX | Provide specific variants of `onnxruntime`. only works with `uv` which is capable of reading extra indexes from `pyproject.toml`, when using with `pip`, use `--extra-index-url`. This extras is not installed by default and is not required, but enables wide variety of models trained on Roboflow Platform. Extras named `onnx-cu*` are relevant for GPU servers with certain CUDA version, whereas extras like `onnx-jp6-cu126` are to be installed on Jetson with specific Jetpack and CUDA versions. |
239
+ | `trt10` | TRT | Provide specific variants of `tensorrt`, only works on GPU servers. Jetson installations should fall back to pre-compiled package shipped with Jetpack. |
240
+
241
+
242
+ ### Additional models / capabilities
243
+ | Extras | Description |
244
+ |------------------|----------------------------------------------------------------------------------------------------|
245
+ | `mediapipe` | Enables MediaPipe models, including Face Detector |
246
+ | `grounding-dino` | Enables Grounding Dino model |
247
+ | `flash-attn` | *EXPERIMENTAL:* Installs `flash-attn` for faster LLMs/VLMs - usually requires extensive compilation |
248
+ | `test` | Test dependencies |
249
+
250
+ #### Special Installation: SAM2 Real-Time
251
+
252
+ `sam2 real time` requires a Git-based dependency that cannot be distributed via PyPI. To use SAM2 real-time capabilities, you need to manually install it after installing `inference-models`:
253
+
254
+ ```bash
255
+ # First, install inference-models with your desired extras (e.g., torch-cu124)
256
+ pip install "inference-models[torch-cu124]"
257
+
258
+ # Then, install SAM2 real-time from GitHub
259
+ pip install git+https://github.com/Gy920/segment-anything-2-real-time.git
260
+ ```
261
+
262
+ For development environments:
263
+ ```bash
264
+ # First sync the project
265
+ uv sync --dev
266
+
267
+ # Then manually install SAM 2 from the GitHub repository
268
+ # Note: The package installs as "SAM 2" (with a space)
269
+ uv pip install git+https://github.com/Gy920/segment-anything-2-real-time.git
270
+ ```
271
+
272
+ > [!NOTE]
273
+ > Due to PyPI restrictions on Git dependencies, the SAM2 real-time package must be installed separately from the GitHub repository. The package will be installed with the name "SAM 2" (with a space).
274
+
275
+ > [!IMPORTANT]
276
+ > Not all extras are possible to be installed together in a single environment. We try to make the extras as composable
277
+ > as possible, but **this will not always be possible**, and sometimes you need to choose which extras are to be
278
+ > installed.
279
+
280
+
281
+ ## 🧠 Models
282
+
283
+ > [!IMPORTANT]
284
+ > If you see a bug in model implementation or loading mechanism - create
285
+ > [new issue](https://github.com/roboflow/inference/issues/) tagging it with `inference-models-bug`.
286
+ >
287
+ > Additionally, We are working hard to extend pool of supported models - suggestions on new models to be added
288
+ > appreciated 🤝
289
+
290
+
291
+ Below there is a table showcasing models that are supported, with the hints regarding extra dependencies that
292
+ are required.
293
+
294
+ | Architecture | Task Type | Supported backends |
295
+ |--------------------|-------------------------|--------------------|
296
+ | RFDetr | `object-detection` | `trt`, `torch` |
297
+ | YOLO v8 | `object-detection` | `onnx`, `trt` |
298
+ | YOLO v8 | `instance-segmentation` | `onnx`, `trt` |
299
+ | YOLO v9 | `object-detection` | `onnx`, `trt` |
300
+ | YOLO v10 | `object-detection` | `onnx`, `trt` |
301
+ | YOLO v11 | `object-detection` | `onnx`, `trt` |
302
+ | YOLO v11 | `instance-segmentation` | `onnx`, `trt` |
303
+ | Perception Encoder | `embedding` | `torch` |
304
+ | CLIP | `embedding` | `torch`, `onnx` |
305
+
306
+
307
+ ### Registered pre-trained weights
308
+
309
+ Below you can find a list of model IDs registered in Roboflow weights provider (along with notes about access rights).
310
+
311
+ * `public-open` - available without Roboflow API key, but under licenses for specific model
312
+
313
+ * `public-api-key-gated` - available for everyone with Roboflow API key
314
+
315
+ **Models:**
316
+
317
+ <details>
318
+ <summary>👉 <b>RFDetr</b></summary>
319
+
320
+ **Access level:** `public-open`
321
+
322
+ **License:** [Apache 2.0](inference_models/models/rfdetr/LICENSE.txt)
323
+
324
+ The following model IDs are registered:
325
+
326
+ * `rfdetr-base` (trained on COCO dataset)
327
+
328
+ * `rfdetr-base` (trained on COCO dataset)
329
+
330
+ </details>
331
+
332
+ <details>
333
+ <summary>👉 <b>YOLO v8</b></summary>
334
+
335
+ **Access level:** `public-open`
336
+
337
+ **License:** [AGPL](inference_models/models/yolov8/LICENSE.txt)
338
+
339
+ The following model IDs are registered for **object detection** task:
340
+
341
+ * `yolov8n-640` (trained on COCO dataset)
342
+
343
+ * `yolov8n-1280` (trained on COCO dataset)
344
+
345
+ * `yolov8s-640` (trained on COCO dataset)
346
+
347
+ * `yolov8s-1280` (trained on COCO dataset)
348
+
349
+ * `yolov8m-640` (trained on COCO dataset)
350
+
351
+ * `yolov8m-1280` (trained on COCO dataset)
352
+
353
+ * `yolov8l-640` (trained on COCO dataset)
354
+
355
+ * `yolov8l-1280` (trained on COCO dataset)
356
+
357
+ * `yolov8x-640` (trained on COCO dataset)
358
+
359
+ * `yolov8x-1280` (trained on COCO dataset)
360
+
361
+
362
+ The following model IDs are registered for **instance segmentation** task:
363
+
364
+ * `yolov8n-seg-640` (trained on COCO dataset)
365
+
366
+ * `yolov8n-seg-1280` (trained on COCO dataset)
367
+
368
+ * `yolov8s-seg-640` (trained on COCO dataset)
369
+
370
+ * `yolov8s-seg-1280` (trained on COCO dataset)
371
+
372
+ * `yolov8m-seg-640` (trained on COCO dataset)
373
+
374
+ * `yolov8m-seg-1280` (trained on COCO dataset)
375
+
376
+ * `yolov8l-seg-640` (trained on COCO dataset)
377
+
378
+ * `yolov8l-seg-1280` (trained on COCO dataset)
379
+
380
+ * `yolov8x-seg-640` (trained on COCO dataset)
381
+
382
+ * `yolov8x-seg-1280` (trained on COCO dataset)
383
+
384
+ </details>
385
+
386
+
387
+ <details>
388
+ <summary>👉 <b>YOLO v10</b></summary>
389
+
390
+ **Access level:** `public-open`
391
+
392
+ **License:** [AGPL](inference_models/models/yolov10/LICENSE.txt)
393
+
394
+ The following model IDs are registered for **object detection** task:
395
+
396
+ * `yolov10n-640` (trained on COCO dataset)
397
+
398
+ * `yolov10s-640` (trained on COCO dataset)
399
+
400
+ * `yolov10m-640` (trained on COCO dataset)
401
+
402
+ * `yolov10b-640` (trained on COCO dataset)
403
+
404
+ * `yolov10l-640` (trained on COCO dataset)
405
+
406
+ * `yolov10x-640` (trained on COCO dataset)
407
+
408
+ </details>
409
+
410
+
411
+ <details>
412
+ <summary>👉 <b>Perception Encoder</b></summary>
413
+
414
+ **Access level:** `public-open`
415
+
416
+ **License:** [FAIR Noncommercial Research License](inference_models/models/perception_encoder/vision_encoder/LICENSE.weigths.txt)
417
+
418
+ The following model IDs are registered:
419
+
420
+ * `perception-encoder/PE-Core-B16-224`
421
+
422
+ * `perception-encoder/PE-Core-G14-448`
423
+
424
+ * `perception-encoder/PE-Core-L14-336`
425
+
426
+ </details>
427
+
428
+ <details>
429
+ <summary>👉 <b>CLIP</b></summary>
430
+
431
+ **Access level:** `public-open`
432
+
433
+ **License:** [MIT](inference_models/models/clip/LICENSE.txt)
434
+
435
+ The following model IDs are registered:
436
+
437
+ * `clip/RN50`
438
+
439
+ * `clip/RN101`
440
+
441
+ * `clip/RN50x16`
442
+
443
+ * `clip/RN50x4`
444
+
445
+ * `clip/RN50x64`
446
+
447
+ * `clip/ViT-B-16`
448
+
449
+ * `clip/ViT-B-32`
450
+
451
+ * `clip/ViT-L-14-336px`
452
+
453
+ * `clip/ViT-L-14`
454
+
455
+ </details>
456
+
457
+ ## 📜 Citations
458
+
459
+ ```
460
+ @article{bolya2025PerceptionEncoder,
461
+ title={Perception Encoder: The best visual embeddings are not at the output of the network},
462
+ author={Daniel Bolya and Po-Yao Huang and Peize Sun and Jang Hyun Cho and Andrea Madotto and Chen Wei and Tengyu Ma and Jiale Zhi and Jathushan Rajasegaran and Hanoona Rasheed and Junke Wang and Marco Monteiro and Hu Xu and Shiyu Dong and Nikhila Ravi and Daniel Li and Piotr Doll{\'a}r and Christoph Feichtenhofer},
463
+ journal={arXiv:2504.13181},
464
+ year={2025}
465
+ }
466
+ ```