[model, omni] feat: Qwen3-Omni Thinker LoRA for RL training (#3915)
Signed-off-by: Qing An <qa4@rice.edu> Co-authored-by: Samit <285365963@qq.com>
This commit is contained in:
1 parent
5dfdf584dd
commit
57e5f0fe69
2 files changed
+27
-3
No files matched your search
@@ -295,6 +295,15 @@ class AsyncOmni(EngineClient, OmniBase):
|
|||||||
# Start final output dispatcher on the first call to generate()
|
# Start final output dispatcher on the first call to generate()
|
||||||
self._final_output_handler()
|
self._final_output_handler()
|
||||||
|
|
||||||
|
# Forward bare sampling_params (e.g. from /v1/completions) as the stage-0 entry.
|
||||||
|
if sampling_params_list is None and sampling_params is not None:
|
||||||
|
if self.num_stages == 1:
|
||||||
|
sampling_params_list = [sampling_params]
|
||||||
|
else:
|
||||||
|
default = list(self.default_sampling_params_list)
|
||||||
|
default[0] = sampling_params
|
||||||
|
sampling_params_list = default
|
||||||
|
|
||||||
# Expand sampling params for PD disaggregation (user may provide N-1 params)
|
# Expand sampling params for PD disaggregation (user may provide N-1 params)
|
||||||
if (
|
if (
|
||||||
sampling_params_list is not None
|
sampling_params_list is not None
|
||||||
@@ -919,8 +928,14 @@ class AsyncOmni(EngineClient, OmniBase):
|
|||||||
for result in results:
|
for result in results:
|
||||||
if isinstance(result, dict) and result.get("todo"):
|
if isinstance(result, dict) and result.get("todo"):
|
||||||
continue
|
continue
|
||||||
if isinstance(result, list):
|
if isinstance(result, (list, set)):
|
||||||
merged.update(result)
|
for item in result:
|
||||||
|
if isinstance(item, (list, set)):
|
||||||
|
merged.update(item)
|
||||||
|
elif isinstance(item, int):
|
||||||
|
merged.add(item)
|
||||||
|
elif isinstance(result, int):
|
||||||
|
merged.add(result)
|
||||||
return sorted(merged)
|
return sorted(merged)
|
||||||
|
|
||||||
async def pin_lora(self, adapter_id: int) -> bool:
|
async def pin_lora(self, adapter_id: int) -> bool:
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ from vllm.model_executor.layers.quantization import QuantizationConfig
|
|||||||
from vllm.model_executor.layers.vocab_parallel_embedding import ParallelLMHead
|
from vllm.model_executor.layers.vocab_parallel_embedding import ParallelLMHead
|
||||||
from vllm.model_executor.models.interfaces import (
|
from vllm.model_executor.models.interfaces import (
|
||||||
MultiModalEmbeddings,
|
MultiModalEmbeddings,
|
||||||
|
SupportsLoRA,
|
||||||
SupportsMRoPE,
|
SupportsMRoPE,
|
||||||
SupportsMultiModal,
|
SupportsMultiModal,
|
||||||
SupportsPP,
|
SupportsPP,
|
||||||
@@ -1071,6 +1072,7 @@ class Qwen3OmniMoeThinkerForConditionalGeneration(
|
|||||||
nn.Module,
|
nn.Module,
|
||||||
SupportsMultiModal,
|
SupportsMultiModal,
|
||||||
SupportsPP,
|
SupportsPP,
|
||||||
|
SupportsLoRA,
|
||||||
SupportsMRoPE,
|
SupportsMRoPE,
|
||||||
Qwen3OmniMoeConditionalGenerationMixin,
|
Qwen3OmniMoeConditionalGenerationMixin,
|
||||||
SupportsTranscription,
|
SupportsTranscription,
|
||||||
@@ -1089,6 +1091,11 @@ class Qwen3OmniMoeThinkerForConditionalGeneration(
|
|||||||
"k_proj",
|
"k_proj",
|
||||||
"v_proj",
|
"v_proj",
|
||||||
],
|
],
|
||||||
|
"attn.qkv": [
|
||||||
|
"attn.q",
|
||||||
|
"attn.k",
|
||||||
|
"attn.v",
|
||||||
|
],
|
||||||
"gate_up_proj": [
|
"gate_up_proj": [
|
||||||
"gate_proj",
|
"gate_proj",
|
||||||
"up_proj",
|
"up_proj",
|
||||||
@@ -1111,7 +1118,8 @@ class Qwen3OmniMoeThinkerForConditionalGeneration(
|
|||||||
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
|
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.vllm_config = vllm_config # needed for torch compile forward context
|
self.vllm_config = vllm_config # needed for torch compile forward context
|
||||||
thinker_config: Qwen3OmniMoeThinkerConfig = vllm_config.model_config.hf_config
|
hf_config = vllm_config.model_config.hf_config
|
||||||
|
thinker_config: Qwen3OmniMoeThinkerConfig = getattr(hf_config, "thinker_config", None) or hf_config
|
||||||
quant_config = vllm_config.quant_config
|
quant_config = vllm_config.quant_config
|
||||||
multimodal_config = vllm_config.model_config.multimodal_config
|
multimodal_config = vllm_config.model_config.multimodal_config
|
||||||
self.config = thinker_config
|
self.config = thinker_config
|
||||||
@@ -1660,6 +1668,7 @@ class Qwen3OmniMoeThinkerForConditionalGeneration(
|
|||||||
self,
|
self,
|
||||||
input_tokens: list[int],
|
input_tokens: list[int],
|
||||||
mm_features: list[MultiModalFeatureSpec],
|
mm_features: list[MultiModalFeatureSpec],
|
||||||
|
**kwargs,
|
||||||
) -> tuple[torch.Tensor, int]:
|
) -> tuple[torch.Tensor, int]:
|
||||||
"""Compute M-RoPE input positions using mm_features directly."""
|
"""Compute M-RoPE input positions using mm_features directly."""
|
||||||
seq_len = len(input_tokens)
|
seq_len = len(input_tokens)
|
||||||
|
|||||||
Reference in new issue
Block a user