fix: download repo using snapshot_download
Browse files- models/siglip_model.py +2 -2
models/siglip_model.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import torch
|
| 2 |
import open_clip
|
| 3 |
from open_clip.tokenizer import HFTokenizer
|
| 4 |
-
from huggingface_hub import hf_hub_download
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
import pyarrow.parquet as pq
|
|
@@ -39,7 +39,7 @@ class SigLIPModel:
|
|
| 39 |
if not os.path.exists(self.ckpt_path):
|
| 40 |
print(f"Warning: Checkpoint not found at {self.ckpt_path}")
|
| 41 |
|
| 42 |
-
self.tokenizer = HFTokenizer(
|
| 43 |
|
| 44 |
self.ckpt_path = hf_hub_download("timm/ViT-SO400M-14-SigLIP-384", "open_clip_pytorch_model.bin")
|
| 45 |
self.model, _, self.preprocess = open_clip.create_model_and_transforms(
|
|
|
|
| 1 |
import torch
|
| 2 |
import open_clip
|
| 3 |
from open_clip.tokenizer import HFTokenizer
|
| 4 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
import pyarrow.parquet as pq
|
|
|
|
| 39 |
if not os.path.exists(self.ckpt_path):
|
| 40 |
print(f"Warning: Checkpoint not found at {self.ckpt_path}")
|
| 41 |
|
| 42 |
+
self.tokenizer = HFTokenizer(snapshot_download(repo_id="timm/ViT-SO400M-14-SigLIP-384"))
|
| 43 |
|
| 44 |
self.ckpt_path = hf_hub_download("timm/ViT-SO400M-14-SigLIP-384", "open_clip_pytorch_model.bin")
|
| 45 |
self.model, _, self.preprocess = open_clip.create_model_and_transforms(
|