fix_enable_any_model_hf

#8
by radames - opened
Files changed (2) hide show
  1. app.py +15 -11
  2. sd_model_cfg.py +4 -1
app.py CHANGED
@@ -32,17 +32,17 @@ from src.video_util import (frame_to_video, get_fps, get_frame_count,
32
 
33
  import huggingface_hub
34
 
35
- repo_name = 'Anonymous-sub/Rerender'
36
 
37
- huggingface_hub.hf_hub_download(repo_name,
38
  'pexels-koolshooters-7322716.mp4',
39
  local_dir='videos')
40
  huggingface_hub.hf_hub_download(
41
- repo_name,
42
  'pexels-antoni-shkraba-8048492-540x960-25fps.mp4',
43
  local_dir='videos')
44
  huggingface_hub.hf_hub_download(
45
- repo_name,
46
  'pexels-cottonbro-studio-6649832-960x506-25fps.mp4',
47
  local_dir='videos')
48
 
@@ -105,15 +105,20 @@ class GlobalState:
105
  model.load_state_dict(
106
  load_state_dict(huggingface_hub.hf_hub_download(
107
  'lllyasviel/ControlNet', './models/control_sd15_hed.pth'),
108
- location=device))
109
  elif control_type == 'canny':
110
  model.load_state_dict(
111
  load_state_dict(huggingface_hub.hf_hub_download(
112
  'lllyasviel/ControlNet', 'models/control_sd15_canny.pth'),
113
- location=device))
114
  model.to(device)
115
  sd_model_path = model_dict[sd_model]
116
  if len(sd_model_path) > 0:
 
 
 
 
 
117
  model_ext = os.path.splitext(sd_model_path)[1]
118
  downloaded_model = huggingface_hub.hf_hub_download(
119
  repo_name, sd_model_path)
@@ -129,7 +134,7 @@ class GlobalState:
129
  huggingface_hub.hf_hub_download(
130
  'stabilityai/sd-vae-ft-mse-original',
131
  'vae-ft-mse-840000-ema-pruned.ckpt'))['state_dict'],
132
- strict=False)
133
  except Exception:
134
  print('Warning: We suggest you download the fine-tuned VAE',
135
  'otherwise the generation quality will be degraded')
@@ -791,10 +796,9 @@ with block:
791
  maximum=100,
792
  value=1,
793
  step=1,
794
- info=
795
- ('Update the key and value for '
796
- 'cross-frame attention every N key frames (recommend N*K>=10)'
797
- ))
798
  with gr.Row():
799
  warp_start = gr.Slider(label='Shape-aware fusion start',
800
  minimum=0,
 
32
 
33
  import huggingface_hub
34
 
35
+ REPO_NAME = 'Anonymous-sub/Rerender'
36
 
37
+ huggingface_hub.hf_hub_download(REPO_NAME,
38
  'pexels-koolshooters-7322716.mp4',
39
  local_dir='videos')
40
  huggingface_hub.hf_hub_download(
41
+ REPO_NAME,
42
  'pexels-antoni-shkraba-8048492-540x960-25fps.mp4',
43
  local_dir='videos')
44
  huggingface_hub.hf_hub_download(
45
+ REPO_NAME,
46
  'pexels-cottonbro-studio-6649832-960x506-25fps.mp4',
47
  local_dir='videos')
48
 
 
105
  model.load_state_dict(
106
  load_state_dict(huggingface_hub.hf_hub_download(
107
  'lllyasviel/ControlNet', './models/control_sd15_hed.pth'),
108
+ location=device))
109
  elif control_type == 'canny':
110
  model.load_state_dict(
111
  load_state_dict(huggingface_hub.hf_hub_download(
112
  'lllyasviel/ControlNet', 'models/control_sd15_canny.pth'),
113
+ location=device))
114
  model.to(device)
115
  sd_model_path = model_dict[sd_model]
116
  if len(sd_model_path) > 0:
117
+ repo_name = REPO_NAME
118
+ # check if sd_model is repo_id/name otherwise use global REPO_NAME
119
+ if sd_model.count('/') == 1:
120
+ repo_name = sd_model
121
+
122
  model_ext = os.path.splitext(sd_model_path)[1]
123
  downloaded_model = huggingface_hub.hf_hub_download(
124
  repo_name, sd_model_path)
 
134
  huggingface_hub.hf_hub_download(
135
  'stabilityai/sd-vae-ft-mse-original',
136
  'vae-ft-mse-840000-ema-pruned.ckpt'))['state_dict'],
137
+ strict=False)
138
  except Exception:
139
  print('Warning: We suggest you download the fine-tuned VAE',
140
  'otherwise the generation quality will be degraded')
 
796
  maximum=100,
797
  value=1,
798
  step=1,
799
+ info=('Update the key and value for '
800
+ 'cross-frame attention every N key frames (recommend N*K>=10)'
801
+ ))
 
802
  with gr.Row():
803
  warp_start = gr.Slider(label='Shape-aware fusion start',
804
  minimum=0,
sd_model_cfg.py CHANGED
@@ -3,5 +3,8 @@
3
  model_dict = {
4
  'Stable Diffusion 1.5': '',
5
  'revAnimated_v11': 'models/revAnimated_v11.safetensors',
6
- 'realisticVisionV20_v20': 'models/realisticVisionV20_v20.safetensors'
 
 
 
7
  }
 
3
  model_dict = {
4
  'Stable Diffusion 1.5': '',
5
  'revAnimated_v11': 'models/revAnimated_v11.safetensors',
6
+ 'realisticVisionV20_v20': 'models/realisticVisionV20_v20.safetensors',
7
+ 'DGSpitzer/Cyberpunk-Anime-Diffusion': 'Cyberpunk-Anime-Diffusion.safetensors',
8
+ 'wavymulder/Analog-Diffusion': 'analog-diffusion-1.0.safetensors',
9
+ 'Fictiverse/Stable_Diffusion_PaperCut_Model': 'PaperCut_v1.safetensors',
10
  }