# SFTTrain error with code from website

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsfttrain-error-with-code-from-website%2F51464%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 21, 2023, 4:56am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsfttrain-error-with-code-from-website%2F51464 "2023-08-21T04:56:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coralexbadea](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/coralexbadea/32/18726_2.png) [@coralexbadea](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcoralexbadea)%5C
**Post date:** [August 21, 2023, 4:56am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsfttrain-error-with-code-from-website%2F51464%2F1 "2023-08-21T04:56:58Z")

</div>

If you copy paste the code from hugging face SFTTrainer page ([Supervised Fine-tuning Trainer](https://huggingface.co/docs/trl/main/en/sft_trainer)) it results in error:

name ‘PeftModel’ is not defined

Code:  
trainer = SFTTrainer(  
“facebook/opt-350m”,  
train\_dataset=dataset,  
dataset\_text\_field=“text”,  
max\_seq\_length=512,  
)  
trainer.train()
