Manidhar8008 Alissonerdx commited on
Commit
0c157fd
Β·
0 Parent(s):

Duplicate from Alissonerdx/LTX-Best-Face-ID

Browse files

Co-authored-by: Alisson Pereira Anjos <Alissonerdx@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ examples/sample_1.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ examples/sample_2.mp4 filter=lfs diff=lfs merge=lfs -text
38
+ examples/sample_3.mp4 filter=lfs diff=lfs merge=lfs -text
39
+ examples/sample_4.mp4 filter=lfs diff=lfs merge=lfs -text
40
+ examples/sample_5.mp4 filter=lfs diff=lfs merge=lfs -text
Best_FaceID_v1.0_ArcFace_Projector.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17902bed35afc46a20ec183113d431937814e4950f49726578c97702486d9922
3
+ size 69308896
Best_FaceID_v1.0_LoRA.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7aaab2f1bff2af121e0751120ad16a3e443b4223a04b78c51740029d25f17994
3
+ size 2466643384
README.md ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ base_model:
4
+ - Lightricks/LTX-2.3
5
+ tags:
6
+ - ltx-video
7
+ - identity-preservation
8
+ - ipt2v
9
+ - reference-to-video
10
+ - lora
11
+ - comfyui
12
+ - ltx2.3
13
+ pipeline_tag: text-to-video
14
+ ---
15
+
16
+ # LTX-Best-Face-ID β€” LTX-2.3 Identity LoRA (Reference-to-Video / IPT2V)
17
+
18
+ An identity-preserving **reference-to-video** LoRA for **LTX-2.3 (22B)**. Give it a reference
19
+ photo of a person + a text prompt, and it generates a video that keeps that person's identity.
20
+
21
+ Built with **overlap reference conditioning + TASS-RoPE (source-phase RoPE)** and a differentiable
22
+ **ArcFace identity loss**. Runs in ComfyUI via the companion **BFS Nodes**.
23
+
24
+
25
+ > **Status:** this is the first (overlap/TASS-RoPE) model. Other experimental variants
26
+ > (native Gemma-vision conditioning, timestep-split texture injection) may be released later if
27
+ > they prove out.
28
+
29
+ ---
30
+
31
+ ## 🎬 Examples
32
+
33
+ <!--
34
+ Drop result videos/gifs in an `assets/` folder in this repo and reference them below.
35
+ On the HF model page, .mp4 in a Markdown <video> tag renders inline; .gif works too.
36
+ Suggested layout: reference image (left) β†’ generated video (right), with the prompt underneath.
37
+ -->
38
+
39
+ <video src="https://huggingface.co/Alissonerdx/LTX-Best-Face-ID/resolve/main/examples/sample_1.mp4" controls autoplay loop muted></video>
40
+ <video src="https://huggingface.co/Alissonerdx/LTX-Best-Face-ID/resolve/main/examples/sample_2.mp4" controls autoplay loop muted></video>
41
+ <video src="https://huggingface.co/Alissonerdx/LTX-Best-Face-ID/resolve/main/examples/sample_3.mp4" controls autoplay loop muted></video>
42
+
43
+ ### With 2 Pass (Upscaled)
44
+ <video src="https://huggingface.co/Alissonerdx/LTX-Best-Face-ID/resolve/main/examples/sample_4.mp4" controls autoplay loop muted></video>
45
+ <video src="https://huggingface.co/Alissonerdx/LTX-Best-Face-ID/resolve/main/examples/sample_5.mp4" controls autoplay loop muted></video>
46
+ ---
47
+
48
+ ## What it does
49
+
50
+ - **Reference-to-video (ref_t2v):** one reference image β†’ video of that identity performing the
51
+ prompt's action.
52
+ - Identity is injected by placing the **reference latent** in the target's frame-0 RoPE grid
53
+ (overlap) and tagging it with a distinct **source phase** so the model knows it is a *reference*,
54
+ not the first frame to generate.
55
+ - An auxiliary **ArcFace face-similarity loss** on the decoded prediction sharpens the identity.
56
+
57
+ ---
58
+
59
+ ## How it works (technique)
60
+
61
+ ### Overlap reference + TASS-RoPE (source-phase)
62
+ The reference latent is concatenated to the video sequence sharing the frame-0 grid (classic
63
+ IC-LoRA "overlap"). To stop the reference from leaking into / being confused with the generated
64
+ first frame, each source gets a distinct **multiplicative RoPE phase**:
65
+
66
+ ```
67
+ phase[d] = source_id Β· phase_scale Β· ΞΈ^(βˆ’d/L) (ΞΈ = 10000)
68
+ target tokens: source_id = 0 (phase 0, exact no-op)
69
+ reference: source_id = 2 (distinct rotary "tag")
70
+ ```
71
+
72
+ This "source tag" lets the model separate *who is who* in the sequence and strongly improves
73
+ identity transfer. Because the tag is positional, the same mechanism generalizes to **multiple
74
+ references** (source_id = 2, 3, 4, …) for multi-subject conditioning.
75
+
76
+ > **TASS-RoPE** (*Temporal-Adjacent Spatial-Shifted RoPE*) is from **ST-DRC**, Chen et al.,
77
+ > *Spatial-Temporal Decoupled Reference Conditioning for Identity-Preserving Text-to-Video
78
+ > Generation* β€” [arXiv:2606.02441](https://arxiv.org/abs/2606.02441). This LoRA uses an
79
+ > overlap + per-source RoPE-phase variant of that idea.
80
+
81
+ ### ArcFace identity loss
82
+ During training the flow-matching prediction is decoded to pixels, the face is aligned and passed
83
+ through ArcFace (buffalo_l `w600k_r50`), and a cosine identity loss pulls the generated face toward
84
+ the reference embedding β€” the same recognition space used to evaluate identity.
85
+
86
+ ---
87
+
88
+ ## Training details
89
+
90
+ | | |
91
+ |---|---|
92
+ | Base model | LTX-2 (22B) |
93
+ | Method | LoRA (rank 128, alpha 128) |
94
+ | Conditioning | overlap reference latent + TASS-RoPE source-phase (`source_id=2`, `phase_scale=1.0`) |
95
+ | Aux loss | ArcFace identity loss (+ temporal identity consistency) |
96
+ | Data | reference-image ↔ video pairs (OpenS2V subset + HuMoSet), close-up / frontal identities |
97
+
98
+ ---
99
+
100
+
101
+ ## Reference image β€” what works best
102
+
103
+ This model was trained on face-focused reference images. Looking at the training data, every reference follows the same pattern:
104
+
105
+ - Close-up / bust crop β€” roughly chest-up, with the face large and clearly visible.
106
+ - A single subject, centered in the frame.
107
+ - Frontal or near-frontal (slight 3/4 angles are fine, but the face is always well exposed).
108
+ - Tightly cropped on the face/upper body β€” the training crops are about 460Γ—406 (nearly square).
109
+
110
+ Recommendation: for the best identity transfer, give the model a reference that looks like this β€” crop your image to the face / upper body. Full-body shots, wide shots, or images where the face is small and far away work noticeably worse, because the model never saw references like that during training.
111
+
112
+ In short: a clean, frontal, well-lit close-up of the face is the ideal reference.
113
+
114
+ ## Captions (IMPORTANT)
115
+
116
+ This model was trained on captions in the **`ref_t2v:`** format that **describe the scene and the
117
+ person's action** (not just "a person"). Identity in LTX is strongly prompt-driven β€” the more the
118
+ prompt describes, the better the identity holds. For best results:
119
+
120
+ - Prefix prompts with **`ref_t2v:`**.
121
+ - Describe the **action, setting, framing, camera** in present-progressive.
122
+ - Describing **identity attributes** of the reference person (skin tone, hair, eyes, facial hair,
123
+ glasses, face shape) **noticeably improves** the result.
124
+
125
+ The shared ComfyUI workflow includes a **Prompt Enhancer** that looks at the reference image (via
126
+ the model's own multimodal Gemma-3 text encoder) and automatically enriches your prompt with the
127
+ person's identity attributes β€” so you don't have to describe them by hand.
128
+
129
+ Example (enhanced):
130
+ ```
131
+ ref_t2v: A light-skinned man with long dark-brown hair past his shoulders, narrow rectangular
132
+ metal-frame glasses, light blue-gray eyes and light stubble is folding clothes in a laundry room,
133
+ medium-wide shot. He places the folded clothes into a basket, then carries it across the room.
134
+ Neutral indoor lighting, simple domestic environment.
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Usage (ComfyUI)
140
+
141
+ **Requires the BFS Nodes:** https://github.com/alisson-anjos/ComfyUI-BFSNodes
142
+
143
+ 1. Install ComfyUI-BFSNodes (ComfyUI Manager β†’ Install via Git URL, or clone into `custom_nodes/`).
144
+ Dependencies (`insightface`, `transformers`, …) install automatically.
145
+ 2. Load LTX-2 (checkpoint + the Gemma-3 text encoder / CLIP) as usual.
146
+ 3. Add the **LTX Identity Transfer** (overlap + source-phase) node; feed it the reference image.
147
+ 4. Load **this LoRA** on the MODEL path.
148
+ 5. Use the shared workflow (it wires the **Prompt Enhancer** β†’ identity node β†’ sampler).
149
+
150
+ A ready-made **workflow JSON** is included alongside the model.
151
+
152
+ ### About the ArcFace projector (optional β€” you don't need it)
153
+
154
+ The identity node has an optional **ArcFace projector** dropdown (it projects a face embedding into
155
+ extra conditioning tokens). **You can leave it on `None`.** In our experiments the projector's
156
+ effect was **marginal** β€” identity is carried almost entirely by the overlap reference latent (and
157
+ the prompt), so the projector adds very little on top and is not required for this model. It is kept
158
+ only as an optional extra; skipping it keeps the graph simpler with no meaningful quality loss.
159
+
160
+ ---
161
+
162
+ ## Tips for best results
163
+
164
+ - Use a **clean, frontal, well-lit close-up** as the reference β€” identity quality tracks reference
165
+ quality closely.
166
+ - Let the **Prompt Enhancer** add the identity attributes (or write them yourself).
167
+ - Keep the reference framing simple; busy/occluded reference faces degrade identity.
168
+
169
+ ---
170
+
171
+ ## Limitations
172
+
173
+ - **First-frame / "mask" tendency:** because identity comes from the raw reference *latent*, the
174
+ reference appearance (and framing / accessories like glasses) can partially copy into the video β€”
175
+ it can look like the reference is "pasted"/masked rather than freshly generated. Using a clean
176
+ frontal reference and the trim-first-frame node mitigates this.
177
+ - **Prompt dependence:** identity is much stronger when the prompt describes the person. A bare,
178
+ generic prompt gives weaker identity β€” use the Prompt Enhancer.
179
+ - **Close-up bias:** the training data skews to close-up / frontal faces, so full-body or
180
+ large-angle shots hold identity less well.
181
+ - **Metric caveat:** ArcFace similarity is unreliable on small / turned / occluded faces β€” judge
182
+ visually, not only by score.
183
+
184
+ ---
185
+
186
+ ## Citation
187
+
188
+ If you use this model, please cite the base model and the technique:
189
+
190
+ ```bibtex
191
+ @misc{ltx_best_face_id,
192
+ title = {LTX-Best-Face-ID: LTX-2.3 Identity LoRA (Reference-to-Video)},
193
+ author = {Alissonerdx},
194
+ year = {2026},
195
+ howpublished = {\url{https://huggingface.co/Alissonerdx/LTX-Best-Face-ID}}
196
+ }
197
+ ```
198
+
199
+ - **Base model:** LTX-2.3 (Lightricks).
200
+ - **TASS-RoPE / reference conditioning β€” ST-DRC:**
201
+
202
+ ```bibtex
203
+ @article{chen2026stdrc,
204
+ title = {Spatial-Temporal Decoupled Reference Conditioning for Identity-Preserving Text-to-Video Generation},
205
+ author = {Chen, Yuheng and Hu, Teng and Wang, Yuji and He, Qingdong and Ma, Lizhuang and Zhang, Jiangning},
206
+ journal = {arXiv preprint arXiv:2606.02441},
207
+ year = {2026}
208
+ }
209
+ ```
210
+
211
+ - **Identity loss:** ArcFace (Deng et al., 2019) via InsightFace `buffalo_l`.
212
+ - **Tooling:** [ComfyUI-BFSNodes](https://github.com/alisson-anjos/ComfyUI-BFSNodes).
213
+
214
+ ---
215
+
216
+ ## Acknowledgements
217
+
218
+ Trained on top of LTX-2. Identity supervision via InsightFace ArcFace. ComfyUI integration via
219
+ the BFS Nodes.
examples/sample_1.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ee90e7def91114800dd9deb24140f759918430c3144ba5844e349cc3e6b5d7d
3
+ size 3187643
examples/sample_2.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:988fb2c1e7453898a7dfbd7e339ce1cd73d5db5555b1cf5cf5903cf8fe7b9531
3
+ size 2030079
examples/sample_3.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98abcb60453fa8222f7e4c3fe4227fd32d385e8781dd6f9d376005c4ed123e95
3
+ size 2622172
examples/sample_4.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:931a6a45ddf620ae2b552f0424756928c5e3005ba3629bd134a6fa93b922f835
3
+ size 1466632
examples/sample_5.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:692cd463afec601975c446e8d840f954c5b143aa9161869a5f7a41b60e36069c
3
+ size 10008651
workflows/Best-FaceID_v1.0_Upscale_Workflow.json ADDED
The diff for this file is too large to render. See raw diff
 
workflows/Best-FaceID_v1.0_Workflow.json ADDED
The diff for this file is too large to render. See raw diff