Skip to content

Can't import unsloth when both the latest version of unsloth and transformers are installed #1179

Closed as not planned

Description

@lossflow

To repro:
Install the latest versions of unsloth and transformers

!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip uninstall transformers -y && pip install --upgrade --no-cache-dir "git+https://github.com/huggingface/transformers.git"

try to import unsloth, receive error:
/usr/local/lib/python3.10/dist-packages/unsloth/kernels/cross_entropy_loss.py in Unsloth_LlamaForCausalLM()
NameError: name 'Unpack' is not defined

This doesn't affect demo notebooks as they don't import the latest version of transformers. An older version of transformers can be used but doesn't work as well with gradient accumulation and gives the warning "Unsloth: Using our custom gradient accumulation fixed trainer, which is not feature complete."

Activity

  1. Austin1207 commented on Oct 24, 2024

    @Austin1207

    both

  2. lossflow commented on Oct 24, 2024

    @lossflow
    Author

    I can no longer repro after 3 attempts. Not sure what was happening.

  3. lossflow commented on Oct 24, 2024

    @lossflow
    Author

    Repro-ed again.

  4. Erland366 commented on Oct 24, 2024

    @Erland366
    Collaborator

    Working on a fix!

  5. R4ZZ3 commented on Oct 24, 2024

    @R4ZZ3

    I am having the same issue

  6. danielhanchen commented on Oct 24, 2024

    @danielhanchen
    Member

    @R4ZZ3 @lossflow Apologies fixed! Please update unsloth on local installations (or reload / restart Colab / Kaggle) - pip install --upgrade --no-cache-dir unsloth

  7. urisolve commented on Oct 25, 2024

    @urisolve

    @R4ZZ3 @lossflow Apologies fixed! Please update unsloth on local installations (or reload / restart Colab / Kaggle) - pip install --upgrade --no-cache-dir unsloth

    I confirm it is working now. Many thanks

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions