Skip to content

raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'") AttributeError: 'LongRopeRotaryEmbedding' object has no attribute 'long_cos_cached'. Did you mean: 'short_cos_cached'? #1189

Closed as not planned

Description

@SnehaKumari14

Hello , I have been facing this issue , with PHI 3.5 mini Instruct bnb 4Bit model. I am trying to do the Few shot prompting for my dataset . there i am getting this issue . I case of SFT as well , same issue is coming with PHI model . others life LLama and Mistral works fine. Could anyone pknow hwta should be done to fix this scenario.?

Regards,

Activity

  1. NicolasSteen commented on Oct 25, 2024

    @NicolasSteen

    I encounter the same error with "unsloth/Phi-3.5-mini-instruct"

    AttributeError: 'LongRopeRotaryEmbedding' object has no attribute 'long_cos_cached'

    For me the error occurs only in cases where the input-sequence is below 4096 tokens and the total output sequence exceeds the 4096 tokens.

    If both prompt and total output are below or above 4096 tokens the error does not occur.

  2. SnehaKumari14 commented on Oct 25, 2024

    @SnehaKumari14
    Author

    yes for me it is happening for certain input sequence .how did you handle this .?

  3. NicolasSteen commented on Oct 25, 2024

    @NicolasSteen

    I think it happens only for those sequences that exceed the 4096 token length during generation.

    It seems somehow related to how the embeddings are cached, but I don't know how to fix or handle this issue.

    I observed that the error is not thrown, if you run a sequence of length >4096 through the model before making inference on others (I guess causing the long_cos_cached attribute to be set). In that case it seems to work, however I noticed that the model then outputs non-sensical/ random stuff when exceeding a sequence length of 4096 tokens... Not sure if this is another issue. The behaviour seems pretty odd to me.

    Edit: I gathered my observations for this bug in this notebook. Maybe this is helpful to understand/ debug the issue for someone with more knowledge...

  4. danielhanchen commented on Oct 26, 2024

    @danielhanchen
    Member

    Fixed by @Erland366! Please update Unsloth through the nightly branch for now via pip uninstall unsloth -y && pip install --upgrade --no-cache-dir --no-deps "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"

  5. NicolasSteen commented on Oct 26, 2024

    @NicolasSteen

    Thanks a lot for taking care so quickly!

    However, the model output after 4096 tokens is still gibberish... (as mentioned by @Erland366 in #1193 )

    @danielhanchen should I open a new issue for this?

  6. danielhanchen commented on Oct 27, 2024

    @danielhanchen
    Member

    @NicolasSteen Yep open a new issue thanks - I'm investigating as well!

  7. NicolasSteen commented on Oct 27, 2024

    @NicolasSteen

    Submitted a new issue: #1199

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