Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'SFTConfig' from 'trl' #1639

Open
brand17 opened this issue May 11, 2024 · 3 comments
Open

ImportError: cannot import name 'SFTConfig' from 'trl' #1639

brand17 opened this issue May 11, 2024 · 3 comments

Comments

@brand17
Copy link

brand17 commented May 11, 2024

I installed trl 0.8.6 and tried the example from here https://huggingface.co/docs/trl/main/en/sft_trainer.

I am getting the error in line
from trl import SFTConfig, SFTTrainer:

Exception has occurred: ImportError (note: full exception trace is shown but execution is paused at: _run_module_as_main) cannot import name 'SFTConfig' from 'trl' (c:\Users\brand17\Documents\Software\python\.env\Lib\site-packages\trl\__init__.py) File "H:\My Drive\Colab_Notebooks\CallCenter\simple.py", line 2, in <module> from trl import SFTConfig, SFTTrainer, TrainingArguments File "C:\Users\brand17\AppData\Local\Programs\Python\Python311\Lib\runpy.py", line 88, in _run_code exec(code, run_globals) File "C:\Users\brand17\AppData\Local\Programs\Python\Python311\Lib\runpy.py", line 198, in _run_module_as_main (Current frame) return _run_code(code, main_globals, None, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ImportError: cannot import name 'SFTConfig' from 'trl' (c:\Users\brand17\Documents\Software\python\.env\Lib\site-packages\trl\__init__.py)

I work on Windows 10 Pro 22H2 build 19045.4291, python 3.11.4.

@BaoLocPham
Copy link

Hi @brand17 I also encountered this error, I think in deployment and delivering phase have problem. But after i install from source, it works fine.
I work on Linux, python 3.10 btw.

@masonwang025
Copy link

@brand17 I also encountered this error, but @BaoLocPham's comment seems to work.
Install from source (pip install git+https://github.com/huggingface/trl.git) works.

@erwe324
Copy link

erwe324 commented Jun 1, 2024

@brand17 I also encountered this error, but @BaoLocPham's comment seems to work. Install from source (pip install git+https://github.com/huggingface/trl.git) works.

pip install from source works for me also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants