Skip to content

[Bug] FastLanguageModel.from_pretrained() secretly changes the model I really want to fine-tune #2407

Closed

Description

@FlorinAndrei

Describe the bug
When fine-tuning Llama 3.1, FastLanguageModel.from_pretrained() does not download the model I really want to fine-tune. Instead, it downloads a model from an Unsloth collection and makes no mention this is actually happening.

In addition, the Unsloth model actually downloaded has the name converted to lower case for no good reason, which bypasses my pre-caching of the HF hub. This is a long wait if your Internet connection is not that good.

  1. Environment Setup:

  2. Dataset Details:

    • Dataset Name: personal collection of data, not for public sharing
    • Data Preprocessing Steps: applied Alpaca prompt, removed some columns
  3. Model Details:

    • Model ID: meta-llama/Meta-Llama-3.1-8B-Instruct
    • Model Configuration: see Colab link
  4. Training Configuration:

  5. Reproduction Steps:

  6. Expected Behavior:
    The code should download and fine-tune the model meta-llama/Meta-Llama-3.1-8B-Instruct which is specifically indicated at the top.

  7. Actual Behavior:
    Instead, the code downloads and uses models--unsloth--meta-llama-3.1-8b-instruct-unsloth-bnb-4bit, which is not the model I've expressly indicated. Worse, it makes no mention that the model was swapped behind my back.

On top of all that, I cannot find a model with this exact spelling on Hugging Face. Instead, I was able to find models--unsloth--Meta-Llama-3.1-8B-Instruct-unsloth-bnb-4bit which seems identical (same file sizes) but some initials are capitalized. I had this model pre-cached to save time, but Unsloth ignored it, and downloaded the same thing, and arbitrarily changed the spelling of the name.

In other words:

  • it does not download the model I've requested
  • it downloads a different model, and makes no mention that this is happening
  • the model being downloaded has the spelling of the name changed for no good reason
  1. Additional notes:
    Guys, I like Unsloth, but it's stuff like this that makes people lose their trust in your code.

Please make sure your code has a deterministic behavior. Please avoid making sneaky changes, without informing the user that you're doing that.

Activity

  1. shimmyshimmer commented on Apr 26, 2025

    @shimmyshimmer
    Member

    You did load_in_4bit=True which means you're doing qlora 4bit finetuning and so it will use the 4bit model.

    Also, the reason why we do not directly download from Meta was purposely done because they require your information and request of access aka a HF token. If we enabled you to download Meta's actual model, it would just fail as it restricted. This was not 'sneaky' and it does download the model you designated because you wanted to do 4bit qlora finetuning.

    Meta does not have any uploaded 4bit versions. We are the only ones who upload them.

    If you want to use the exact model, you must have your token for Llama and have access to it. See here: https://docs.unsloth.ai/basics/errors-troubleshooting/unsloth-environment-flags

    model, tokenizer = FastVisionModel.from_pretrained( "Qwen/Qwen2-VL-7B-Instruct", use_exact_model_name = True, )

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions