Spaces:
Running
Running
Use model ID and add logs
Browse files
app.py
CHANGED
@@ -13,29 +13,32 @@ from hyvideo.config import parse_args
|
|
13 |
from hyvideo.inference import HunyuanVideoSampler
|
14 |
from hyvideo.constants import NEGATIVE_PROMPT
|
15 |
|
16 |
-
from huggingface_hub import hf_hub_download
|
17 |
|
18 |
-
if torch.cuda.device_count() > 0:
|
19 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="LICENSE", local_dir="ckpts")
|
20 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="Notice", local_dir="ckpts")
|
21 |
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="README.md", local_dir="ckpts")
|
22 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="config.json", local_dir="ckpts")
|
23 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt", local_dir="ckpts/hunyuan-video-t2v-720p/transformers")
|
24 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8.pt", local_dir="ckpts/hunyuan-video-t2v-720p/transformers")
|
25 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8_map.pt", local_dir="ckpts/hunyuan-video-t2v-720p/transformers")
|
26 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/vae/config.json", local_dir="ckpts/hunyuan-video-t2v-720p/vae")
|
27 |
-
hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/vae/pytorch_model.pt", local_dir="ckpts/hunyuan-video-t2v-720p/vae")
|
28 |
|
29 |
def initialize_model(model_path):
|
30 |
-
|
31 |
-
|
|
|
32 |
|
33 |
args = parse_args()
|
34 |
models_root_path = Path(model_path)
|
35 |
if not models_root_path.exists():
|
36 |
raise ValueError(f"`models_root` not exists: {models_root_path}")
|
37 |
|
|
|
38 |
hunyuan_video_sampler = HunyuanVideoSampler.from_pretrained(models_root_path, args=args)
|
|
|
39 |
return hunyuan_video_sampler
|
40 |
|
41 |
@spaces.GPU(duration=120)
|
@@ -164,5 +167,5 @@ def create_demo(model_path):
|
|
164 |
|
165 |
if __name__ == "__main__":
|
166 |
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
|
167 |
-
demo = create_demo("
|
168 |
demo.queue(10).launch()
|
|
|
13 |
from hyvideo.inference import HunyuanVideoSampler
|
14 |
from hyvideo.constants import NEGATIVE_PROMPT
|
15 |
|
16 |
+
#from huggingface_hub import hf_hub_download
|
17 |
|
18 |
+
#if torch.cuda.device_count() > 0:
|
19 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="LICENSE", local_dir="ckpts")
|
20 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="Notice", local_dir="ckpts")
|
21 |
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="README.md", local_dir="ckpts")
|
22 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="config.json", local_dir="ckpts")
|
23 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt", local_dir="ckpts/hunyuan-video-t2v-720p/transformers")
|
24 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8.pt", local_dir="ckpts/hunyuan-video-t2v-720p/transformers")
|
25 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8_map.pt", local_dir="ckpts/hunyuan-video-t2v-720p/transformers")
|
26 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/vae/config.json", local_dir="ckpts/hunyuan-video-t2v-720p/vae")
|
27 |
+
#hf_hub_download(repo_id="tencent/HunyuanVideo", filename="hunyuan-video-t2v-720p/vae/pytorch_model.pt", local_dir="ckpts/hunyuan-video-t2v-720p/vae")
|
28 |
|
29 |
def initialize_model(model_path):
|
30 |
+
print('initialize_model: ' + model_path)
|
31 |
+
#if torch.cuda.device_count() == 0:
|
32 |
+
#return None
|
33 |
|
34 |
args = parse_args()
|
35 |
models_root_path = Path(model_path)
|
36 |
if not models_root_path.exists():
|
37 |
raise ValueError(f"`models_root` not exists: {models_root_path}")
|
38 |
|
39 |
+
print(f"`models_root` exists: {models_root_path}")
|
40 |
hunyuan_video_sampler = HunyuanVideoSampler.from_pretrained(models_root_path, args=args)
|
41 |
+
print('Model initialized: ' + model_path)
|
42 |
return hunyuan_video_sampler
|
43 |
|
44 |
@spaces.GPU(duration=120)
|
|
|
167 |
|
168 |
if __name__ == "__main__":
|
169 |
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
|
170 |
+
demo = create_demo("tencent/HunyuanVideo")
|
171 |
demo.queue(10).launch()
|