import torch from transformers import Qwen3OmniMoeThinkerForConditionalGeneration model_path = '/workspace/echoloc/Qwen3-Omni-Instruct/' # 仅加载元数据或在 CPU 上加载第一层,非常快 model = Qwen3OmniMoeThinkerForConditionalGeneration.from_pretrained( model_path, torch_dtype=torch.bfloat16, device_map="cpu", trust_remote_code=True ) # 打印层结构 print("Model Structure Path:") # Qwen Omni 结构通常是 model.model.layers (或者是 model.language_model.model.layers) if hasattr(model.model, "layers"): target_layer = model.model.layers[0] elif hasattr(model.language_model.model, "layers"): target_layer = model.language_model.model.layers[0] else: target_layer = "Could not find layers" print(f"Target Layer Class: {type(target_layer)}")