Spaces:
Build error
Build error
update
Browse files- .gitattributes +0 -34
- configs/v1-inference.yaml +0 -70
- text_to_animation/model.py +0 -59
- webui/app_control_animation.py +21 -46
.gitattributes
DELETED
@@ -1,34 +0,0 @@
|
|
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 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
configs/v1-inference.yaml
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
model:
|
2 |
-
base_learning_rate: 1.0e-04
|
3 |
-
target: ldm.models.diffusion.ddpm.LatentDiffusion
|
4 |
-
params:
|
5 |
-
linear_start: 0.00085
|
6 |
-
linear_end: 0.0120
|
7 |
-
num_timesteps_cond: 1
|
8 |
-
log_every_t: 200
|
9 |
-
timesteps: 1000
|
10 |
-
first_stage_key: "jpg"
|
11 |
-
cond_stage_key: "txt"
|
12 |
-
image_size: 64
|
13 |
-
channels: 4
|
14 |
-
cond_stage_trainable: false # Note: different from the one we trained before
|
15 |
-
conditioning_key: crossattn
|
16 |
-
monitor: val/loss_simple_ema
|
17 |
-
scale_factor: 0.18215
|
18 |
-
use_ema: False
|
19 |
-
|
20 |
-
scheduler_config: # 10000 warmup steps
|
21 |
-
target: ldm.lr_scheduler.LambdaLinearScheduler
|
22 |
-
params:
|
23 |
-
warm_up_steps: [ 10000 ]
|
24 |
-
cycle_lengths: [ 10000000000000 ] # incredibly large number to prevent corner cases
|
25 |
-
f_start: [ 1.e-6 ]
|
26 |
-
f_max: [ 1. ]
|
27 |
-
f_min: [ 1. ]
|
28 |
-
|
29 |
-
unet_config:
|
30 |
-
target: ldm.modules.diffusionmodules.openaimodel.UNetModel
|
31 |
-
params:
|
32 |
-
image_size: 32 # unused
|
33 |
-
in_channels: 4
|
34 |
-
out_channels: 4
|
35 |
-
model_channels: 320
|
36 |
-
attention_resolutions: [ 4, 2, 1 ]
|
37 |
-
num_res_blocks: 2
|
38 |
-
channel_mult: [ 1, 2, 4, 4 ]
|
39 |
-
num_heads: 8
|
40 |
-
use_spatial_transformer: True
|
41 |
-
transformer_depth: 1
|
42 |
-
context_dim: 768
|
43 |
-
use_checkpoint: True
|
44 |
-
legacy: False
|
45 |
-
|
46 |
-
first_stage_config:
|
47 |
-
target: ldm.models.autoencoder.AutoencoderKL
|
48 |
-
params:
|
49 |
-
embed_dim: 4
|
50 |
-
monitor: val/rec_loss
|
51 |
-
ddconfig:
|
52 |
-
double_z: true
|
53 |
-
z_channels: 4
|
54 |
-
resolution: 256
|
55 |
-
in_channels: 3
|
56 |
-
out_ch: 3
|
57 |
-
ch: 128
|
58 |
-
ch_mult:
|
59 |
-
- 1
|
60 |
-
- 2
|
61 |
-
- 4
|
62 |
-
- 4
|
63 |
-
num_res_blocks: 2
|
64 |
-
attn_resolutions: []
|
65 |
-
dropout: 0.0
|
66 |
-
lossconfig:
|
67 |
-
target: torch.nn.Identity
|
68 |
-
|
69 |
-
cond_stage_config:
|
70 |
-
target: ldm.modules.encoders.modules.FrozenCLIPEmbedder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
text_to_animation/model.py
CHANGED
@@ -188,62 +188,3 @@ class ControlAnimationModel:
|
|
188 |
motion_field_strength_y=motion_field_strength_y,
|
189 |
).images)[0]
|
190 |
return utils.create_gif(np.array(vid), 4, path=None, watermark=None)
|
191 |
-
|
192 |
-
|
193 |
-
def generate_animation(
|
194 |
-
self,
|
195 |
-
prompt, #: str,
|
196 |
-
initial_frame_index, #: int,
|
197 |
-
input_video_path, #: str,
|
198 |
-
model_link = None,#: str = "dreamlike-art/dreamlike-photoreal-2.0",
|
199 |
-
motion_field_strength_x = 12,#: int = 12,
|
200 |
-
motion_field_strength_y= 12,#: int = 12,
|
201 |
-
t0= 44,#: int = 44,
|
202 |
-
t1= 47,#: int = 47,
|
203 |
-
n_prompt= "",#: str = "",
|
204 |
-
chunk_size= 8, #: int = 8,
|
205 |
-
video_length = 8, #: int = 8,
|
206 |
-
merging_ratio = 0., #: float = 0.0,
|
207 |
-
seed= 0,#: int = 0,
|
208 |
-
resolution=512,#: int = 512,
|
209 |
-
fps=2,#: int = 2,
|
210 |
-
use_cf_attn=True,#: bool = True,
|
211 |
-
use_motion_field=True,#: bool = True,
|
212 |
-
smooth_bg=False,#: bool = False,
|
213 |
-
smooth_bg_strength=0.4,#: float = 0.4,
|
214 |
-
path=None,#: str = None,
|
215 |
-
):
|
216 |
-
video_path = gradio_utils.motion_to_video_path(input_video_path)
|
217 |
-
|
218 |
-
# added_prompt = 'best quality, HD, clay stop-motion, claymation, HQ, masterpiece, art, smooth'
|
219 |
-
# added_prompt = 'high quality, anatomically correct, clay stop-motion, aardman, claymation, smooth'
|
220 |
-
added_n_prompt = "longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer difits, cropped, worst quality, low quality, deformed body, bloated, ugly"
|
221 |
-
negative_prompts = added_n_prompt + ", " + n_prompt
|
222 |
-
|
223 |
-
video, fps = utils.prepare_video(
|
224 |
-
video_path, resolution, None, self.dtype, False, output_fps=4
|
225 |
-
)
|
226 |
-
control = utils.pre_process_pose(video, apply_pose_detect=False)
|
227 |
-
len_vid, _, h, w = video.shape
|
228 |
-
prng_seed = jax.random.PRNGKey(seed)
|
229 |
-
prompts = prompt
|
230 |
-
prompt_ids = self.pipe.prepare_text_inputs([prompts]*len_vid)
|
231 |
-
n_prompt_ids = self.pipe.prepare_text_inputs([negative_prompts]*len_vid)
|
232 |
-
prng = replicate_devices(prng_seed) #jax.random.split(prng, jax.device_count())
|
233 |
-
image = replicate_devices(control)
|
234 |
-
prompt_ids = replicate_devices(prompt_ids)
|
235 |
-
n_prompt_ids = replicate_devices(n_prompt_ids)
|
236 |
-
motion_field_strength_x = replicate_devices(jnp.array(motion_field_strength_x))
|
237 |
-
motion_field_strength_y = replicate_devices(jnp.array(motion_field_strength_y))
|
238 |
-
smooth_bg_strength = replicate_devices(jnp.array(smooth_bg_strength))
|
239 |
-
vid = (self.pipe(image=image,
|
240 |
-
prompt_ids=prompt_ids,
|
241 |
-
neg_prompt_ids=n_prompt_ids,
|
242 |
-
params=self.p_params,
|
243 |
-
prng_seed=prng,
|
244 |
-
jit = True,
|
245 |
-
smooth_bg_strength=smooth_bg_strength,
|
246 |
-
motion_field_strength_x=motion_field_strength_x,
|
247 |
-
motion_field_strength_y=motion_field_strength_y,
|
248 |
-
).images)[0]
|
249 |
-
return utils.create_gif(np.array(vid), 4, path=None, watermark=None)
|
|
|
188 |
motion_field_strength_y=motion_field_strength_y,
|
189 |
).images)[0]
|
190 |
return utils.create_gif(np.array(vid), 4, path=None, watermark=None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
webui/app_control_animation.py
CHANGED
@@ -20,17 +20,6 @@ examples = [["A surfer in miami walking by the beach",
|
|
20 |
None,
|
21 |
0],
|
22 |
]
|
23 |
-
# examples = [
|
24 |
-
# ["an astronaut waving the arm on the moon"],
|
25 |
-
# ["a sloth surfing on a wakeboard"],
|
26 |
-
# ["an astronaut walking on a street"],
|
27 |
-
# ["a cute cat walking on grass"],
|
28 |
-
# ["a horse is galloping on a street"],
|
29 |
-
# ["an astronaut is skiing down the hill"],
|
30 |
-
# ["a gorilla walking alone down the street"],
|
31 |
-
# ["a gorilla dancing on times square"],
|
32 |
-
# ["A panda dancing dancing like crazy on Times Square"],
|
33 |
-
# ]
|
34 |
|
35 |
def on_video_path_update(evt: gr.EventData):
|
36 |
return f"Selection: **{evt._data}**"
|
@@ -209,17 +198,17 @@ def create_demo(model: ControlAnimationModel):
|
|
209 |
seed,
|
210 |
]
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
|
224 |
gen_frames_button.click(
|
225 |
fn=model.generate_initial_frames,
|
@@ -227,36 +216,22 @@ def create_demo(model: ControlAnimationModel):
|
|
227 |
outputs=initial_frames,
|
228 |
)
|
229 |
|
230 |
-
# gen_animation_button.click(
|
231 |
-
# fn=submit_select,
|
232 |
-
# inputs=initial_frame_index,
|
233 |
-
# outputs=[frame_selection_view, animation_view],
|
234 |
-
# ).then(
|
235 |
-
# fn=model.generate_animation,
|
236 |
-
# inputs=animation_inputs,
|
237 |
-
# outputs=result,
|
238 |
-
# )
|
239 |
-
|
240 |
gen_animation_button.click(
|
|
|
|
|
|
|
|
|
241 |
fn=model.generate_animation,
|
242 |
inputs=animation_inputs,
|
243 |
outputs=result,
|
244 |
)
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
gr.Examples(examples=examples,
|
255 |
-
inputs=animation_inputs,
|
256 |
-
outputs=result,
|
257 |
-
fn=model.generate_animation,
|
258 |
-
cache_examples=on_huggingspace,
|
259 |
-
run_on_click=True,
|
260 |
-
)
|
261 |
|
262 |
return demo
|
|
|
20 |
None,
|
21 |
0],
|
22 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
def on_video_path_update(evt: gr.EventData):
|
25 |
return f"Selection: **{evt._data}**"
|
|
|
198 |
seed,
|
199 |
]
|
200 |
|
201 |
+
def submit_select(initial_frame_index: int):
|
202 |
+
if initial_frame_index != -1: # More to next step
|
203 |
+
return {
|
204 |
+
frame_selection_view: gr.update(visible=False),
|
205 |
+
animation_view: gr.update(visible=True),
|
206 |
+
}
|
207 |
|
208 |
+
return {
|
209 |
+
frame_selection_view: gr.update(visible=True),
|
210 |
+
animation_view: gr.update(visible=False),
|
211 |
+
}
|
212 |
|
213 |
gen_frames_button.click(
|
214 |
fn=model.generate_initial_frames,
|
|
|
216 |
outputs=initial_frames,
|
217 |
)
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
gen_animation_button.click(
|
220 |
+
fn=submit_select,
|
221 |
+
inputs=initial_frame_index,
|
222 |
+
outputs=[frame_selection_view, animation_view],
|
223 |
+
).then(
|
224 |
fn=model.generate_animation,
|
225 |
inputs=animation_inputs,
|
226 |
outputs=result,
|
227 |
)
|
228 |
|
229 |
+
# gr.Examples(examples=examples,
|
230 |
+
# inputs=animation_inputs,
|
231 |
+
# outputs=result,
|
232 |
+
# fn=model.generate_animation,
|
233 |
+
# cache_examples=on_huggingspace,
|
234 |
+
# run_on_click=True,
|
235 |
+
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
237 |
return demo
|