Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ from moviepy.editor import VideoFileClip, AudioFileClip
|
|
| 31 |
import multiprocessing
|
| 32 |
import imageio
|
| 33 |
import tqdm
|
| 34 |
-
|
| 35 |
|
| 36 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 37 |
|
|
@@ -531,7 +531,8 @@ def generate_video(image, prompt, max_tokens):
|
|
| 531 |
heatmap_imgs.append(overlay)
|
| 532 |
|
| 533 |
# Dùng multiprocessing
|
| 534 |
-
with multiprocessing.Pool(processes=20) as pool:
|
|
|
|
| 535 |
text_imgs = pool.map(generate_text_img_wrapper, params_for_text)
|
| 536 |
hidden_imgs = pool.map(generate_hidden_img_wrapper, params_for_hidden)
|
| 537 |
|
|
|
|
| 31 |
import multiprocessing
|
| 32 |
import imageio
|
| 33 |
import tqdm
|
| 34 |
+
from concurrent.futures import ProcessPoolExecutor
|
| 35 |
|
| 36 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 37 |
|
|
|
|
| 531 |
heatmap_imgs.append(overlay)
|
| 532 |
|
| 533 |
# Dùng multiprocessing
|
| 534 |
+
# with multiprocessing.Pool(processes=20) as pool:
|
| 535 |
+
with ProcessPoolExecutor(max_workers=20) as pool:
|
| 536 |
text_imgs = pool.map(generate_text_img_wrapper, params_for_text)
|
| 537 |
hidden_imgs = pool.map(generate_hidden_img_wrapper, params_for_hidden)
|
| 538 |
|