DurgaDeepak commited on
Commit
84fb7e3
·
verified ·
1 Parent(s): 27e0318

Update utils/model_downloader.py

Browse files
Files changed (1) hide show
  1. utils/model_downloader.py +5 -5
utils/model_downloader.py CHANGED
@@ -41,17 +41,17 @@ def download_model_if_needed(model_key: str, save_path: str):
41
  ValueError: If the model_key is not supported.
42
  """
43
  if model_key not in HF_MODELS:
44
- logger.error(f" Model key '{model_key}' not found in registry.")
45
  raise ValueError(f"Unsupported model key: {model_key}")
46
 
47
  repo_id, filename = HF_MODELS[model_key]
48
 
49
  if os.path.exists(save_path):
50
- logger.info(f" Model '{model_key}' already exists at '{save_path}'. Skipping download.")
51
  return
52
 
53
  os.makedirs(os.path.dirname(save_path), exist_ok=True)
54
- logger.info(f"⬇️ Downloading '{model_key}' from Hugging Face Hub...")
55
 
56
  try:
57
  hf_hub_download(
@@ -60,7 +60,7 @@ def download_model_if_needed(model_key: str, save_path: str):
60
  cache_dir=os.path.dirname(save_path),
61
  force_download=True # Set to False later if you want to cache
62
  )
63
- logger.info(f" Successfully downloaded '{model_key}' to '{save_path}'")
64
  except Exception as e:
65
- logger.error(f" Download failed for '{model_key}': {e}")
66
  raise
 
41
  ValueError: If the model_key is not supported.
42
  """
43
  if model_key not in HF_MODELS:
44
+ logger.error(f" Model key '{model_key}' not found in registry.")
45
  raise ValueError(f"Unsupported model key: {model_key}")
46
 
47
  repo_id, filename = HF_MODELS[model_key]
48
 
49
  if os.path.exists(save_path):
50
+ logger.info(f" Model '{model_key}' already exists at '{save_path}'. Skipping download.")
51
  return
52
 
53
  os.makedirs(os.path.dirname(save_path), exist_ok=True)
54
+ logger.info(f" Downloading '{model_key}' from Hugging Face Hub...")
55
 
56
  try:
57
  hf_hub_download(
 
60
  cache_dir=os.path.dirname(save_path),
61
  force_download=True # Set to False later if you want to cache
62
  )
63
+ logger.info(f" Successfully downloaded '{model_key}' to '{save_path}'")
64
  except Exception as e:
65
+ logger.error(f" Download failed for '{model_key}': {e}")
66
  raise