|
29 | 29 | },
|
30 | 30 | "model_file": "model.onnx",
|
31 | 31 | },
|
| 32 | + { |
| 33 | + "model": "Qdrant/Unicom-ViT-B-16", |
| 34 | + "dim": 768, |
| 35 | + "description": "Unicom Unicom-ViT-B-16 from open-metric-learning", |
| 36 | + "size_in_GB": 0.82, |
| 37 | + "sources": { |
| 38 | + "hf": "Qdrant/Unicom-ViT-B-16", |
| 39 | + }, |
| 40 | + "model_file": "model.onnx", |
| 41 | + }, |
| 42 | + { |
| 43 | + "model": "Qdrant/Unicom-ViT-B-32", |
| 44 | + "dim": 512, |
| 45 | + "description": "Unicom Unicom-ViT-B-32 from open-metric-learning", |
| 46 | + "size_in_GB": 0.48, |
| 47 | + "sources": { |
| 48 | + "hf": "Qdrant/Unicom-ViT-B-32", |
| 49 | + }, |
| 50 | + "model_file": "model.onnx", |
| 51 | + }, |
32 | 52 | ]
|
33 | 53 |
|
34 |
| - |
35 | 54 | class OnnxImageEmbedding(ImageEmbeddingBase, OnnxImageModel[np.ndarray]):
|
36 | 55 | def __init__(
|
37 | 56 | self,
|
@@ -122,10 +141,16 @@ def _preprocess_onnx_input(
|
122 | 141 |
|
123 | 142 | return onnx_input
|
124 | 143 |
|
125 |
| - def _post_process_onnx_output(self, output: OnnxOutputContext) -> Iterable[np.ndarray]: |
| 144 | + def _post_process_onnx_output( |
| 145 | + self, output: OnnxOutputContext |
| 146 | + ) -> Iterable[np.ndarray]: |
126 | 147 | return normalize(output.model_output).astype(np.float32)
|
127 | 148 |
|
128 | 149 |
|
129 | 150 | class OnnxImageEmbeddingWorker(ImageEmbeddingWorker):
|
130 |
| - def init_embedding(self, model_name: str, cache_dir: str, **kwargs) -> OnnxImageEmbedding: |
131 |
| - return OnnxImageEmbedding(model_name=model_name, cache_dir=cache_dir, threads=1, **kwargs) |
| 151 | + def init_embedding( |
| 152 | + self, model_name: str, cache_dir: str, **kwargs |
| 153 | + ) -> OnnxImageEmbedding: |
| 154 | + return OnnxImageEmbedding( |
| 155 | + model_name=model_name, cache_dir=cache_dir, threads=1, **kwargs |
| 156 | + ) |
0 commit comments