svjack commited on
Commit
9bbf554
Β·
verified Β·
1 Parent(s): c6cbbfc

Upload folder using huggingface_hub

Browse files
.ipynb_checkpoints/README-checkpoint.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LTX-Video 13B Generation Pipeline (Escoffier Style)
2
+
3
+ This repository contains a complete workflow for generating high-quality animated videos featuring anime-style characters in the distinctive **Escoffier art style** using the **Lightricks LTX-Video 13B model** with LoRA adaptation. The pipeline is optimized for consistent **832x480 resolution output**, supporting multiple scene configurations while maintaining character aesthetics.
4
+
5
+ ---
6
+
7
+ ## 🎨 Character Description
8
+
9
+ The Escoffier-style character features:
10
+
11
+ - **Blonde hair with striking blue eyes**
12
+ - **Long flowing hair with a signature curled strand on top**
13
+ - **Elegant white and purple dress with gold accents**
14
+ - **Large magenta waist bow**
15
+ - **White thigh-high stockings with intricate floral designs**
16
+ - **White frilled hat adorned with pink ribbon**
17
+ - **Graceful posture in magical, ethereal settings**
18
+
19
+ ---
20
+
21
+ ## 🧰 Installation
22
+
23
+ ### System Dependencies
24
+ ```bash
25
+ sudo apt-get update && sudo apt-get install ffmpeg git-lfs cbm
26
+ ```
27
+
28
+ ### Python Dependencies
29
+ ```bash
30
+ pip install -U diffusers transformers torch sentencepiece peft moviepy protobuf
31
+ pip install git+https://github.com/Lightricks/LTX-Video.git
32
+ pip install git+https://github.com/huggingface/diffusers.git
33
+ ```
34
+
35
+ ---
36
+
37
+ ## πŸš€ Generation Pipeline
38
+
39
+ ### Model Initialization with Escoffier LoRA
40
+ ```python
41
+ import torch
42
+ from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
43
+ from diffusers.utils import export_to_video
44
+
45
+ # Load base model and LoRA weights
46
+ pipe = LTXConditionPipeline.from_pretrained(
47
+ "Lightricks/LTX-Video-0.9.7-dev",
48
+ torch_dtype=torch.bfloat16
49
+ )
50
+ pipe.load_lora_weights("LTXV_13B_097_DEV_escoffier_im_lora/lora_weights_step_19000.safetensors")
51
+
52
+ # Load latent upscaler
53
+ pipe_upsample = LTXLatentUpsamplePipeline.from_pretrained(
54
+ "Lightricks/ltxv-spatial-upscaler-0.9.7",
55
+ vae=pipe.vae,
56
+ torch_dtype=torch.bfloat16
57
+ )
58
+
59
+ # Memory optimization
60
+ pipe.enable_sequential_cpu_offload()
61
+ pipe_upsample.enable_sequential_cpu_offload()
62
+ ```
63
+
64
+ ---
65
+
66
+ ## πŸ“¦ Complete Generation Function
67
+
68
+ ```python
69
+ def generate_escoffier_video(prompt, output_name):
70
+ """Complete generation pipeline for 832x480 videos"""
71
+
72
+ # Fixed resolution parameters
73
+ expected_width, expected_height = 832, 480
74
+ downscale_factor = 2/3
75
+ num_frames = 121 # ~5 seconds at 24fps
76
+ negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
77
+
78
+ # Resolution rounding helper
79
+ def round_resolution(h, w):
80
+ ratio = pipe.vae_spatial_compression_ratio
81
+ return h - (h % ratio), w - (w % ratio)
82
+
83
+ low_res_h, low_res_w = round_resolution(
84
+ int(expected_height * downscale_factor),
85
+ int(expected_width * downscale_factor)
86
+ )
87
+
88
+ # 1. Initial generation at low resolution
89
+ latents = pipe(
90
+ conditions=None,
91
+ prompt=prompt,
92
+ negative_prompt=negative_prompt,
93
+ width=low_res_w,
94
+ height=low_res_h,
95
+ num_frames=num_frames,
96
+ num_inference_steps=30,
97
+ generator=torch.Generator().manual_seed(0),
98
+ output_type="latent",
99
+ ).frames
100
+
101
+ # 2. Latent upscaling (2x)
102
+ upscaled_latents = pipe_upsample(
103
+ latents=latents,
104
+ output_type="latent"
105
+ ).frames
106
+
107
+ # 3. Quality refinement pass
108
+ video = pipe(
109
+ prompt=prompt,
110
+ negative_prompt=negative_prompt,
111
+ width=low_res_w*2, # 2x upscaled
112
+ height=low_res_h*2,
113
+ num_frames=num_frames,
114
+ denoise_strength=0.4, # 4/10 steps
115
+ num_inference_steps=10,
116
+ latents=upscaled_latents,
117
+ decode_timestep=0.05,
118
+ image_cond_noise_scale=0.025,
119
+ generator=torch.Generator().manual_seed(0),
120
+ output_type="pil",
121
+ ).frames[0]
122
+
123
+ # 4. Final resize to target resolution
124
+ video = [frame.resize((expected_width, expected_height)) for frame in video]
125
+ export_to_video(video, f"{output_name}.mp4", fps=24)
126
+ ```
127
+
128
+ ---
129
+
130
+ ## πŸŽ₯ Example Generations (All 832x480)
131
+
132
+ ### 🌌 Cosmic Fantasy Scene
133
+ ```python
134
+ generate_escoffier_video(
135
+ prompt="In the style of Escoffier, This is a digital anime-style illustration of a blonde, blue-eyed female character with long, flowing hair and a large, curled strand on top. She wears a white and purple dress with gold accents, a large magenta bow on the waist, and white thigh-high stockings with intricate designs. The background features glowing, crystal-like structures and a dark blue, starry sky. Her expression is gentle, and she holds up the hem of her skirt with her right hand. The overall style is vibrant and dynamic, with a focus on her detailed, fantasy-inspired outfit and the magical, ethereal setting.",
136
+ output_name="escoffier_cosmic_scene"
137
+ )
138
+ ```
139
+
140
+ ### 🌸 Mystical Garden Scene
141
+ ```python
142
+ generate_escoffier_video(
143
+ prompt="In the style of Escoffier, This is a digital anime-style illustration of a blonde, blue-eyed female character with long, flowing hair and a large, curled strand on top. She wears a white and purple dress with gold accents, a large magenta bow on the waist, and white thigh-high stockings with intricate floral designs. She stands gracefully in a mystical garden filled with floating crystal butterflies and glowing lilies, reaching out to touch a shimmering orb.",
144
+ output_name="escoffier_garden_scene"
145
+ )
146
+ ```
147
+
148
+ ---
149
+
150
+ ## πŸ“„ License
151
+
152
+ This pipeline is provided under the same license as the base **LTX-Video** model. Please refer to the original Lightricks repository for licensing details.
153
+
154
+ ---
155
+
156
+ ## 🀝 Acknowledgments
157
+
158
+ - **Lightricks** – For developing and open-sourcing the LTX-Video model
159
+ - **Hugging Face** – For hosting and community support
160
+ - **svjack** – For adapting and fine-tuning the Escoffier LoRA weights
161
+
162
+ ---
163
+
164
+ ## πŸ“¬ Support
165
+
166
+ For issues or feature requests, please [open an issue](https://github.com/svjack/LTX-Video-Escoffier/issues) on GitHub.
167
+
168
+ ---
169
+
170
+ βœ… You now have a fully functional **Escoffier-style anime video generation pipeline** using **LTX-Video 13B**!
README.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LTX-Video 13B Generation Pipeline (Escoffier Style)
2
+
3
+ This repository contains a complete workflow for generating high-quality animated videos featuring anime-style characters in the distinctive **Escoffier art style** using the **Lightricks LTX-Video 13B model** with LoRA adaptation. The pipeline is optimized for consistent **832x480 resolution output**, supporting multiple scene configurations while maintaining character aesthetics.
4
+
5
+ ---
6
+
7
+ ## 🎨 Character Description
8
+
9
+ The Escoffier-style character features:
10
+
11
+ - **Blonde hair with striking blue eyes**
12
+ - **Long flowing hair with a signature curled strand on top**
13
+ - **Elegant white and purple dress with gold accents**
14
+ - **Large magenta waist bow**
15
+ - **White thigh-high stockings with intricate floral designs**
16
+ - **White frilled hat adorned with pink ribbon**
17
+ - **Graceful posture in magical, ethereal settings**
18
+
19
+ ---
20
+
21
+ ## 🧰 Installation
22
+
23
+ ### System Dependencies
24
+ ```bash
25
+ sudo apt-get update && sudo apt-get install ffmpeg git-lfs cbm
26
+ ```
27
+
28
+ ### Python Dependencies
29
+ ```bash
30
+ pip install -U diffusers transformers torch sentencepiece peft moviepy protobuf
31
+ pip install git+https://github.com/Lightricks/LTX-Video.git
32
+ pip install git+https://github.com/huggingface/diffusers.git
33
+ ```
34
+
35
+ ---
36
+
37
+ ## πŸš€ Generation Pipeline
38
+
39
+ ### Model Initialization with Escoffier LoRA
40
+ ```python
41
+ import torch
42
+ from diffusers import LTXConditionPipeline, LTXLatentUpsamplePipeline
43
+ from diffusers.utils import export_to_video
44
+
45
+ # Load base model and LoRA weights
46
+ pipe = LTXConditionPipeline.from_pretrained(
47
+ "Lightricks/LTX-Video-0.9.7-dev",
48
+ torch_dtype=torch.bfloat16
49
+ )
50
+ pipe.load_lora_weights("LTXV_13B_097_DEV_escoffier_im_lora/lora_weights_step_19000.safetensors")
51
+
52
+ # Load latent upscaler
53
+ pipe_upsample = LTXLatentUpsamplePipeline.from_pretrained(
54
+ "Lightricks/ltxv-spatial-upscaler-0.9.7",
55
+ vae=pipe.vae,
56
+ torch_dtype=torch.bfloat16
57
+ )
58
+
59
+ # Memory optimization
60
+ pipe.enable_sequential_cpu_offload()
61
+ pipe_upsample.enable_sequential_cpu_offload()
62
+ ```
63
+
64
+ ---
65
+
66
+ ## πŸ“¦ Complete Generation Function
67
+
68
+ ```python
69
+ def generate_escoffier_video(prompt, output_name):
70
+ """Complete generation pipeline for 832x480 videos"""
71
+
72
+ # Fixed resolution parameters
73
+ expected_width, expected_height = 832, 480
74
+ downscale_factor = 2/3
75
+ num_frames = 121 # ~5 seconds at 24fps
76
+ negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
77
+
78
+ # Resolution rounding helper
79
+ def round_resolution(h, w):
80
+ ratio = pipe.vae_spatial_compression_ratio
81
+ return h - (h % ratio), w - (w % ratio)
82
+
83
+ low_res_h, low_res_w = round_resolution(
84
+ int(expected_height * downscale_factor),
85
+ int(expected_width * downscale_factor)
86
+ )
87
+
88
+ # 1. Initial generation at low resolution
89
+ latents = pipe(
90
+ conditions=None,
91
+ prompt=prompt,
92
+ negative_prompt=negative_prompt,
93
+ width=low_res_w,
94
+ height=low_res_h,
95
+ num_frames=num_frames,
96
+ num_inference_steps=30,
97
+ generator=torch.Generator().manual_seed(0),
98
+ output_type="latent",
99
+ ).frames
100
+
101
+ # 2. Latent upscaling (2x)
102
+ upscaled_latents = pipe_upsample(
103
+ latents=latents,
104
+ output_type="latent"
105
+ ).frames
106
+
107
+ # 3. Quality refinement pass
108
+ video = pipe(
109
+ prompt=prompt,
110
+ negative_prompt=negative_prompt,
111
+ width=low_res_w*2, # 2x upscaled
112
+ height=low_res_h*2,
113
+ num_frames=num_frames,
114
+ denoise_strength=0.4, # 4/10 steps
115
+ num_inference_steps=10,
116
+ latents=upscaled_latents,
117
+ decode_timestep=0.05,
118
+ image_cond_noise_scale=0.025,
119
+ generator=torch.Generator().manual_seed(0),
120
+ output_type="pil",
121
+ ).frames[0]
122
+
123
+ # 4. Final resize to target resolution
124
+ video = [frame.resize((expected_width, expected_height)) for frame in video]
125
+ export_to_video(video, f"{output_name}.mp4", fps=24)
126
+ ```
127
+
128
+ ---
129
+
130
+ ## πŸŽ₯ Example Generations (All 832x480)
131
+
132
+ ### 🌌 Cosmic Fantasy Scene
133
+ ```python
134
+ generate_escoffier_video(
135
+ prompt="In the style of Escoffier, This is a digital anime-style illustration of a blonde, blue-eyed female character with long, flowing hair and a large, curled strand on top. She wears a white and purple dress with gold accents, a large magenta bow on the waist, and white thigh-high stockings with intricate designs. The background features glowing, crystal-like structures and a dark blue, starry sky. Her expression is gentle, and she holds up the hem of her skirt with her right hand. The overall style is vibrant and dynamic, with a focus on her detailed, fantasy-inspired outfit and the magical, ethereal setting.",
136
+ output_name="escoffier_cosmic_scene"
137
+ )
138
+ ```
139
+
140
+ ### 🌸 Mystical Garden Scene
141
+ ```python
142
+ generate_escoffier_video(
143
+ prompt="In the style of Escoffier, This is a digital anime-style illustration of a blonde, blue-eyed female character with long, flowing hair and a large, curled strand on top. She wears a white and purple dress with gold accents, a large magenta bow on the waist, and white thigh-high stockings with intricate floral designs. She stands gracefully in a mystical garden filled with floating crystal butterflies and glowing lilies, reaching out to touch a shimmering orb.",
144
+ output_name="escoffier_garden_scene"
145
+ )
146
+ ```
147
+
148
+ ---
149
+
150
+ ## πŸ“„ License
151
+
152
+ This pipeline is provided under the same license as the base **LTX-Video** model. Please refer to the original Lightricks repository for licensing details.
153
+
154
+ ---
155
+
156
+ ## 🀝 Acknowledgments
157
+
158
+ - **Lightricks** – For developing and open-sourcing the LTX-Video model
159
+ - **Hugging Face** – For hosting and community support
160
+ - **svjack** – For adapting and fine-tuning the Escoffier LoRA weights
161
+
162
+ ---
163
+
164
+ ## πŸ“¬ Support
165
+
166
+ For issues or feature requests, please [open an issue](https://github.com/svjack/LTX-Video-Escoffier/issues) on GitHub.
167
+
168
+ ---
169
+
170
+ βœ… You now have a fully functional **Escoffier-style anime video generation pipeline** using **LTX-Video 13B**!
lora_weights_step_17500.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11f332a874fc9f9ded778c66cee406089b29fdc70806b43650604babc2034c0e
3
+ size 201428536
lora_weights_step_18000.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7efbf44d8ceff2875c828708baf5b4c17b371a832fafd29edc5de52b02af4943
3
+ size 201428536
lora_weights_step_18500.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c1029ed469cdada3c383833e8faabe8ba4cad4861a5ab8458f9abd8d3f208d0
3
+ size 201428536
lora_weights_step_19000.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f62210017bac4d7050f30a2882dc9eb538672d160e0e29ccb6af4a07b9963511
3
+ size 201428536
lora_weights_step_19500.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c6ab0df3ad43d01c45ecf2afb625a9008f68977fdab9d3e5ccd3c10b171313f
3
+ size 201428536