# Printing generations periodically during training

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprinting-generations-periodically-during-training%2F45194%3E%5C
**Category:** 🤗Transformers\
**Created:** [June 30, 2023, 9:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprinting-generations-periodically-during-training%2F45194 "2023-06-30T21:06:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acuckoo](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@acuckoo](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Facuckoo)%5C
**Post date:** [June 30, 2023, 9:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprinting-generations-periodically-during-training%2F45194%2F1 "2023-06-30T21:06:47Z")

</div>

I’m fine-tuning the “decapoda-research/llama-7b-hf” model. How can I periodically write predictions to a file during training, where I can specify the frequency?  
I have searched all over for suggestions, including setting the predict\_with\_generate=True parameter, or printing stuff from the compute\_metrics function, but nothing has really worked.  
Here is the trainer:

```auto
trainer = transformers.Trainer(
    model=model,
    train_dataset=train_data,
    eval_dataset=val_data,
    args=training_arguments,
    data_collator=data_collator,
    compute_metrics=compute_metrics,
)

```

And here is my TrainingArguments:

```auto
training_arguments = transformers.TrainingArguments(
    per_device_train_batch_size=MICRO_BATCH_SIZE,
    gradient_accumulation_steps=GRADIENT_ACCUMULATION_STEPS,
    warmup_steps=100,
    max_steps=TRAIN_STEPS,
    learning_rate=LEARNING_RATE,
    fp16=True,
    logging_steps=10,
    optim="adamw_torch",
    evaluation_strategy="steps",
    save_strategy="steps",
    eval_steps=50,
    save_steps=50,
    output_dir=OUTPUT_DIR,
    save_total_limit=4,
    load_best_model_at_end=True,
    report_to="tensorboard", 
)

```
