Skip to content

merging trained lora model from unsloth into original mistralai/MistralAI-7B-v0.1 for vllm serving #95

Closed

Description

@DoctorSlimm

Understanding the need to serve efficiently, I was wondering if anybody here has experience with merging the mistral model trained with unsloth using PEFT back into the original mistral ai model for compatibility and serving via vllm framework?

Best Regards, Lukas

Activity

  1. danielhanchen commented on Jan 17, 2024

    @danielhanchen
    Member

    @DoctorSlimm Techncially unsloth_save_model does that. See the Mistral notebook on the Github readme and scroll down a bit :)

    However, it's not stable. In the next 1-2 days, I will release simple conversions which include:

    model.save_pretrained_merged
    model.push_to_hub_merged
    model.save_pretrained_gguf
    model.push_to_hub_gguf
    

    So if you want a more stable version, wait a few days!

  2. DoctorSlimm commented on Jan 18, 2024

    @DoctorSlimm
    Author

    thank you for that @danielhanchen ! congratulations on the good work :) any plans to include mistral Instruct in your model collection for fine tuning?

  3. danielhanchen commented on Jan 18, 2024

    @danielhanchen
    Member

    @DoctorSlimm Oh you can easily just all it - we support any model based off from Mistral / Llama, ie Mistral instruct, Qwen, Codellama, Tiny Llama, Deepseek - just edit the "unsloth/mistral-7b-bnb-4bit" to "mistralai/Mistral-7B-Instruct-v0.2"

  4. danielhanchen commented on Jan 18, 2024

    @danielhanchen
    Member

    Unless of course you would like a pre-quantized version which makes downloading 4x faster and free up 500MB of VRAM ie: unsloth/mistral-7b-instruct-v0.2-bnb-4bit

  5. DoctorSlimm commented on Jan 18, 2024

    @DoctorSlimm
    Author

    @danielhanchen thats incredible, I am kind of a noob and was wondering if using these fast training hacks in your experience affects the final model quality when merged back into the original? as opposed to trainining without unsloth?

  6. danielhanchen commented on Jan 18, 2024

    @danielhanchen
    Member

    @DoctorSlimm Oh so we don't do any approximations - all optimizations are exact vs QLoRA.

    If you're using QLoRA, technically our merging retains even higher accuracy since HF currently merges by 4bit -> 16bit -> 4bit. However, our merges can stop at the 16bit part.

  7. DoctorSlimm commented on Jan 18, 2024

    @DoctorSlimm
    Author

    @danielhanchen wow that is incredible thank you, your work is significantly helping us at https://usemozart.com

  8. danielhanchen commented on Jan 20, 2024

    @danielhanchen
    Member

    @DoctorSlimm Sorry on the delayed response! Just added in native 16bit merging with the new release!

    For 16bit merging for VLLM:

    model.push_to_hub_merged("hf/dan", tokenizer)
    model.save_pretrained_merged("dan", tokenizer)
    

    And to GGUF:

    model.push_to_hub_gguf("hf/dan", tokenizer, quantization_method = "q8_0")
    model.save_pretrained_gguf("hf/dan", tokenizer, quantization_method = "q8_0")
    

    Update Unsloth with pip install --upgrade git+https://github.com/unslothai/unsloth.git or look at our updated notebooks!

  9. DoctorSlimm commented on Jan 21, 2024

    @DoctorSlimm
    Author

    @danielhanchen you are doing a fantastic job congratulations! additionally i have noted that unsloth/mistral-7b-instruct-v0.2-bnb-4bit does not seem to be downloading for me, perhaps you have the repo on private on hf?

  10. danielhanchen commented on Jan 21, 2024

    @danielhanchen
    Member

    @DoctorSlimm OHH noo!!! I haven't uploaded one yet - I'll do it in a few hours :))))

  11. danielhanchen commented on Jan 21, 2024

    @danielhanchen
    Member

    @DoctorSlimm Added it just now!!! unsloth/mistral-7b-instruct-v0.2-bnb-4bit

  12. DoctorSlimm commented on Jan 21, 2024

    @DoctorSlimm
    Author

    @danielhanchen so exciting! will it train faster? im also running a startup with my younger brother :))) Also: how do you convert the base model to the 4bit version you jjust pushed? or is that a company secret

  13. danielhanchen commented on Jan 22, 2024

    @danielhanchen
    Member

    @DoctorSlimm Yes 2x faster + 60% less VRAM use!! Oh yes!! We're identical!! :)) Oh we just quantize it and upload it :) I actually forgot where, but it should be in HF docs somewhere :)

  14. added a commit that references this issue on May 19, 2026
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

    fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions