support patch ascend
This commit is contained in:
20
iic.py
20
iic.py
@@ -1,26 +1,16 @@
|
||||
import os
|
||||
import torch
|
||||
from functools import wraps
|
||||
|
||||
_orig_load = torch.load
|
||||
|
||||
@wraps(_orig_load)
|
||||
def _load_patch(*args, **kwargs):
|
||||
kwargs.setdefault("weights_only", False)
|
||||
return _orig_load(*args, **kwargs)
|
||||
|
||||
torch.load = _load_patch
|
||||
|
||||
import patch
|
||||
|
||||
from modelscope.pipelines import pipeline
|
||||
from modelscope.outputs import OutputKeys
|
||||
|
||||
device = "cuda" if torch.cuda.is_available() else "npu"
|
||||
model_path = "/mnt/contest_ceph/zhanghao/models/iic/text-to-video-synthesis"
|
||||
p = pipeline('text-to-video-synthesis', model_path)
|
||||
p = pipeline('text-to-video-synthesis', model_path, device=device)
|
||||
|
||||
test_text = {
|
||||
'text': 'A panda eating bamboo on a rock.',
|
||||
'text': 'A panda eating a burger and french fries on a rock.',
|
||||
}
|
||||
output_video_path = p(test_text, output_video='./output.mp4')[OutputKeys.OUTPUT_VIDEO]
|
||||
output_video_path = p(test_text, device=device, output_video='./output.mp4')[OutputKeys.OUTPUT_VIDEO]
|
||||
print('output_video_path:', output_video_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user