# Error Importing Seq2SeqTrainer

**URL:** <https://discuss.huggingface.co/t/error-importing-seq2seqtrainer/168082>\
**Category:** 🤗Transformers\
**Created:** [September 3, 2025, 5:53pm UTC](https://discuss.huggingface.co/t/error-importing-seq2seqtrainer/168082 "2025-09-03T17:53:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dholt123](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@dholt123](https://discuss.huggingface.co/u/dholt123)\
**Post date:** [September 3, 2025, 5:53pm UTC](https://discuss.huggingface.co/t/error-importing-seq2seqtrainer/168082/1 "2025-09-03T17:53:23Z")

</div>

I’m new to using transformers so any help would be appreciated. I keep getting this error when I attempting to import Seq2Seq2Trainer and Seq2Seq2TrainingArguments:

ImportError: cannot import name ‘TFPreTrainedModel’ from ‘transformers’

I’m not sure what to do to resolve this, I’ve already checked to make sure that transformers is up to date (version 4.56.0).

---

<div class="post-metadata">

**Author:** ![dholt123](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@dholt123](https://discuss.huggingface.co/u/dholt123)\
**Post date:** [September 3, 2025, 6:26pm UTC](https://discuss.huggingface.co/t/error-importing-seq2seqtrainer/168082/2 "2025-09-03T18:26:28Z")

</div>

I was able to figure out the issue. It was caused by having both TensorFlow and pyTorch installed. When both are installed, Integration\_utils.py first checks to see if TensorFlow is available first and the attempts to import TFPreTrainedModel this is where the error was occurring.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [September 4, 2025, 6:27am UTC](https://discuss.huggingface.co/t/error-importing-seq2seqtrainer/168082/3 "2025-09-04T06:27:02Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
