Show both peft_error and autoconfig_error, not just autoconfig_error (#2080)
When loading a PEFT model fails, only the `autoconfig_error` is shown. Instead of the `peft_error`, which is what really matters when we're trying to load a PEFT adapter, the user will see something like this: ``` RuntimeError: Unrecognized model in my_model. Should have a `model_type` key in its config.json, or contain one of the following strings in its name: albert, align, altclip, ... ``` This PR just changes it so `autoconfig_error` and `peft_error` are both displayed.
This commit is contained in:
parent
46b3986304
commit
f80cc13149
1 changed files with 14 additions and 2 deletions
|
|
@ -218,7 +218,13 @@ class FastLanguageModel(FastLlamaModel):
|
|||
f'Try `pip install --upgrade "transformers>=4.43.2"`\n'\
|
||||
f"to obtain the latest transformers build, then restart this session."\
|
||||
)
|
||||
raise RuntimeError(autoconfig_error or peft_error)
|
||||
# Create a combined error message showing both failures
|
||||
combined_error = (
|
||||
"Unsloth: Failed to load model. Both AutoConfig and PeftConfig loading failed.\n\n"
|
||||
f"AutoConfig error: {autoconfig_error}\n\n"
|
||||
f"PeftConfig error: {peft_error}\n\n"
|
||||
)
|
||||
raise RuntimeError(combined_error)
|
||||
pass
|
||||
|
||||
# Get base model for PEFT:
|
||||
|
|
@ -597,7 +603,13 @@ class FastModel(FastBaseModel):
|
|||
f'Try `pip install --upgrade "transformers>=4.43.2"`\n'\
|
||||
f"to obtain the latest transformers build, then restart this session."\
|
||||
)
|
||||
raise RuntimeError(autoconfig_error or peft_error)
|
||||
# Create a combined error message showing both failures
|
||||
combined_error = (
|
||||
"Unsloth: Failed to load model. Both AutoConfig and PeftConfig loading failed.\n\n"
|
||||
f"AutoConfig error: {autoconfig_error}\n\n"
|
||||
f"PeftConfig error: {peft_error}\n\n"
|
||||
)
|
||||
raise RuntimeError(combined_error)
|
||||
pass
|
||||
|
||||
# Get base model for PEFT:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue