Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
638ed9d
1
Parent(s):
c2cd706
Add force_download param to model pipeline loader for manual cache refresh
Browse files- models/loader.py +3 -1
models/loader.py
CHANGED
@@ -19,11 +19,12 @@ torch.set_num_threads(NUM_THREADS)
|
|
19 |
# Clé: ID du modèle (provenant de la DB), Valeur: Pipeline/Modèle chargé
|
20 |
model_pipelines: Dict[Any, Any] = {}
|
21 |
|
22 |
-
async def _load_single_model_pipeline(model_data: Dict[str, Any]) -> Any:
|
23 |
"""Charge un seul pipeline de modèle à partir de ses données.
|
24 |
|
25 |
Args:
|
26 |
model_data: Dictionnaire contenant les informations du modèle (hf_repo_id, etc.).
|
|
|
27 |
|
28 |
Returns:
|
29 |
Le pipeline/modèle chargé.
|
@@ -44,6 +45,7 @@ async def _load_single_model_pipeline(model_data: Dict[str, Any]) -> Any:
|
|
44 |
subfolder=subfolder,
|
45 |
filename=model_name,
|
46 |
token=HF_TOKEN, # Assurez-vous que HF_TOKEN est géré correctement
|
|
|
47 |
)
|
48 |
|
49 |
logger.debug(f"Model weights downloaded to: {model_weight_path}")
|
|
|
19 |
# Clé: ID du modèle (provenant de la DB), Valeur: Pipeline/Modèle chargé
|
20 |
model_pipelines: Dict[Any, Any] = {}
|
21 |
|
22 |
+
async def _load_single_model_pipeline(model_data: Dict[str, Any], force_download: bool = False) -> Any:
|
23 |
"""Charge un seul pipeline de modèle à partir de ses données.
|
24 |
|
25 |
Args:
|
26 |
model_data: Dictionnaire contenant les informations du modèle (hf_repo_id, etc.).
|
27 |
+
force_download: Si True, force le re-téléchargement depuis Hugging Face Hub.
|
28 |
|
29 |
Returns:
|
30 |
Le pipeline/modèle chargé.
|
|
|
45 |
subfolder=subfolder,
|
46 |
filename=model_name,
|
47 |
token=HF_TOKEN, # Assurez-vous que HF_TOKEN est géré correctement
|
48 |
+
force_download=force_download # Utiliser le paramètre force_download
|
49 |
)
|
50 |
|
51 |
logger.debug(f"Model weights downloaded to: {model_weight_path}")
|