mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-27 13:47:50 +02:00
Use HF_ENDPOINT env instead of hardcoding https://huggingface.co (#18036)
* Update jina_v1_embedding.py * Update jina_v2_embedding.py
This commit is contained in:
parent
895afcdb0e
commit
976863518b
@ -36,11 +36,12 @@ class JinaV1TextEmbedding(BaseEmbedding):
|
|||||||
requestor: InterProcessRequestor,
|
requestor: InterProcessRequestor,
|
||||||
device: str = "AUTO",
|
device: str = "AUTO",
|
||||||
):
|
):
|
||||||
|
HF_ENDPOINT = os.environ.get("HF_ENDPOINT", "https://huggingface.co")
|
||||||
super().__init__(
|
super().__init__(
|
||||||
model_name="jinaai/jina-clip-v1",
|
model_name="jinaai/jina-clip-v1",
|
||||||
model_file="text_model_fp16.onnx",
|
model_file="text_model_fp16.onnx",
|
||||||
download_urls={
|
download_urls={
|
||||||
"text_model_fp16.onnx": "https://huggingface.co/jinaai/jina-clip-v1/resolve/main/onnx/text_model_fp16.onnx",
|
"text_model_fp16.onnx": f"{HF_ENDPOINT}/jinaai/jina-clip-v1/resolve/main/onnx/text_model_fp16.onnx",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.tokenizer_file = "tokenizer"
|
self.tokenizer_file = "tokenizer"
|
||||||
@ -156,12 +157,13 @@ class JinaV1ImageEmbedding(BaseEmbedding):
|
|||||||
if model_size == "large"
|
if model_size == "large"
|
||||||
else "vision_model_quantized.onnx"
|
else "vision_model_quantized.onnx"
|
||||||
)
|
)
|
||||||
|
HF_ENDPOINT = os.environ.get("HF_ENDPOINT", "https://huggingface.co")
|
||||||
super().__init__(
|
super().__init__(
|
||||||
model_name="jinaai/jina-clip-v1",
|
model_name="jinaai/jina-clip-v1",
|
||||||
model_file=model_file,
|
model_file=model_file,
|
||||||
download_urls={
|
download_urls={
|
||||||
model_file: f"https://huggingface.co/jinaai/jina-clip-v1/resolve/main/onnx/{model_file}",
|
model_file: f"{HF_ENDPOINT}/jinaai/jina-clip-v1/resolve/main/onnx/{model_file}",
|
||||||
"preprocessor_config.json": "https://huggingface.co/jinaai/jina-clip-v1/resolve/main/preprocessor_config.json",
|
"preprocessor_config.json": f"{HF_ENDPOINT}/jinaai/jina-clip-v1/resolve/main/preprocessor_config.json",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.requestor = requestor
|
self.requestor = requestor
|
||||||
|
@ -34,12 +34,13 @@ class JinaV2Embedding(BaseEmbedding):
|
|||||||
model_file = (
|
model_file = (
|
||||||
"model_fp16.onnx" if model_size == "large" else "model_quantized.onnx"
|
"model_fp16.onnx" if model_size == "large" else "model_quantized.onnx"
|
||||||
)
|
)
|
||||||
|
HF_ENDPOINT = os.environ.get("HF_ENDPOINT", "https://huggingface.co")
|
||||||
super().__init__(
|
super().__init__(
|
||||||
model_name="jinaai/jina-clip-v2",
|
model_name="jinaai/jina-clip-v2",
|
||||||
model_file=model_file,
|
model_file=model_file,
|
||||||
download_urls={
|
download_urls={
|
||||||
model_file: f"https://huggingface.co/jinaai/jina-clip-v2/resolve/main/onnx/{model_file}",
|
model_file: f"{HF_ENDPOINT}/jinaai/jina-clip-v2/resolve/main/onnx/{model_file}",
|
||||||
"preprocessor_config.json": "https://huggingface.co/jinaai/jina-clip-v2/resolve/main/preprocessor_config.json",
|
"preprocessor_config.json": f"{HF_ENDPOINT}/jinaai/jina-clip-v2/resolve/main/preprocessor_config.json",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.tokenizer_file = "tokenizer"
|
self.tokenizer_file = "tokenizer"
|
||||||
|
Loading…
Reference in New Issue
Block a user