ImportError: cannot import name 'PreTrainedModel' from 'transformers'

Hi. This looks like an issue from peft side. I’m working with mistralai/Mistral-Small-24B-Base-2501 model and trying to fine-tune it. But it throws ImportError: cannot import name ‘PreTrainedModel’ from ‘transformers’. My versions are transformers 4.55.4, tokenizers 0.21.4, peft 0.17.1. Is this a version incompatibility issue?

I downgraded transformers to 4.42.4, tokenizers to 0.19.1 and peft to 0.5.0 and it throws Exception: data did not match any variant of untagged enum ModelWrapper at line 1217944 column 3

1 Like

Managed to solve this by using tokenizers-0.20.1 transformers-4.45.2 (json - Tokenizer.from_file() HUGGINFACE : Exception: data did not match any variant of untagged enum ModelWrapper - Stack Overflow)

1 Like

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