Clémentine commited on
Commit
5c07fb7
1 Parent(s): 193f184

update for adapters on the hub

Browse files
src/scripts/update_all_request_files.py CHANGED
@@ -30,17 +30,16 @@ def update_models(file_path, models):
30
  data['license'] = model_cfg.card_data.license if model_cfg.card_data is not None else ""
31
 
32
  # Is the model still on the hub?
33
- try:
 
34
  model_name = model_cfg.card_data.base_model # for adapters, we look at the parent model
35
- except Exception as e:
36
- model_name = model_id
37
  still_on_hub, _, _ = is_model_on_hub(
38
- model_name=model_id, revision=data.get("revision"), trust_remote_code=True, test_tokenizer=False, token=H4_TOKEN
39
  )
40
  # If the model doesn't have a model card or a license, we consider it's deleted
41
  if still_on_hub:
42
  try:
43
- status, msg, model_card = check_model_card(model_id)
44
  if status is False:
45
  still_on_hub = False
46
  except Exception:
 
30
  data['license'] = model_cfg.card_data.license if model_cfg.card_data is not None else ""
31
 
32
  # Is the model still on the hub?
33
+ model_name = model_id
34
+ if model_cfg.card_data is not None and model_cfg.card_data.base_model is not None:
35
  model_name = model_cfg.card_data.base_model # for adapters, we look at the parent model
 
 
36
  still_on_hub, _, _ = is_model_on_hub(
37
+ model_name=model_name, revision=data.get("revision"), trust_remote_code=True, test_tokenizer=False, token=H4_TOKEN
38
  )
39
  # If the model doesn't have a model card or a license, we consider it's deleted
40
  if still_on_hub:
41
  try:
42
+ status, _, model_card = check_model_card(model_id)
43
  if status is False:
44
  still_on_hub = False
45
  except Exception: