# Evaluation step take longer then training step

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fevaluation-step-take-longer-then-training-step%2F59530%3E%5C
**Category:** Intermediate\
**Created:** [October 23, 2023, 9:02am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fevaluation-step-take-longer-then-training-step%2F59530 "2023-10-23T09:02:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![urizlo](https://avatars.discourse-cdn.com/v4/letter/u/eb9ed0/32.png) [@urizlo](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Furizlo)%5C
**Post date:** [October 23, 2023, 9:02am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fevaluation-step-take-longer-then-training-step%2F59530%2F1 "2023-10-23T09:02:03Z")

</div>

Hello,  
I am trying to fine-tuning CodeT5+ 220M model on custom dataset.  
this is part of my code:

model = AutoModelForSeq2SeqLM.from\_pretrained(checkpoint,  
torch\_dtype=torch.float32,  
trust\_remote\_code=True,).to(device)

training\_args = Seq2SeqTrainingArguments(  
output\_dir=“local\_model”,  
evaluation\_strategy=“epoch”,  
learning\_rate=2e-5,  
per\_device\_train\_batch\_size=16,  
per\_device\_eval\_batch\_size=16,  
weight\_decay=0.01,  
save\_total\_limit=3,  
num\_train\_epochs=20,  
predict\_with\_generate=True,  
fp16=True,  
remove\_unused\_columns=False,  
logging\_dir=“TensorBoard”,  
do\_train=True,  
do\_eval=True,  
logging\_strategy=‘steps’,  
logging\_steps=500,  
eval\_steps=500,  
generation\_max\_length=106,  
generation\_num\_beams=2  
)

data\_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)

trainer = Seq2SeqTrainer(  
model=model,  
args=training\_args,  
train\_dataset=model\_inputs[‘train’],  
eval\_dataset=model\_inputs[‘test’],  
tokenizer=tokenizer,  
data\_collator=data\_collator,  
compute\_metrics=compute\_metrics  
)

trainer.train()

Here’s my question:

Making generation\_max\_length larger only affects the time it takes to perform one evaluation step, it becomes longer. However, it does not affect the training step time.

The training step of the model is usually much faster than the evaluation step, with the exception of when generation\_max\_length is less than 10.

In my knowledge training step it takes longer than the evalution step because it calculates gradients and backpropogates.

Would it be possible for someone to explain what’s going on to me?

Thakns
