# No log for validation loss in trainer.train()

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fno-log-for-validation-loss-in-trainer-train%2F24951%3E%5C
**Category:** Beginners\
**Created:** [October 25, 2022, 1:57pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fno-log-for-validation-loss-in-trainer-train%2F24951 "2022-10-25T13:57:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZongqianLi](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@ZongqianLi](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FZongqianLi)%5C
**Post date:** [October 25, 2022, 1:57pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fno-log-for-validation-loss-in-trainer-train%2F24951%2F1 "2022-10-25T13:57:16Z")

</div>

Hello, today I train the model, but there is no log for validation loss in the results of trainer.train(). The codes are as followed:

training\_args = TrainingArguments(  
output\_dir = “./qa\_results”,  
overwrite\_output\_dir = False,  
num\_train\_epochs = 1,  
per\_device\_train\_batch\_size = 4,  
per\_device\_eval\_batch\_size = 2,  
logging\_steps = 1,  
logging\_dir=“./log”,  
save\_steps = 1,  
prediction\_loss\_only = True,  
evaluation\_strategy = “steps”,  
learning\_rate = 3e-5,  
weight\_decay = 0,  
)

trainer = QuestionAnsweringTrainer(  
model=model,  
args=training\_args,  
train\_dataset=train\_dataset,  
eval\_dataset=eval\_dataset,  
tokenizer=tokenizer,  
data\_collator=data\_collator,  
compute\_metrics=compute\_metrics,  
)

train\_result = trainer.train()

And the outputs are:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/0/07a5f4f1799612cd0f80a1e9a3b28c993abf150c.png)

---

<div class="post-metadata">

**Author:** ![ZongqianLi](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@ZongqianLi](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FZongqianLi)%5C
**Post date:** [October 25, 2022, 2:15pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fno-log-for-validation-loss-in-trainer-train%2F24951%2F2 "2022-10-25T14:15:07Z")

</div>

Could anyone help me? This bug confuses me for a whole day ☹

---

<div class="post-metadata">

**Author:** ![907Resident](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/907resident/32/24749_2.png) [@907Resident](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2F907Resident)%5C
**Post date:** [November 9, 2022, 8:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fno-log-for-validation-loss-in-trainer-train%2F24951%2F3 "2022-11-09T20:51:25Z")

</div>

I am also confused by this as well. I can see the output just like @ZongqianLi , but I do not see any output in my logs.

For instance, this what I have done:

```python

    # Define Trainer
    ## set up arguments
    args = TrainingArguments(
        output_dir=out_dir,
        evaluation_strategy="steps",
        eval_steps=500,
        save_steps=1500,
        report_to="none",
        logging_dir="../../output/logs",
        logging_strategy="steps",
        per_device_train_batch_size=8,
        per_device_eval_batch_size=8,
        learning_rate=5E-05,
        num_train_epochs=5,
        seed=0,
        load_best_model_at_end=True,
    )

   # establish HF training object
    trainer = Trainer(
        model=model,
        args=args,
        train_dataset=train_dataset,
        eval_dataset=val_dataset,
        compute_metrics=torch_learn.compute_metrics,
        callbacks=[EarlyStoppingCallback(early_stopping_patience=3), neptune_callback]
    )

    # train model
    trainer.train()

```

Then I can see within my `.ipynb` output a table that looks like this:

```nohighlight
Step Training Loss Validation Loss Accuracy Precision	Recall	F1
500 0.690300	0.462797	0.841827	0.786610	0.841827	0.813205
... ... ... ... ... ... ...         
4000	0.407400	0.524831	0.856672	0.833902	0.856672	0.838811

```

Next, I go to my `logging_dir` and I do not see anything there:

```nohighlight

$ tree ../output/logs/

```

I cannot show the output but trust me when I say that there is no log present from the model.

**What do I need to do to find the logs and/or reload the trained model from a checkpoint in my local directory and get those metrics**?

* * *

Other Possible Relevant Information:

```nohighlight
$ conda list transformers

# Name Version Build Channel
sentence-transformers 2.2.2 pypi_0 pypi
transformers 4.23.1 pypi_0 pypi

```

---

<div class="post-metadata">

**Author:** ![SUNM](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@SUNM](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSUNM)%5C
**Post date:** [May 19, 2023, 6:48am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fno-log-for-validation-loss-in-trainer-train%2F24951%2F4 "2023-05-19T06:48:25Z")

</div>

Hi @ZongqianLi , i hope you are ell. did you find any solution fo ryour answer?

---

<div class="post-metadata">

**Author:** ![saireddy](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@saireddy](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsaireddy)%5C
**Post date:** [April 13, 2024, 1:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fno-log-for-validation-loss-in-trainer-train%2F24951%2F5 "2024-04-13T01:27:14Z")

</div>

["No log" when training RobertaForSequenceClassification using Trainer · Issue #8910 · huggingface/transformers · GitHub](https://github.com/huggingface/transformers/issues/8910#issuecomment-771570046) – this might help
