# Trainer does not print to console the loss (train and eval)

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-does-not-print-to-console-the-loss-train-and-eval%2F44384%3E%5C
**Category:** Beginners\
**Created:** [June 24, 2023, 9:47am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-does-not-print-to-console-the-loss-train-and-eval%2F44384 "2023-06-24T09:47:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stelman](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@stelman](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fstelman)%5C
**Post date:** [June 24, 2023, 9:47am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-does-not-print-to-console-the-loss-train-and-eval%2F44384%2F1 "2023-06-24T09:47:19Z")

</div>

Hello,

I have a basic problem, but I can’t find a solution. I looked into some older threads saying that it has something to do with the number of eval\_steps and gradient accumulation, but this doesn’t seem to be helping.

I want to see the train\_loss and eva\_loss at every X steps.

Here’s my code:

transformers.logging.set\_verbosity\_debug()

training\_args = TrainingArguments(  
“temp”,  
evaluation\_strategy=“steps”,  
do\_train=True,  
learning\_rate=LEARNING\_RATE,  
gradient\_accumulation\_steps=2,  
auto\_find\_batch\_size=True,  
num\_train\_epochs=3,  
save\_steps=100,  
eval\_steps=100,  
lr\_scheduler\_type = ‘cosine\_with\_restarts’,  
save\_total\_limit=8,  
max\_steps=10000,  
per\_device\_train\_batch\_size=1,  
per\_device\_eval\_batch\_size=1,  
load\_best\_model\_at\_end = True,  
logging\_strategy=‘steps’,  
logging\_dir=‘./logs’,  
logging\_steps=100,  
overwrite\_output\_dir=True  
)

trainer = Trainer(  
model=model,  
args=training\_args,  
train\_dataset=datasets[‘train’],  
eval\_dataset=datasets[‘validation’],  
data\_collator = data\_collator,  
callbacks = [transformers.EarlyStoppingCallback(early\_stopping\_patience=10)]  
)

trainer.train()

If I do : log\_history = trainer.state.log\_history  
at the end of the run, then the log\_history shows just fine. I don’t know why it’s not printing the loss to the console. The only thing I see is when it goes through eval, but not the actual eval error (or train loss).
