For my base models, I successfully use
AutoModel.from_pretrained(
f"{COMPANY_NAME}/{model_name}",
token=os.environ['HUGGINGFACE_TOKEN'],
force_download=True,
revision=branch_tag_or_commit_id,
)
but for my adapters, if revision
is other than the string "main"
, the code
return PeftModel.from_pretrained(base_model,
f"{COMPANY_NAME}/{model_name}",
token=os.environ['HUGGINGFACE_TOKEN'],
force_download=True,
revision=branch_tag_or_commit_id,
)
yields error E ValueError: Can't find 'adapter_config.json' at 'Mediform/model_integration_testing-SEP-lora_pooler.dense'
, even though the commit hash I am using points to main
:
(Pdb) branch_tag_or_commit_id
CommitInfo(commit_url='https://huggingface.co/Mediform/model_integration_testing-SEP-lora_pooler.dense/commit/3859e57e59fa3c547d773283d01dcb34d2ce0dc0', commit_message='test_huggingface_save_and_load_adapter_model()', commit_description='', oid='3859e57e59fa3c547d773283d01dcb34d2ce0dc0', pr_url=None, pr_revision=None, pr_num=None)
(Pdb) result2 = PeftModel.from_pretrained(base_model,f"{COMPANY_NAME}/{model_name}",token=os.environ['HUGGINGFACE_TOKEN'],force_download=True,revision=branch_tag_or_commit_id)
*** ValueError: Can't find 'adapter_config.json' at 'Mediform/model_integration_testing-SEP-lora_pooler.dense'
(Pdb) result2 = PeftModel.from_pretrained(base_model,f"{COMPANY_NAME}/{model_name}",token=os.environ['HUGGINGFACE_TOKEN'],force_download=True,revision="main")
Downloading (β¦)/adapter_config.json: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 502/502 [00:00<00:00, 1.05MB/s]
Downloading adapter_model.bin: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 1.85k/1.85k [00:00<00:00, 3.93MB/s]
(Pdb)
Is this a bug? Should I report it somewhere else, too? How can I solve/work around this?