Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finetuning QwQ - Validation Loss NaN #1460

Open
DaddyCodesAlot opened this issue Dec 21, 2024 · 1 comment
Open

Finetuning QwQ - Validation Loss NaN #1460

DaddyCodesAlot opened this issue Dec 21, 2024 · 1 comment

Comments

@DaddyCodesAlot
Copy link

Hi there, when finetuning Qwen QwQ on a train and validation set, the validation loss is reported as NaN.

I installed unsloth using:
!pip install unsloth

And here's my trainer:
from trl import SFTTrainer
from transformers import TrainingArguments, DataCollatorForSeq2Seq
from unsloth import is_bfloat16_supported

trainer = SFTTrainer(
model = model,
tokenizer = tokenizer,
train_dataset = dataset,
eval_dataset = validate_dataset,
dataset_text_field = "text",
max_seq_length = max_seq_length,
data_collator = DataCollatorForSeq2Seq(tokenizer = tokenizer),
dataset_num_proc = 2,
packing = False, # Can make training 5x faster for short sequences.
args = TrainingArguments(
per_device_train_batch_size = 2,
per_device_eval_batch_size = 2,
gradient_accumulation_steps = 4,
warmup_steps = 5,
num_train_epochs=num_epochs,
learning_rate = 2e-4,
# Do from unsloth import is_bfloat16_supported
# Do from unsloth import is_bfloat16_supported
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",
save_strategy = "steps",
evaluation_strategy="steps",
eval_steps=checkpoint_count,
save_steps=checkpoint_count, # Saving checkpoint every 100 steps
),
)

@shimmyshimmer
Copy link
Collaborator

Do you have an example of the error? Like a screenshot/code? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants