Skip to content

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

@lossflow

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."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions