Spaces:
Running on Zero
Running on Zero
Commit ·
ccc1f92
1
Parent(s): 23d2d0c
add duration
Browse files
app.py
CHANGED
|
@@ -12,6 +12,9 @@ from app_utils import *
|
|
| 12 |
from axis_renderer import BlendRenderer
|
| 13 |
import spaces
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
from huggingface_hub import hf_hub_download
|
| 16 |
ckpt_path = hf_hub_download(repo_id=ORIANY_V2, filename=REMOTE_CKPT_PATH, repo_type="model", cache_dir='./', resume_download=True)
|
| 17 |
print(ckpt_path)
|
|
@@ -32,7 +35,7 @@ print('Model loaded.')
|
|
| 32 |
|
| 33 |
axis_renderer = BlendRenderer(RENDER_FILE)
|
| 34 |
|
| 35 |
-
@spaces.GPU
|
| 36 |
@torch.no_grad()
|
| 37 |
def inf_single_batch(batch):
|
| 38 |
model.to(device='cuda', dtype=mark_dtype)
|
|
@@ -110,7 +113,7 @@ def safe_image_input(image):
|
|
| 110 |
|
| 111 |
|
| 112 |
# ====== 推理函数 ======
|
| 113 |
-
@spaces.GPU
|
| 114 |
@torch.no_grad()
|
| 115 |
def run_inference(image_ref, image_tgt, do_rm_bkg):
|
| 116 |
image_ref = safe_image_input(image_ref)
|
|
|
|
| 12 |
from axis_renderer import BlendRenderer
|
| 13 |
import spaces
|
| 14 |
|
| 15 |
+
torch.backends.cuda.matmul.allow_tf32 = False
|
| 16 |
+
torch.backends.cudnn.allow_tf32 = False
|
| 17 |
+
|
| 18 |
from huggingface_hub import hf_hub_download
|
| 19 |
ckpt_path = hf_hub_download(repo_id=ORIANY_V2, filename=REMOTE_CKPT_PATH, repo_type="model", cache_dir='./', resume_download=True)
|
| 20 |
print(ckpt_path)
|
|
|
|
| 35 |
|
| 36 |
axis_renderer = BlendRenderer(RENDER_FILE)
|
| 37 |
|
| 38 |
+
@spaces.GPU(duration=20)
|
| 39 |
@torch.no_grad()
|
| 40 |
def inf_single_batch(batch):
|
| 41 |
model.to(device='cuda', dtype=mark_dtype)
|
|
|
|
| 113 |
|
| 114 |
|
| 115 |
# ====== 推理函数 ======
|
| 116 |
+
@spaces.GPU(duration=20)
|
| 117 |
@torch.no_grad()
|
| 118 |
def run_inference(image_ref, image_tgt, do_rm_bkg):
|
| 119 |
image_ref = safe_image_input(image_ref)
|