Repository navigation
fix UnboundLocalError - #834
Conversation
|
OOO nice catch!! Thanks so much - tbh I kinda didn't know about the variable clearing! |
|
I didn't know either, but Claude knows. |
|
Hi Daniel. Unfortunately having a similar problem here. Training LLama 3 8B via Linux Ubuntu (to bypass Triton dep w/ Bin Wheel). Seems like I am now falling into a RuntimeError(autoconfig_error or peft_error). Here is the actual error (when running the whole model): File "/usr/local/lib/python3.10/dist-packages/unsloth/models/loader.py", line 178, in from_pretrained Is it a problem with the model I am feeding? model_name = "unsloth/llama-3-8b-bnb-4bit", |
* 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 <[email protected]> Co-authored-by: Daniel Han <[email protected]>
I'm finetuning LLaMA 3.1 8B using
transformers==4.42.3andunsloth==2024.8. I hit an error becausenot is_model and not is_peftis true (expected with transformers 4.42.3), but the error message seems odd:This is because:
When an exception has been assigned using as target, it is cleared at the end of the except clause. This is as if
was translated to
This means the exception must be assigned to a different name to be able to refer to it after the except clause. Exceptions are cleared because with the traceback attached to them, they form a reference cycle with the stack frame, keeping all locals in that frame alive until the next garbage collection occurs.
check this doc