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

Function convert_ltx2_connectors

scripts/convert_ltx2_to_diffusers.py:482–506  ·  view source on GitHub ↗
(original_state_dict: dict[str, Any], version: str)

Source from the content-addressed store, hash-verified

480
481
482def convert_ltx2_connectors(original_state_dict: dict[str, Any], version: str) -> LTX2TextConnectors:
483 config, rename_dict, special_keys_remap = get_ltx2_connectors_config(version)
484 diffusers_config = config["diffusers_config"]
485
486 _, connector_state_dict = split_transformer_and_connector_state_dict(original_state_dict)
487 if len(connector_state_dict) == 0:
488 raise ValueError("No connector weights found in the provided state dict.")
489
490 with init_empty_weights():
491 connectors = LTX2TextConnectors.from_config(diffusers_config)
492
493 for key in list(connector_state_dict.keys()):
494 new_key = key[:]
495 for replace_key, rename_key in rename_dict.items():
496 new_key = new_key.replace(replace_key, rename_key)
497 update_state_dict_inplace(connector_state_dict, key, new_key)
498
499 for key in list(connector_state_dict.keys()):
500 for special_key, handler_fn_inplace in special_keys_remap.items():
501 if special_key not in key:
502 continue
503 handler_fn_inplace(key, connector_state_dict)
504
505 connectors.load_state_dict(connector_state_dict, strict=True, assign=True)
506 return connectors
507
508
509def get_ltx2_video_vae_config(

Callers 1

mainFunction · 0.85

Calls 5

from_configMethod · 0.45
load_state_dictMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…