# SFTTrain error with code from website

**URL:** <https://discuss.huggingface.co/t/sfttrain-error-with-code-from-website/51464>\
**Category:** 🤗Transformers\
**Created:** [August 21, 2023, 4:56am UTC](https://discuss.huggingface.co/t/sfttrain-error-with-code-from-website/51464 "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](https://discuss.huggingface.co/u/coralexbadea)\
**Post date:** [August 21, 2023, 4:56am UTC](https://discuss.huggingface.co/t/sfttrain-error-with-code-from-website/51464/1 "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()
