-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
bugfixed - pending confirmationFixed, waiting for confirmation from posterFixed, waiting for confirmation from poster
Description
- Did you update?
pip install --upgrade unsloth unsloth_zooYes ColaborKaggleor local / cloud: local and local model- Number GPUs used, use
nvidia-smi - Which notebook? Please link! My own code
- Which Unsloth version, TRL version, transformers version, PyTorch version? 2025.10.3
- Which trainer?
SFTTrainer,GRPOTraineretc SFTTrainer
I'm loading a local model from disk to do the training and saving locally, and I encourntered the following issue when saving. I'm using SFT trainer. The source code link: https://github.com/microsoft/agent-lightning/blob/86becfdbff8815b9278874575009bdc1ae599f21/examples/unsloth/unsloth_helper.py
It works fine with 2025.10.1
I'm putting the traceback here, the problem is quite obvious:
Traceback (most recent call last):
File "/home/xxx/anaconda3/envs/trl/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/home/xxx/anaconda3/envs/trl/lib/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/xxx/Projects/agl-second-bench/examples/unsloth/unsloth_helper.py", line 92, in unsloth_training
model.save_pretrained_merged(next_model_path, tokenizer, save_method="merged_16bit") # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxx/anaconda3/envs/trl/lib/python3.11/site-packages/unsloth/save.py", line 2498, in unsloth_generic_save_pretrained_merged
unsloth_generic_save(**arguments)
File "/home/xxx/anaconda3/envs/trl/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/xxx/anaconda3/envs/trl/lib/python3.11/site-packages/unsloth/save.py", line 2444, in unsloth_generic_save
merge_and_overwrite_lora(
File "/home/xxx/anaconda3/envs/trl/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/xxx/anaconda3/envs/trl/lib/python3.11/site-packages/unsloth_zoo/saving_utils.py", line 1224, in merge_and_overwrite_lora
if not copied_tokenizer_model_from_cache and not low_disk_space_usage and not is_local_path:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'copied_tokenizer_model_from_cache' where it is not associated with a value
Metadata
Metadata
Assignees
Labels
bugfixed - pending confirmationFixed, waiting for confirmation from posterFixed, waiting for confirmation from poster