admin管理员组文章数量:1401484
I tried to save the model with the below code but failed. Planning to use unsloth/Llama-3.2-11B-Vision-Instruct
as a base model to fine-tune a new model.
!pip install unsloth
model, tokenizer = FastVisionModel.from_pretrained(
"unsloth/Llama-3.2-11B-Vision-Instruct",
load_in_4bit = False,
use_gradient_checkpointing = "unsloth",
)
...
if True:
model.save_pretrained_merged(
"unsloth_finetune",
tokenizer,
save_method = "merged_16bit",)
with error
File ~/.local/lib/python3.10/site-packages/unsloth/save.py:2357, in unsloth_generic_save_pretrained_merged(self, save_directory, tokenizer, save_method, push_to_hub, token, is_main_process, state_dict, save_function, max_shard_size, safe_serialization, variant, save_peft_format, tags, temporary_location, maximum_memory_usage)
[2355](~/.local/lib/python3.10/site-packages/unsloth/save.py:2355) arguments["model"] = self
[2356](~/.local/lib/python3.10/site-packages/unsloth/save.py:2356) del arguments["self"]
-> [2357](~/.local/lib/python3.10/site-packages/unsloth/save.py:2357) unsloth_generic_save(**arguments)
[2358](~/.local/lib/python3.10/site-packages/unsloth/save.py:2358) for _ in range(3):
[2359](~/.local/lib/python3.10/site-packages/unsloth/save.py:2359) gc.collect()
File ~/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py:116, in context_decorator.<locals>.decorate_context(*args, **kwargs)
[113](~/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py:113) @functools.wraps(func)
...
--> [472](~/.local/lib/python3.10/site-packages/unsloth_zoo/saving_utils.py:472) try_save_directory = temp_file.name
[474]~/.local/lib/python3.10/site-packages/unsloth_zoo/saving_utils.py:474) total, used, free = shutil.disk_usage(save_directory)
[475](~/.local/lib/python3.10/site-packages/unsloth_zoo/saving_utils.py:475) free = int(free*0.95)
AttributeError: 'NoneType' object has no attribute 'name'
All the help is appreciated.
I tried to save the model with the below code but failed. Planning to use unsloth/Llama-3.2-11B-Vision-Instruct
as a base model to fine-tune a new model.
!pip install unsloth
model, tokenizer = FastVisionModel.from_pretrained(
"unsloth/Llama-3.2-11B-Vision-Instruct",
load_in_4bit = False,
use_gradient_checkpointing = "unsloth",
)
...
if True:
model.save_pretrained_merged(
"unsloth_finetune",
tokenizer,
save_method = "merged_16bit",)
with error
File ~/.local/lib/python3.10/site-packages/unsloth/save.py:2357, in unsloth_generic_save_pretrained_merged(self, save_directory, tokenizer, save_method, push_to_hub, token, is_main_process, state_dict, save_function, max_shard_size, safe_serialization, variant, save_peft_format, tags, temporary_location, maximum_memory_usage)
[2355](~/.local/lib/python3.10/site-packages/unsloth/save.py:2355) arguments["model"] = self
[2356](~/.local/lib/python3.10/site-packages/unsloth/save.py:2356) del arguments["self"]
-> [2357](~/.local/lib/python3.10/site-packages/unsloth/save.py:2357) unsloth_generic_save(**arguments)
[2358](~/.local/lib/python3.10/site-packages/unsloth/save.py:2358) for _ in range(3):
[2359](~/.local/lib/python3.10/site-packages/unsloth/save.py:2359) gc.collect()
File ~/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py:116, in context_decorator.<locals>.decorate_context(*args, **kwargs)
[113](~/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py:113) @functools.wraps(func)
...
--> [472](~/.local/lib/python3.10/site-packages/unsloth_zoo/saving_utils.py:472) try_save_directory = temp_file.name
[474]~/.local/lib/python3.10/site-packages/unsloth_zoo/saving_utils.py:474) total, used, free = shutil.disk_usage(save_directory)
[475](~/.local/lib/python3.10/site-packages/unsloth_zoo/saving_utils.py:475) free = int(free*0.95)
AttributeError: 'NoneType' object has no attribute 'name'
All the help is appreciated.
Share Improve this question edited Mar 24 at 6:07 John asked Mar 23 at 3:23 JohnJohn 8332 gold badges11 silver badges27 bronze badges1 Answer
Reset to default 0# Eğer Jupyter/Colab kullanıyorsan bu satır kalabilir
!pip install unsloth
from unsloth import FastVisionModel
# Modeli yükle (4-bit modda, belleği daha az kullanır)
model, tokenizer = FastVisionModel.from_pretrained(
"unsloth/Llama-3.2-11B-Vision-Instruct",
load_in_4bit=True, # RTX 3060 için zorunlu gibi
use_gradient_checkpointing=True, # "unsloth" yerine True
)
# Eğitilmiş modeli kaydet (16-bit birleşik olarak)
model.save_pretrained_merged(
save_directory="unsloth_finetune", # Klasör adı
tokenizer=tokenizer,
save_method="merged_16bit", # Hata alırsan bunu "merged" yapabilirsin
)
本文标签: pythonunsloth savepretrainedmerged function issueStack Overflow
版权声明:本文标题:python - unsloth save_pretrained_merged function issue - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744298221a2599449.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论