# Error Importing Seq2SeqTrainer

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-importing-seq2seqtrainer%2F168082%3E%5C
**Category:** 🤗Transformers\
**Created:** [September 3, 2025, 5:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-importing-seq2seqtrainer%2F168082 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdholt123)%5C
**Post date:** [September 3, 2025, 5:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-importing-seq2seqtrainer%2F168082%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdholt123)%5C
**Post date:** [September 3, 2025, 6:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-importing-seq2seqtrainer%2F168082%2F2 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [September 4, 2025, 6:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-importing-seq2seqtrainer%2F168082%2F3 "2025-09-04T06:27:02Z")

</div>

Closed on September 4, 2025, 6:27am UTC

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