Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,8 +128,10 @@ def inference(source_images,
|
|
| 128 |
text_prompt, negative_prompt,
|
| 129 |
pipe, vae, guidance_scale,
|
| 130 |
h, w, random_seed)->List[PIL.Image.Image]:
|
|
|
|
| 131 |
torch.manual_seed(random_seed)
|
| 132 |
-
|
|
|
|
| 133 |
pipe.vae.to(DEVICE)
|
| 134 |
pipe.transformer.to(DEVICE)
|
| 135 |
pipe.controlnet_transformer.to(DEVICE)
|
|
@@ -209,7 +211,6 @@ def process_video(video_file, image_file, positive_prompt, negative_prompt, guid
|
|
| 209 |
|
| 210 |
video:List[PIL.Image.Image]=[]
|
| 211 |
|
| 212 |
-
print("所有事都干完了,准备inference。")
|
| 213 |
for i in progress.tqdm(range(video_shard)):
|
| 214 |
if i>0: #first frame guidence
|
| 215 |
first_frame=transforms.ToTensor()(video[-1])
|
|
@@ -217,7 +218,8 @@ def process_video(video_file, image_file, positive_prompt, negative_prompt, guid
|
|
| 217 |
first_frame = rearrange(first_frame,"c w h -> w h c")
|
| 218 |
source_images=source_images
|
| 219 |
target_images=first_frame[None,None,...]
|
| 220 |
-
|
|
|
|
| 221 |
video+=inference(source_images, \
|
| 222 |
target_images, positive_prompt, \
|
| 223 |
negative_prompt, pipe, pipe.vae, \
|
|
|
|
| 128 |
text_prompt, negative_prompt,
|
| 129 |
pipe, vae, guidance_scale,
|
| 130 |
h, w, random_seed)->List[PIL.Image.Image]:
|
| 131 |
+
print("来到inference里")
|
| 132 |
torch.manual_seed(random_seed)
|
| 133 |
+
print("设置完随机种子,准备移动pipe各组件到gpu")
|
| 134 |
+
|
| 135 |
pipe.vae.to(DEVICE)
|
| 136 |
pipe.transformer.to(DEVICE)
|
| 137 |
pipe.controlnet_transformer.to(DEVICE)
|
|
|
|
| 211 |
|
| 212 |
video:List[PIL.Image.Image]=[]
|
| 213 |
|
|
|
|
| 214 |
for i in progress.tqdm(range(video_shard)):
|
| 215 |
if i>0: #first frame guidence
|
| 216 |
first_frame=transforms.ToTensor()(video[-1])
|
|
|
|
| 218 |
first_frame = rearrange(first_frame,"c w h -> w h c")
|
| 219 |
source_images=source_images
|
| 220 |
target_images=first_frame[None,None,...]
|
| 221 |
+
|
| 222 |
+
print("所有事都干完了,准备inference。")
|
| 223 |
video+=inference(source_images, \
|
| 224 |
target_images, positive_prompt, \
|
| 225 |
negative_prompt, pipe, pipe.vae, \
|