MCPcopy Index your code
hub / github.com/huggingface/diffusers / get_transformer_config

Function get_transformer_config

scripts/convert_wan_to_diffusers.py:328–602  ·  view source on GitHub ↗
(model_type: str)

Source from the content-addressed store, hash-verified

326
327
328def get_transformer_config(model_type: str) -> Tuple[Dict[str, Any], ...]:
329 if model_type == "Wan-T2V-1.3B":
330 config = {
331 "model_id": "StevenZhang/Wan2.1-T2V-1.3B-Diff",
332 "diffusers_config": {
333 "added_kv_proj_dim": None,
334 "attention_head_dim": 128,
335 "cross_attn_norm": True,
336 "eps": 1e-06,
337 "ffn_dim": 8960,
338 "freq_dim": 256,
339 "in_channels": 16,
340 "num_attention_heads": 12,
341 "num_layers": 30,
342 "out_channels": 16,
343 "patch_size": [1, 2, 2],
344 "qk_norm": "rms_norm_across_heads",
345 "text_dim": 4096,
346 },
347 }
348 RENAME_DICT = TRANSFORMER_KEYS_RENAME_DICT
349 SPECIAL_KEYS_REMAP = TRANSFORMER_SPECIAL_KEYS_REMAP
350 elif model_type == "Wan-T2V-14B":
351 config = {
352 "model_id": "StevenZhang/Wan2.1-T2V-14B-Diff",
353 "diffusers_config": {
354 "added_kv_proj_dim": None,
355 "attention_head_dim": 128,
356 "cross_attn_norm": True,
357 "eps": 1e-06,
358 "ffn_dim": 13824,
359 "freq_dim": 256,
360 "in_channels": 16,
361 "num_attention_heads": 40,
362 "num_layers": 40,
363 "out_channels": 16,
364 "patch_size": [1, 2, 2],
365 "qk_norm": "rms_norm_across_heads",
366 "text_dim": 4096,
367 },
368 }
369 RENAME_DICT = TRANSFORMER_KEYS_RENAME_DICT
370 SPECIAL_KEYS_REMAP = TRANSFORMER_SPECIAL_KEYS_REMAP
371 elif model_type == "Wan-I2V-14B-480p":
372 config = {
373 "model_id": "StevenZhang/Wan2.1-I2V-14B-480P-Diff",
374 "diffusers_config": {
375 "image_dim": 1280,
376 "added_kv_proj_dim": 5120,
377 "attention_head_dim": 128,
378 "cross_attn_norm": True,
379 "eps": 1e-06,
380 "ffn_dim": 13824,
381 "freq_dim": 256,
382 "in_channels": 36,
383 "num_attention_heads": 40,
384 "num_layers": 40,
385 "out_channels": 16,

Callers 1

convert_transformerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…