Skip to content

FastLanguageModel causes IPython dependency via transformers.utils.notebook #209

Closed

Description

@mschmill

I am trying to follow along with the SFT example in the README (the very first one) and somehow importing FastLanguageModel is causing notebook functionality to be imported via models.dpo and transformers.utils.notebook. This causes an undocumented dependency on IPython which is probably not necessary or desirable.

Version is 2024.2, installed to a conda environment via pip, according to the directions in the README.

  File "/home/mschmill/Koda-API-Contract/src/koda_train/unsloth.py", line 4, in <module>
    from unsloth import FastLanguageModel
  File "/opt/anaconda/anaconda3/envs/smd/lib/python3.10/site-packages/unsloth/__init__.py", line 108, in <module>
    from .models import *
  File "/opt/anaconda/anaconda3/envs/smd/lib/python3.10/site-packages/unsloth/models/__init__.py", line 18, in <module>
    from .dpo import PatchDPOTrainer
  File "/opt/anaconda/anaconda3/envs/smd/lib/python3.10/site-packages/unsloth/models/dpo.py", line 15, in <module>
    from transformers.utils.notebook import (
  File "/opt/anaconda/anaconda3/envs/smd/lib/python3.10/site-packages/transformers/utils/notebook.py", line 20, in <module>
    import IPython.display as disp
ModuleNotFoundError: No module named 'IPython'

Activity

  1. danielhanchen commented on Mar 1, 2024

    @danielhanchen
    Member

    Oh interesting! Thanks so much for the report - will add IPython to pyproject.toml!!

  2. danielhanchen commented on Mar 3, 2024

    @danielhanchen
    Member

    I think I fixed this now! I added a try except block :) Thanks for the report :)

  3. added
    fixed - pending confirmation
    and removed
    currently fixing
    on Mar 3, 2024
  4. added a commit that references this issue on Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed - pending confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions