Skip to content

RuntimeError: Unsloth: microsoft/Phi-3-mini-128k-instruct is not a base model or a PEFT model. #727

Closed

Description

@jphme

When going with the example notebook:

!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps xformers "trl<0.9.0" peft accelerate bitsandbytes

from unsloth import FastLanguageModel
import torch
max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "microsoft/Phi-3-mini-128k-instruct", # Choose ANY! eg teknium/OpenHermes-2.5-Mistral-7B
    max_seq_length = max_seq_length,
    dtype = dtype,
    load_in_4bit = load_in_4bit,
    # token = "hf_...", # use one if using gated models like meta-llama/Llama-2-7b-hf
)

We get:

RuntimeError: Unsloth: `microsoft/Phi-3-mini-128k-instruct` is not a base model or a PEFT model.
We could not locate a `config.json` or `adapter_config.json` file.
Are you certain the model name is correct? Does it actually exist?

This is even when installing the most-current transformers version manually (pip install -U git+https://github.com/huggingface/transformers.git); loading with AutoModelForCausalLM.from_pretrained("microsoft/Phi-3-mini-128k-instruct", trust_remote_code=True, device_map="auto") works.

unsloth @ git+https://github.com/unslothai/unsloth.git@5ab565fb2c811d0b85d68dadd2ac1b32dee05e8b
transformers @ git+https://github.com/huggingface/transformers.git@cee768d97e42c6fcf744ba4d2a4dc8a8e78da4c1

Activity

  1. added
    feature request
    on Jul 6, 2024
  2. danielhanchen commented on Jul 6, 2024

    @danielhanchen
    Member

    Oh yep sadly RoPE embeddings for the long context one are a bit hard to support - I'll recheck this and get back to you!

  3. Ad1ture commented on Jul 7, 2024

    @Ad1ture

    Facing the same issue with Gemma2 local. But fine with Llama3 local. Anything new find out?

  4. danielhanchen commented on Jul 7, 2024

    @danielhanchen
    Member

    @Ad1ture Could you try updating and reinstalling Unsloth on your local device?

    pip uninstall unsloth -y
    pip install --upgrade --force-reinstall --no-cache-dir git+https://github.com/unslothai/unsloth.git
  5. Ad1ture commented on Jul 8, 2024

    @Ad1ture

    @Ad1ture Could you try updating and reinstalling Unsloth on your local device?

    pip uninstall unsloth -y
    pip install --upgrade --force-reinstall --no-cache-dir git+https://github.com/unslothai/unsloth.git

    Thanks. I'll try. Considering lots of issues of installing unsloth on my windows before, I'll create a new venv and try this.

  6. gulsumbudakoglu commented on Jul 16, 2024

    @gulsumbudakoglu

    I have the same problem for my code:
    from unsloth import FastLanguageModel

    
    max_seq_length = 2500 # Choose any! We auto support RoPE Scaling internally!
    dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
    load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
    
    model, tokenizer = FastLanguageModel.from_pretrained(
            model_name = "", # YOUR MODEL YOU USED FOR TRAINING
            max_seq_length = max_seq_length,
            dtype = dtype,
            load_in_4bit = load_in_4bit,
        )
    FastLanguageModel.for_inference(model)
    

    Are there any update about the error??

  7. danielhanchen commented on Jul 18, 2024

    @danielhanchen
    Member

    For 128K - Phi is not supported yet.
    If you're referring to the Gemma issue - it seems like @Ad1ture is having Windows issues? Sadly we don't normally test on Windows

  8. added a commit that references this issue on Jun 8, 2026
  9. danielhanchen commented on Jul 14, 2026

    @danielhanchen
    Member

    This should be fixed now - sorry on the delay - please update with uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir - if it's not fixed yet, it'll be in the next pip / PyPI release - if it's still not working after that, please open another issue - appreciate it again!

    Phi-3-mini-128k now loads via the transformers-native path with LongRoPE, so the 'not a base model' error no longer fires.

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

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions