You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hey guys, I get the following error message, after successfully fine-tuning when trying to merge weights and push to hub:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/x/.venv/lib/python3.10/site-packages/unsloth/save.py", line 1211, in unsloth_push_to_hub_merged
unsloth_save_model(**arguments)
File "/x/.venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/x/.venv/lib/python3.10/site-packages/unsloth/save.py", line 686, in unsloth_save_model
internal_model.save_pretrained(**save_pretrained_settings)
File "/x/.venv/lib/python3.10/site-packages/transformers/modeling_utils.py", line 2634, in save_pretrained
model_card = create_and_tag_model_card(
File "/x/projects/mistral-finetune/.venv/lib/python3.10/site-packages/transformers/utils/hub.py", line 1144, in create_and_tag_model_card
if model_tag not in model_card.data.tags:
TypeError: argument of type 'NoneType' is not iterable
from unsloth import FastLanguageModel
import torch
from trl import SFTTrainer
from transformers import TrainingArguments
from unsloth import is_bfloat16_supported
from utils import dataset
max_seq_length = 1048
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "unsloth/mistral-7b-instruct-v0.3", # Choose ANY! eg teknium/OpenHermes-2.5-Mistral-7B
max_seq_length = 1048,
dtype = None,
load_in_4bit = True,
)
model = FastLanguageModel.get_peft_model(
model,
r = 16, # Choose any number > 0 ! Suggested 8, 16, 32, 64, 128
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj",],
lora_alpha = 16,
lora_dropout = 0, # Supports any, but = 0 is optimized
bias = "none", # Supports any, but = "none" is optimized
# [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
random_state = 239,
use_rslora = False, # We support rank stabilized LoRA
loftq_config = None, # And LoftQ
)
trainer = SFTTrainer(
model = model,
tokenizer = tokenizer,
train_dataset = dataset,
dataset_text_field = "text",
max_seq_length = max_seq_length,
dataset_num_proc = 2,
packing = False, # Can make training 5x faster for short sequences.
args = TrainingArguments(
per_device_train_batch_size = 10,
gradient_accumulation_steps = 4,
warmup_steps = 5,
#num_train_epochs = 1,
max_steps = 1, # Set num_train_epochs = 1 for full training runs
learning_rate = 2e-4,
fp16 = not is_bfloat16_supported(),
bf16 = is_bfloat16_supported(),
logging_steps = 1,
optim = "adamw_8bit",
weight_decay = 0.01,
lr_scheduler_type = "linear",
seed = 239,
output_dir = "outputs",
),
)
trainer_stats = trainer.train()
model.push_to_hub_merged("user/this-is-my-project", tokenizer, save_method = "merged_16bit", token)
The above code create the config files, but fails before the weights are stored.
When saving the adapter without merging, the script does not fail and stores the adapter weights.
hey guys, I get the following error message, after successfully fine-tuning when trying to merge weights and push to hub:
The above code create the config files, but fails before the weights are stored.
When saving the adapter without merging, the script does not fail and stores the adapter weights.
My environment:
Any ideas what could be going wrong?
The text was updated successfully, but these errors were encountered: