fix UnboundLocalError (#834)
* When an exception has been assigned using as target, it is cleared at the end of the except clause.(https://docs.python.org/3/reference/compound_stmts.html#the-try-statement) * Update loader.py --------- Co-authored-by: xiaoyang <xiaoyang@youzan.com> Co-authored-by: Daniel Han <danielhanchen@gmail.com>
This commit is contained in:
parent
04e779e33e
commit
538dbf2bad
1 changed files with 4 additions and 4 deletions
|
|
@ -155,14 +155,14 @@ class FastLanguageModel(FastLlamaModel):
|
|||
try:
|
||||
model_config = AutoConfig.from_pretrained(model_name, token = token, revision = revision)
|
||||
is_model = True
|
||||
except Exception as autoconfig_error:
|
||||
autoconfig_error = str(autoconfig_error)
|
||||
except Exception as error:
|
||||
autoconfig_error = str(error)
|
||||
is_model = False
|
||||
try:
|
||||
peft_config = PeftConfig .from_pretrained(model_name, token = token, revision = revision)
|
||||
is_peft = True
|
||||
except Exception as peft_error:
|
||||
peft_error = str(peft_error)
|
||||
except Exception as error:
|
||||
peft_error = str(error)
|
||||
is_peft = False
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue