Skip to content

Commit e9afcc4

Browse files
committed
inspect connectors
1 parent 272f99c commit e9afcc4

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

inspect_connectors.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
import torch
3+
from safetensors.torch import load_file
4+
from huggingface_hub import snapshot_download
5+
import os
6+
7+
def inspect_connectors():
8+
repo_id = "Lightricks/LTX-2"
9+
subfolder = "connectors"
10+
11+
print(f"Downloading {subfolder} from {repo_id}...")
12+
try:
13+
path = snapshot_download(repo_id, allow_patterns=[f"{subfolder}/*"])
14+
print(f"Downloaded to {path}")
15+
16+
folder_path = os.path.join(path, subfolder)
17+
files = [f for f in os.listdir(folder_path) if f.endswith(".safetensors")]
18+
19+
for f in files:
20+
print(f"\nScanning {f}...")
21+
file_path = os.path.join(folder_path, f)
22+
state_dict = load_file(file_path)
23+
for key, value in state_dict.items():
24+
print(f"{key}: {value.shape}")
25+
26+
except Exception as e:
27+
print(f"Error: {e}")
28+
29+
if __name__ == "__main__":
30+
inspect_connectors()

src/maxdiffusion/models/ltx2/ltx2_utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ def load_vocoder_weights(
372372
cpu = jax.local_devices(backend="cpu")[0]
373373

374374
for pt_key, tensor in tensors.items():
375-
# Initial renaming
376375
key = rename_for_ltx2_vocoder(pt_key)
377376
parts = key.split(".")
378377

@@ -388,13 +387,10 @@ def load_vocoder_weights(
388387

389388
flax_key = tuple(flax_key_parts)
390389

391-
# Transpose weights
392390
if flax_key[-1] == "kernel":
393391
if "upsamplers" in flax_key:
394-
# ConvTranspose: (In, Out, K) -> (K, In, Out)
395392
tensor = tensor.transpose(2, 0, 1)
396393
else:
397-
# Conv: (Out, In, K) -> (K, In, Out)
398394
tensor = tensor.transpose(2, 1, 0)
399395

400396
flax_state_dict[flax_key] = jax.device_put(tensor, device=cpu)

0 commit comments

Comments
 (0)