Skip to content

feat: add split qkv support to moss-image main blocks - #2153

Open
wbruna wants to merge 1 commit into
leejet:masterfrom
wbruna:sd_mosi_split_qkv
Open

wbruna wants to merge 1 commit into
leejet:masterfrom
wbruna:sd_mosi_split_qkv

Conversation

@wbruna

@wbruna wbruna commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds compatibility code to support split qkv tensors, for GGUFs provided by https://huggingface.co/realrebelai/MOSS-Image_GGUFs .

Checklist

Summary by CodeRabbit

  • New Features
    • Added support for image models that use separate query, key, and value projections, alongside models using combined projections.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 31c10e04-9bb7-4e2a-8de4-1b2b00ef6216
📥 Commits

Reviewing files that changed from the base of the PR and between f0aac52 and 51e7839.

📒 Files selected for processing: 1
  • src/model/diffusion/moss_image.hpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

MOSS image configuration detects whether model weights use separate QKV projections. Each block then uses separate query, key, and value projections or the existing combined projection.

Changes: MOSS Image QKV projections

Layer / File(s) Summary
Detect projection layout
src/model/diffusion/moss_image.hpp
MOSSImageConfig adds split_qkv, which weight detection sets when layers.0.proj.q.weight is present.
Build and apply QKV projections
src/model/diffusion/moss_image.hpp
Block uses separate query, key, and value projections when split_qkv is true. Otherwise, it uses the combined projection. Both paths retain Q/K normalization.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: leejet

Merge Risk: ⚪ Minimal · up to 51e78

No actionable issue was established for this change. The split-layout selection appears ready for normal merge checks.

Security architecture risk: 🔵 Low · up to 51e78

The additional checkpoint layout remains subject to existing parameter and shape checks. No new privilege or trust-boundary bypass was identified. Interrupted loading and subsequent recovery were not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A party controlling supplied checkpoint names can select the projection layout. In the inspected change, that influence remains within existing model construction and inference execution; it does not add a credential, network, or cross-service authority path. External hosting and tenant isolation were not established.

Trust Boundaries and Controls

  • observed — The selected parameters remain subject to existing metadata validation. Missing required sources and shape mismatches cause validation failure, and engine initialization stops on validation or eager-loading failure. A lone split-layout probe therefore does not bypass completeness checks.

Resilience and Maintainability Implications

  • observed — Existing loading requires every requested tensor name to be loaded successfully. On ordinary allocation or loading failure, newly created storage is released and associated tensor pointers and loaded flags are reset. Parameter preparation returns failure before staging when loading fails. These unchanged controls contain ordinary partial-load failures; forced interruption and retry recovery remain unverified.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding split QKV support to MOSS-Image main blocks.
Description check Passed The description includes a focused summary and a completed checklist. The optional Related Issue / Discussion and Additional Information sections are not included, but the description is otherwise suf…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes a focused summary and a completed checklist. The optional Related Issue / Discussion and Additional Information sections are not included, but the description is otherwise sufficient.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

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.

1 participant