Spaces:
Running
Running
Commit
·
eefdec4
1
Parent(s):
113f67d
add hf ckpt
Browse files- models/farslip_model.py +3 -0
models/farslip_model.py
CHANGED
|
@@ -6,6 +6,7 @@ import pandas as pd
|
|
| 6 |
import pyarrow.parquet as pq
|
| 7 |
import torch.nn.functional as F
|
| 8 |
from PIL import Image
|
|
|
|
| 9 |
|
| 10 |
try:
|
| 11 |
# FarSLIP must use its vendored open_clip fork (checkpoint format / model defs differ).
|
|
@@ -27,6 +28,8 @@ class FarSLIPModel:
|
|
| 27 |
|
| 28 |
self.device = device if device else ("cuda" if torch.cuda.is_available() else "cpu")
|
| 29 |
self.model_name = model_name
|
|
|
|
|
|
|
| 30 |
self.ckpt_path = ckpt_path
|
| 31 |
self.embedding_path = embedding_path
|
| 32 |
|
|
|
|
| 6 |
import pyarrow.parquet as pq
|
| 7 |
import torch.nn.functional as F
|
| 8 |
from PIL import Image
|
| 9 |
+
from huggingface_hub import hf_hub_download
|
| 10 |
|
| 11 |
try:
|
| 12 |
# FarSLIP must use its vendored open_clip fork (checkpoint format / model defs differ).
|
|
|
|
| 28 |
|
| 29 |
self.device = device if device else ("cuda" if torch.cuda.is_available() else "cpu")
|
| 30 |
self.model_name = model_name
|
| 31 |
+
if 'hf' in ckpt_path:
|
| 32 |
+
ckpt_path = hf_hub_download("ZhenShiL/FarSLIP", "FarSLIP2_ViT-B-16.pt")
|
| 33 |
self.ckpt_path = ckpt_path
|
| 34 |
self.embedding_path = embedding_path
|
| 35 |
|