CharlieAmalet commited on
Commit
b75265f
·
verified ·
1 Parent(s): 9d31d7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -18,6 +18,11 @@ import random
18
  from huggingface_hub import login, hf_hub_download
19
  import spaces
20
 
 
 
 
 
 
21
  # pipe = StableVideoDiffusionPipeline.from_pretrained(
22
  # # "stabilityai/stable-video-diffusion-img2vid-xt-1-1",
23
  # "vdo/stable-video-diffusion-img2vid-xt-1-1",
@@ -38,11 +43,20 @@ if not os.path.exists(model_directory):
38
  )
39
  pipe.save_pretrained("./checkpoints", variant="fp16")
40
  else:
41
- pipe = StableVideoDiffusionPipeline.from_pretrained(
42
- model_directory,
43
- torch_dtype=torch.float16,
44
- variant="fp16"
45
- )
 
 
 
 
 
 
 
 
 
46
 
47
  pipe.to("cuda")
48
  # pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
 
18
  from huggingface_hub import login, hf_hub_download
19
  import spaces
20
 
21
+ try:
22
+ hf_hub_download(repo_id="vdo/stable-video-diffusion-img2vid-xt-1-1", local_dir="./checkpoints", cache_dir="./checkpoints")
23
+ except (Exception, BaseException) as error:
24
+ print(error)
25
+
26
  # pipe = StableVideoDiffusionPipeline.from_pretrained(
27
  # # "stabilityai/stable-video-diffusion-img2vid-xt-1-1",
28
  # "vdo/stable-video-diffusion-img2vid-xt-1-1",
 
43
  )
44
  pipe.save_pretrained("./checkpoints", variant="fp16")
45
  else:
46
+ try:
47
+ pipe = StableVideoDiffusionPipeline.from_pretrained(
48
+ model_directory,
49
+ torch_dtype=torch.float16,
50
+ variant="fp16"
51
+ )
52
+ except:
53
+ pipe = StableVideoDiffusionPipeline.from_pretrained(
54
+ # "stabilityai/stable-video-diffusion-img2vid-xt-1-1",
55
+ "vdo/stable-video-diffusion-img2vid-xt-1-1",
56
+ torch_dtype=torch.float16,
57
+ variant="fp16"
58
+ )
59
+ pipe.save_pretrained("./checkpoints", variant="fp16")
60
 
61
  pipe.to("cuda")
62
  # pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)