[LoRA] Add an end-to-end single-adapter runtime path for Qwen2 - #3515
[LoRA] Add an end-to-end single-adapter runtime path for Qwen2#3515MagellaX wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for compiling and packaging separate low-rank PEFT LoRA adapter tensors into the runtime graph (runtime LoRA) for Qwen2 models using q0f16 quantization and single-GPU execution. It adds CLI options for runtime LoRA mode, implements PEFT adapter configuration validation, and integrates low-rank linear layers into the Qwen2 attention and MLP blocks. A critical issue was identified in qwen2_model.py where op.concat incorrectly uses the dim parameter instead of axis, which will cause a compilation failure in TVM Relax.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@babusid @MasterJH5574 any thoughts guys?? |
What this does
This adds a correctness-first runtime LoRA path for Qwen2/Qwen2.5. Instead of merging the adapter into the base weights,
convert_weight --lora-mode runtimepackages the PEFT A/B tensors separately andcompile --lora-adapteradds the low-rank branches to the model graph. The existing PEFT merge flow remains the default.This is intended to establish the runnable end-to-end path requested in apache/tvm#18890 before we settle the longer-term pool/runtime API tracked in mlc-llm#3446.
Current scope
q0f16, TP=1LoRAPool, or Punica kernels yetCommands
Validation
Tested on an A100 with CUDA 12.8 using
Qwen/Qwen2.5-0.5B-Instructandvindows/qwen2.5-0.5b-text-to-sql:52 passed, 13 skipped, 315 deselectedI’m opening this as a draft so we can validate the end-to-end boundary and agree whether the next patch should introduce a standalone adapter/
LoRAPoolruntime object before adding request-time adapter IDs and multi-adapter batching.