Add Cosmos3 Edge Reasoner model (#48291)

Signed-off-by: Bartosz Stefaniak <bstefaniak@nvidia.com>
Co-authored-by: Bartosz Stefaniak <bstefaniak@nvidia.com>
This commit is contained in:
adsridhar
2026-07-14 08:14:50 +00:00
committed by GitHub
co-authored by Bartosz Stefaniak
parent c9a788eedc
commit 894ebb27f5
13 changed files with 1474 additions and 27 deletions
+4 -21
View File
@@ -3,8 +3,6 @@
import regex
from vllm.config import VllmConfig
from vllm.model_executor.model_loader.default_loader import DefaultModelLoader
from vllm.model_executor.models.qwen3_vl import Qwen3VLForConditionalGeneration
from vllm.model_executor.models.utils import WeightsMapper
@@ -52,22 +50,7 @@ class Cosmos3ForConditionalGeneration(Qwen3VLForConditionalGeneration):
},
)
allow_patterns_overrides = ["transformer/*.safetensors"]
"""
Cosmos3 checkpoint separates transformer weights and vision_encoder weights
into separate directories, as it's in diffusers checkpoint format.
Using secondary_weights here to load all necessary weights for
the Reasoner-only part.
"""
def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None:
super().__init__(vllm_config=vllm_config, prefix=prefix)
self.secondary_weights = [
DefaultModelLoader.Source(
model_or_path=vllm_config.model_config.model,
revision=vllm_config.model_config.revision,
prefix="",
allow_patterns_overrides=["vision_encoder/*.safetensors"],
),
]
# Cosmos3 unified Diffusers checkpoints store reasoner weights across
# transformer/ and vision_encoder/. Match both while excluding VAE and
# sound_tokenizer weights; the mapper drops generation-only tensors.
allow_patterns_overrides = ["[tv]*er/*.safetensors"]