zzl
commited on
Commit
•
39a6e03
1
Parent(s):
77c21de
[Release] cpu support
Browse files- demo_img.py +1 -2
- demo_vid.py +0 -1
- results/demo.mp4 +0 -0
demo_img.py
CHANGED
@@ -9,7 +9,7 @@ from networks.amtl import Model as AMTL
|
|
9 |
from networks.amtg import Model as AMTG
|
10 |
from utils import img2tensor, tensor2img, InputPadder
|
11 |
|
12 |
-
device = torch.device('
|
13 |
model_dict = {
|
14 |
'AMT-S': AMTS, 'AMT-L': AMTL, 'AMT-G': AMTG
|
15 |
}
|
@@ -18,7 +18,6 @@ def img2vid(model_type, img0, img1, frame_ratio, iters):
|
|
18 |
model = model_dict[model_type]()
|
19 |
model.to(device)
|
20 |
ckpt_path = hf_hub_download(repo_id='lalala125/AMT', filename=f'{model_type.lower()}.pth')
|
21 |
-
print(model_type)
|
22 |
ckpt = torch.load(ckpt_path, map_location=torch.device('cpu'))
|
23 |
model.load_state_dict(ckpt['state_dict'])
|
24 |
model.eval()
|
|
|
9 |
from networks.amtg import Model as AMTG
|
10 |
from utils import img2tensor, tensor2img, InputPadder
|
11 |
|
12 |
+
device = torch.device('cpu' if torch.cuda.is_available() else 'cpu')
|
13 |
model_dict = {
|
14 |
'AMT-S': AMTS, 'AMT-L': AMTL, 'AMT-G': AMTG
|
15 |
}
|
|
|
18 |
model = model_dict[model_type]()
|
19 |
model.to(device)
|
20 |
ckpt_path = hf_hub_download(repo_id='lalala125/AMT', filename=f'{model_type.lower()}.pth')
|
|
|
21 |
ckpt = torch.load(ckpt_path, map_location=torch.device('cpu'))
|
22 |
model.load_state_dict(ckpt['state_dict'])
|
23 |
model.eval()
|
demo_vid.py
CHANGED
@@ -19,7 +19,6 @@ def vid2vid(model_type, video, iters):
|
|
19 |
model = model_dict[model_type]()
|
20 |
model.to(device)
|
21 |
ckpt_path = hf_hub_download(repo_id='lalala125/AMT', filename=f'{model_type.lower()}.pth')
|
22 |
-
print(model_type)
|
23 |
ckpt = torch.load(ckpt_path)
|
24 |
model.load_state_dict(ckpt['state_dict'], map_location=torch.device('cpu'))
|
25 |
model.eval()
|
|
|
19 |
model = model_dict[model_type]()
|
20 |
model.to(device)
|
21 |
ckpt_path = hf_hub_download(repo_id='lalala125/AMT', filename=f'{model_type.lower()}.pth')
|
|
|
22 |
ckpt = torch.load(ckpt_path)
|
23 |
model.load_state_dict(ckpt['state_dict'], map_location=torch.device('cpu'))
|
24 |
model.eval()
|
results/demo.mp4
ADDED
Binary file (120 kB). View file
|
|