Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,6 +40,7 @@ dtype = torch.bfloat16
|
|
40 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
41 |
|
42 |
if not os.path.exists(model_path) or not os.path.exists(f"{model_path}/model_real_esran") or not os.path.exists(f"{model_path}/model_rife"):
|
|
|
43 |
hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir=f"{model_path}/model_real_esran")
|
44 |
snapshot_download(repo_id="AlexWortega/RIFE", local_dir=f"{model_path}/model_rife")
|
45 |
snapshot_download(repo_id="BestWishYsh/ConsisID-preview", local_dir=f"{model_path}")
|
@@ -116,10 +117,10 @@ pipe.to(device)
|
|
116 |
|
117 |
# Enable CPU offload for the model.
|
118 |
# turn on if you don't have multiple GPUs or enough GPU memory(such as H100) and it will cost more time in inference, it may also reduce the quality
|
119 |
-
pipe.enable_model_cpu_offload()
|
120 |
-
pipe.enable_sequential_cpu_offload()
|
121 |
-
|
122 |
-
|
123 |
|
124 |
os.makedirs("./output", exist_ok=True)
|
125 |
os.makedirs("./gradio_tmp", exist_ok=True)
|
|
|
40 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
41 |
|
42 |
if not os.path.exists(model_path) or not os.path.exists(f"{model_path}/model_real_esran") or not os.path.exists(f"{model_path}/model_rife"):
|
43 |
+
print(f"Model not found, downloading from Hugging Face...")
|
44 |
hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir=f"{model_path}/model_real_esran")
|
45 |
snapshot_download(repo_id="AlexWortega/RIFE", local_dir=f"{model_path}/model_rife")
|
46 |
snapshot_download(repo_id="BestWishYsh/ConsisID-preview", local_dir=f"{model_path}")
|
|
|
117 |
|
118 |
# Enable CPU offload for the model.
|
119 |
# turn on if you don't have multiple GPUs or enough GPU memory(such as H100) and it will cost more time in inference, it may also reduce the quality
|
120 |
+
# pipe.enable_model_cpu_offload()
|
121 |
+
# pipe.enable_sequential_cpu_offload()
|
122 |
+
pipe.vae.enable_slicing()
|
123 |
+
pipe.vae.enable_tiling()
|
124 |
|
125 |
os.makedirs("./output", exist_ok=True)
|
126 |
os.makedirs("./gradio_tmp", exist_ok=True)
|