Skip to content

convert_lora_to_gguf: support Qwen3.5/3.8 multimodal LoRA - #27995

Closed
the-pgh-cid wants to merge 1 commit into
ggml-org:masterfrom
the-pgh-cid:fix/qwen35-38-multimodal-lora-gguf
Closed

convert_lora_to_gguf: support Qwen3.5/3.8 multimodal LoRA#27995
the-pgh-cid wants to merge 1 commit into
ggml-org:masterfrom
the-pgh-cid:fix/qwen35-38-multimodal-lora-gguf

Conversation

@the-pgh-cid

@the-pgh-cid the-pgh-cid commented Aug 30, 2026

Copy link
Copy Markdown

Overview

Fix convert_lora_to_gguf.py so a LoRA trained on a Qwen3.5/3.8 multimodal base (architecture Qwen3_5ForConditionalGeneration, e.g. Qwen/Qwen3.8-27B) converts to GGUF instead of failing.

The failure: ValueError: Can not map tensor 'model.language_model.layers.11.self_attn.k_proj.weight'

Root cause: multimodal conditional-generation bases nest the language stack under model.language_model.layers.N.... get_base_tensor_name() strips only base_model.model., so the mapped name still has the language_model. segment, which the base tensor map does not recognize. The base converter (convert_hf_to_gguf.py) already strips language_model. when building the base GGUF; the LoRA converter never applies the same strip.

The change is one line in get_base_tensor_name:

base_name = base_name.replace("model.language_model.", "model.")

It applies only to the exact prefix the base converter already strips. Dense (non-multimodal) models have no language_model. in their names, so they are unaffected.

Additional information

Verified on Qwen/Qwen3.8-27B: a PEFT LoRA (r=16, attention projections only) with 128 tensors converts cleanly after the fix. Before the fix the same command fails with the error above. The adapter (F16 GGUF, 21MB, 128 tensors) loads and serves against the base.

Reproduction:

python convert_lora_to_gguf.py <adapter_dir> \
  --base /path/to/Qwen3.8-27B-HF --outfile out.gguf

Requirements

  • I have read and agree with the contributing guidelines.
  • AI usage disclosure: YES. I diagnosed the root cause with assistance from an AI coding agent; the fix is a one-line tensor-name strip that I reviewed, tested, and own. Per AGENTS.md, I am responsible for this change and can discuss it independently.

@ggml-gh-bot

ggml-gh-bot Bot commented Aug 30, 2026

Copy link
Copy Markdown

Hi @the-pgh-cid, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Aug 30, 2026
@github-actions
github-actions Bot marked this pull request as draft August 30, 2026 00:10
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Aug 30, 2026
@the-pgh-cid
the-pgh-cid marked this pull request as ready for review August 30, 2026 00:23
@CISC

CISC commented Aug 30, 2026

Copy link
Copy Markdown
Member

Are you using the latest script? Just as in the base converter lora conversion goes through the same tensor filtering and language_model gets filtered here:

if "language_model." in name:
name = name.replace("language_model.", "")

@the-pgh-cid

Copy link
Copy Markdown
Author

It is very likely that I am using an older script. Now, with pie on my face, I will head back and check and see if my brain is also plugged in, so to speak lol. thank you. I was absolutely using 9138 from a June 16 pull. My current fork supercedes my predated cuda build, and I never thought to look there first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants