Chapter 7 questions

Getting an error:

Error: You must call wandb.init() before wandb.log()

“Main NLP Tasks” in section “Fine tuning a Masked Language Model” at the following line

trainer.train()

The solution is to update the training arguments defined a few lines above.

training_args = TrainingArguments(
    output_dir=f"{model_name}-finetuned-imdb",
    overwrite_output_dir=True,
    evaluation_strategy="epoch",
    learning_rate=2e-5,
    weight_decay=0.01,
    per_device_train_batch_size=batch_size,
    per_device_eval_batch_size=batch_size,
    push_to_hub=True,
    fp16=True,
    logging_steps=logging_steps,
    report_to="none" # ADD THIS LINE!
)

This is covered in another thread but an initial non-working answer is given, with another poster correcting None to “none” in a response. Also, other alternative solutions are offered that could be tried.

1 Like