Apply suggestions from code review

This commit is contained in:
Nicolas Patry 2023-11-23 12:55:18 +01:00 committed by GitHub
parent 6a25c14f46
commit b5790224a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,15 +150,16 @@ def download_weights(
if not extension == ".safetensors" or not auto_convert:
raise e
# Try to load as a local PEFT model
try:
utils.download_and_unload_peft(
model_id, revision, trust_remote_code=trust_remote_code
)
utils.weight_files(model_id, revision, extension)
return
except (utils.LocalEntryNotFoundError, utils.EntryNotFoundError):
pass
else:
# Try to load as a local PEFT model
try:
utils.download_and_unload_peft(
model_id, revision, trust_remote_code=trust_remote_code
)
utils.weight_files(model_id, revision, extension)
return
except (utils.LocalEntryNotFoundError, utils.EntryNotFoundError):
pass
# Try to see if there are local pytorch weights
try: