Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,21 +19,22 @@ title = '''# 👋🏻Welcome to Tonic's🌟🎥StableVideo XT-1-1
|
|
19 |
Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to 🌟 [SciTonic](https://github.com/Tonic-AI/scitonic) 🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
|
20 |
'''
|
21 |
|
22 |
-
|
|
|
|
|
|
|
23 |
|
24 |
original_model_id = "stabilityai/stable-video-diffusion-img2vid-xt"
|
25 |
pipe = StableVideoDiffusionPipeline.from_pretrained(
|
26 |
original_model_id,
|
27 |
torch_dtype=torch.float16,
|
28 |
-
variant="fp16"
|
|
|
29 |
)
|
30 |
|
31 |
-
|
32 |
model_cache_dir = os.path.join(cache_dir, original_model_id.replace("/", "--"))
|
33 |
-
|
34 |
-
downloaded_safetensors_path = "./svd_xt_1_1.safetensors"
|
35 |
-
|
36 |
-
original_safetensors_path = os.path.join(model_cache_dir, "./svd_xt.safetensors")
|
37 |
os.replace(downloaded_safetensors_path, original_safetensors_path)
|
38 |
|
39 |
pipe = StableVideoDiffusionPipeline.from_pretrained(
|
@@ -43,8 +44,6 @@ pipe = StableVideoDiffusionPipeline.from_pretrained(
|
|
43 |
)
|
44 |
pipe.to("cuda")
|
45 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
46 |
-
#pipe.vae = torch.compile(pipe.vae, mode="reduce-overhead", fullgraph=True)
|
47 |
-
|
48 |
max_64_bit_int = 2**63 - 1
|
49 |
|
50 |
@spaces.GPU(enable_queue=True)
|
|
|
19 |
Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to 🌟 [SciTonic](https://github.com/Tonic-AI/scitonic) 🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
|
20 |
'''
|
21 |
|
22 |
+
script_dir = os.path.dirname(os.path.abspath(__file__))
|
23 |
+
downloaded_safetensors_path = os.path.join(script_dir, "svd_xt_1_1.safetensors")
|
24 |
+
if not os.path.exists(downloaded_safetensors_path):
|
25 |
+
raise FileNotFoundError(f"The file {downloaded_safetensors_path} was not found.")
|
26 |
|
27 |
original_model_id = "stabilityai/stable-video-diffusion-img2vid-xt"
|
28 |
pipe = StableVideoDiffusionPipeline.from_pretrained(
|
29 |
original_model_id,
|
30 |
torch_dtype=torch.float16,
|
31 |
+
variant="fp16",
|
32 |
+
use_auth_token=hf_token
|
33 |
)
|
34 |
|
35 |
+
cache_dir = os.path.join(os.path.expanduser("~"), ".cache/huggingface/diffusers")
|
36 |
model_cache_dir = os.path.join(cache_dir, original_model_id.replace("/", "--"))
|
37 |
+
original_safetensors_path = os.path.join(model_cache_dir, "svd_xt.safetensors")
|
|
|
|
|
|
|
38 |
os.replace(downloaded_safetensors_path, original_safetensors_path)
|
39 |
|
40 |
pipe = StableVideoDiffusionPipeline.from_pretrained(
|
|
|
44 |
)
|
45 |
pipe.to("cuda")
|
46 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
|
|
|
|
47 |
max_64_bit_int = 2**63 - 1
|
48 |
|
49 |
@spaces.GPU(enable_queue=True)
|