techfreakworm commited on
Commit
c80a8b9
·
unverified ·
1 Parent(s): fee06dd

feat(models): MODEL_REGISTRY mapping filenames to HF repos

Browse files
Files changed (2) hide show
  1. models.py +96 -0
  2. tests/test_models.py +14 -0
models.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Model file registry: maps filename -> (HuggingFace repo, subfolder).
2
+
3
+ Lookups are by filename only — the same filename in two different repos is not
4
+ supported. If that ever happens we'll qualify by ComfyUI loader-type.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ from dataclasses import dataclass
9
+
10
+
11
+ @dataclass(frozen=True)
12
+ class ModelEntry:
13
+ repo_id: str
14
+ subfolder: str = ""
15
+ comfy_type: str = "checkpoints" # ComfyUI models/<comfy_type>/ subdirectory
16
+
17
+
18
+ MODEL_REGISTRY: dict[str, ModelEntry] = {
19
+ # Main LTX 2.3 transformer + LoRAs + upscalers
20
+ "ltx-2.3-22b-distilled.safetensors": ModelEntry(
21
+ "Lightricks/LTX-2.3", comfy_type="checkpoints"
22
+ ),
23
+ "ltx-2.3-22b-dev.safetensors": ModelEntry(
24
+ "Lightricks/LTX-2.3", comfy_type="checkpoints"
25
+ ),
26
+ "ltx-2.3-spatial-upscaler-x2-1.0.safetensors": ModelEntry(
27
+ "Lightricks/LTX-2.3", comfy_type="upscale_models"
28
+ ),
29
+ "ltx-2.3-22b-distilled-lora-384.safetensors": ModelEntry(
30
+ "Lightricks/LTX-2.3", comfy_type="loras"
31
+ ),
32
+ # Gemma 3 12B (5 shards + tokenizer/preprocessor)
33
+ **{
34
+ f"model-{i:05d}-of-00005.safetensors": ModelEntry(
35
+ "google/gemma-3-12b-it-qat-q4_0-unquantized",
36
+ comfy_type="text_encoders",
37
+ subfolder="gemma-3-12b-it",
38
+ )
39
+ for i in range(1, 6)
40
+ },
41
+ "model.safetensors.index.json": ModelEntry(
42
+ "google/gemma-3-12b-it-qat-q4_0-unquantized",
43
+ comfy_type="text_encoders",
44
+ subfolder="gemma-3-12b-it",
45
+ ),
46
+ "tokenizer.model": ModelEntry(
47
+ "google/gemma-3-12b-it-qat-q4_0-unquantized",
48
+ comfy_type="text_encoders",
49
+ subfolder="gemma-3-12b-it",
50
+ ),
51
+ "preprocessor_config.json": ModelEntry(
52
+ "google/gemma-3-12b-it-qat-q4_0-unquantized",
53
+ comfy_type="text_encoders",
54
+ subfolder="gemma-3-12b-it",
55
+ ),
56
+ # Kijai's LTX 2.3 ComfyUI assets
57
+ "LTX23_video_vae_bf16.safetensors": ModelEntry(
58
+ "Kijai/LTX2.3_comfy", comfy_type="vae"
59
+ ),
60
+ "LTX23_audio_vae_bf16.safetensors": ModelEntry(
61
+ "Kijai/LTX2.3_comfy", comfy_type="vae"
62
+ ),
63
+ "ltx-2.3_text_projection_bf16.safetensors": ModelEntry(
64
+ "Kijai/LTX2.3_comfy", comfy_type="text_encoders"
65
+ ),
66
+ # IC-LoRAs
67
+ "ltx-2.3-22b-ic-lora-union-control-ref0.5.safetensors": ModelEntry(
68
+ "Lightricks/LTX-2.3-22b-IC-LoRA-Union-Control", comfy_type="loras"
69
+ ),
70
+ "ltx-2.3-22b-ic-lora-motion-track-control-ref0.5.safetensors": ModelEntry(
71
+ "Lightricks/LTX-2.3-22b-IC-LoRA-Motion-Track-Control", comfy_type="loras"
72
+ ),
73
+ "ltx-2-19b-ic-lora-detailer.safetensors": ModelEntry(
74
+ "Lightricks/LTX-2-19b-IC-LoRA-Detailer", comfy_type="loras"
75
+ ),
76
+ "ltx-2-19b-ic-lora-pose-control.safetensors": ModelEntry(
77
+ "Lightricks/LTX-2-19b-IC-LoRA-Pose-Control", comfy_type="loras"
78
+ ),
79
+ # Camera-control LoRAs (one repo each — explicit hyphen-aware capitalization
80
+ # produces "Dolly-In", "Dolly-Out", etc. matching the actual HF org repo names.)
81
+ **{
82
+ f"ltx-2-19b-lora-camera-control-{movement}.safetensors": ModelEntry(
83
+ f"Lightricks/LTX-2-19b-LoRA-Camera-Control-{'-'.join(p.capitalize() for p in movement.split('-'))}",
84
+ comfy_type="loras",
85
+ )
86
+ for movement in (
87
+ "static",
88
+ "dolly-in",
89
+ "dolly-out",
90
+ "dolly-left",
91
+ "dolly-right",
92
+ "jib-up",
93
+ "jib-down",
94
+ )
95
+ },
96
+ }
tests/test_models.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Unit tests for models.py — MODEL_REGISTRY and ensure_models_for_mode."""
2
+ import models
3
+
4
+
5
+ def test_model_registry_resolves_known_files():
6
+ assert models.MODEL_REGISTRY["ltx-2.3-22b-distilled.safetensors"].repo_id == "Lightricks/LTX-2.3"
7
+ assert models.MODEL_REGISTRY["ltx-2.3-22b-distilled.safetensors"].subfolder == ""
8
+
9
+
10
+ def test_model_registry_includes_gemma_shards():
11
+ for i in range(1, 6):
12
+ key = f"model-{i:05d}-of-00005.safetensors"
13
+ assert key in models.MODEL_REGISTRY
14
+ assert "gemma-3-12b-it" in models.MODEL_REGISTRY[key].repo_id