File size: 797 Bytes
d8bfe4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)}")