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
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
),
)
The text was updated successfully, but these errors were encountered:
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
),
)
The text was updated successfully, but these errors were encountered: