I am trying to import SFTTrainer from trl package. I am getting the error message - ImportError: cannot import name 'override' from 'typing_extensions' (D:\...\..\). I am able to do it perfectly well in Google Colab, no issues. Why is this? How can I import on my local PC/ Jupyter?
I installed the trl package and tried importing SFFTrainer using:
!pip install trl
from trl import SFTTrainer
I tried uninstalling and reinstalling typing-extensions, that did not work. I uninstalled trl and tried installing it from Anaconda powershell prompt and I tried a few other installations, updates and uninstallations. I even tried importing trl from github and then load. None of them is working.
How to resolve this?
Problem
Seems a version incompatibility problem between typing_extensions and other packages.
Solution
I tested it with Python 3.10 and some pinned versions of the following packages, and it should work for you also.
Those packages usually cause dependency errors, so this should fix your current problem and future ones.
Extra Ball
There is a similar issue in the
openairepository: https://github.com/openai/openai-python/issues/751