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
{{ message }}
Repository navigation
No label_names provided for model class PeftModelForCausalLM. Since PeftModel hides base models input arguments, if label_names is not given, label_names can't be set automatically within Trainer. #1788
from trl import SFTTrainer
from transformers import TrainingArguments
from unsloth import is_bfloat16_supported
trainer = SFTTrainer(
model = model,
tokenizer = tokenizer,
train_dataset = train_df,
# eval_dataset = val_df,
dataset_text_field = "text",
# formatting_func=formatting_func,
max_seq_length = max_seq_length,
dataset_num_proc = 1,
packing = False, # Can make training 5x faster for short sequences.
args = TrainingArguments(
per_device_train_batch_size = 2,
gradient_accumulation_steps = 4,
warmup_steps = 5,
# max_steps = 60,
num_train_epochs = 5, # For longer 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 = 3407,
output_dir = "outputs",
report_to = "wandb", # Use this for WandB etc
),
)
The Error message: No label_names provided for model class PeftModelForCausalLM. Since PeftModelhides base models input arguments, if label_names is not given, label_names can't be set automatically withinTrainer. Note that empty label_names list will be used instead.
add this line in TrainingArguments: label_names=["labels"]. PeftModel hides the base model so you need to re-specify the labels.
Reacted by Anand Muthu, yuna0x0, barboym, manmustbecool, Phan Anh Tuấn, BoleynCN, Sergiu, Matheus Albuquerque, hunter2009pf, JiangXueHaoKeAi and 1 more
Reacted by ge85tow
Reacted by ToumaKazusa, Emanuele Iannone, Gabriel Majeri and Matheus Albuquerque
I had the same error, but my task was a text generation class and there were no label names. And when I explicitly provided an empty list as the labelnames argument, I got the error: TypeError: Qwen2_5_VLForConditionalGeneration.init() got an unexpected keyword argument 'label_names'
Does this argument has any effect on model training?
I'm fine-tuning text generation tasks, in case I have to provide this label_names=["labels"] what does it mean if training dataset is in chat format like this
<|im_start|>system
You are a spelling corrector for an e-commerce marketplace.
After review, OUTPUT ONLY the full corrected query, with no extra text or explanation.<|im_end|>
<|im_start|>user
Query: nike shos<|im_end|>
<|im_start|>assistant
<think>
</think>
nike shoes<|im_end|>
I'm not using unsloth, using LoraConfig and SFTConfig from peft and trl library respectively.
This issue should be fixed now - sorry on the delay - please update with uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir - if the issue is still there, please open another issue - appreciate it again!
Activity
wwwzwbz commentedon Feb 22, 2025
Same, have you figured out why?
danielhanchen commentedon Feb 22, 2025
Oh I thought I hid this by now! Try updating Unsloth
pip install --upgrade --no-cache-dir --no-deps unslothAhmed-Hassany commentedon Feb 22, 2025
Yes, now it works after updating from 2025.2.14 to 2025.2.15 thanks.
Septemberlemon commentedon Mar 23, 2025
I didn't use Unsloth but got the warning, too
Can someone tell me what's the problem?
El-Bahnasawi commentedon Apr 2, 2025
add this line in TrainingArguments: label_names=["labels"]. PeftModel hides the base model so you need to re-specify the labels.
GuoXian0729 commentedon Apr 20, 2025
I had the same error, but my task was a text generation class and there were no label names. And when I explicitly provided an empty list as the labelnames argument, I got the error: TypeError: Qwen2_5_VLForConditionalGeneration.init() got an unexpected keyword argument 'label_names'
ge85tow commentedon May 1, 2025
I also face the error of '''got an unexpected keyword argument 'label_names''''
rajydv commentedon Jun 8, 2025
Thanks @El-Bahnasawi
label_names=["labels"]what does it mean if training dataset is in chat format like thisI'm not using unsloth, using
LoraConfigandSFTConfigfrompeftandtrllibrary respectively.steveepreston commentedon Sep 30, 2025
@Septemberlemon @GuoXian0729 @rajydv Did you find any answer?
I faced this in non-unsloth env
danielhanchen commentedon Jun 17, 2026
This issue should be fixed now - sorry on the delay - please update with
uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir- if the issue is still there, please open another issue - appreciate it again!