Skip to content

Added GGUF Support for Qwen2 Vision Model - #1799

Closed
adityaghai07 wants to merge 5 commits into
unslothai:mainfrom
adityaghai07:gguf_support_qwen2_VL
Closed

adityaghai07 wants to merge 5 commits into
unslothai:mainfrom
adityaghai07:gguf_support_qwen2_VL

Conversation

@adityaghai07

Copy link
Copy Markdown
Contributor

GGUF Export Support for Qwen2 Vision Models

Feature Overview

Added direct GGUF export capability for vision finetunes, supporting all available Qwen2 Vision Models.

Implementation Details

  • Enables direct export of vision finetunes to GGUF format
  • Compatible with the complete range of Qwen2 Vision Models
  • Utilizes core conversion logic adapted from llama.cpp.qwen2vl

Contributors

This feature was developed in collaboration with @Captain-T2004.

@adityaghai07

Copy link
Copy Markdown
Contributor Author

@danielhanchen The code demonstrates successful fine-tuning of Qwen2 Vision models (both 7B and 2B variants) and adds support for local deployment and GGUF model uploads to Hugging Face Hub. I collaborated with Captain-T2004 on this issue.

Colab Notebooks
Qwen2 7B VL Notebook
Qwen2 2B VL Notebook

HuggingFace Repo
Qwen2 2B GGUF
Qwen2 7B GGUF

@Captain-T2004

Copy link
Copy Markdown
Contributor

@danielhanchen, can you please review it and tell us if any additional changes are required?

@danielhanchen

Copy link
Copy Markdown
Member

Oh that reminded me - is the surgery file from https://github.com/ggml-org/llama.cpp/blob/master/examples/llava/qwen2_vl_surgery.py?

Could https://github.com/ggml-org/llama.cpp/blob/master/examples/llava/llava_surgery.py also work somehow?

Could you guys instead of copying pasting, rather get the latest - ie:

file = requests.get("https://raw.githubusercontent.com/ggml-org/llama.cpp/refs/heads/master/examples/llava/llava_surgery.py").content
with open("surgery.py", "w") as f: f.write(file)

You can also use unsloth-zoo's create_new_function which dynamically creates and imports functions on the fly:

created_module = create_new_function(
        f"LlavaSurgery",
        source_file,
        f"os",
        [],
        overwrite = True,
    )

@adityaghai07 adityaghai07 closed this by deleting the head repository Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants