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
)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744298222a4567368.html
评论列表(0条)