AndreasXi commited on
Commit
3004bf1
·
1 Parent(s): c5a0b30
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -42,7 +42,7 @@ NUM_SAMPLE = 1
42
  # a = AutoModel.from_pretrained('bert-base-uncased')
43
  # b = AutoModel.from_pretrained('roberta-base')
44
 
45
- snapshot_download(repo_id="AndreasXi/MeanAudio", local_dir="./weights",allow_patterns=["*.pt", "*.pth"] )
46
  # _clap_ckpt_path='./weights/music_speech_audioset_epoch_15_esc_89.98.pt'
47
  # laion_clap_model = laion_clap.CLAP_Module(enable_fusion=False, amodel='HTSAT-base').cuda().eval()
48
 
@@ -67,6 +67,11 @@ def generate_audio_gradio(
67
  raise ValueError(f"Unknown model variant: {variant}. Available: {list(all_model_cfg.keys())}")
68
 
69
  model_path = all_model_cfg[variant].model_path # by default, this will use meanaudio_s_full.pth or fluxaudio_s_full.pth
 
 
 
 
 
70
  model = all_model_cfg[variant]
71
  seq_cfg = model.seq_cfg
72
  seq_cfg.duration = duration
 
42
  # a = AutoModel.from_pretrained('bert-base-uncased')
43
  # b = AutoModel.from_pretrained('roberta-base')
44
 
45
+ # snapshot_download(repo_id="AndreasXi/MeanAudio", local_dir="./weights",allow_patterns=["*.pt", "*.pth"] )
46
  # _clap_ckpt_path='./weights/music_speech_audioset_epoch_15_esc_89.98.pt'
47
  # laion_clap_model = laion_clap.CLAP_Module(enable_fusion=False, amodel='HTSAT-base').cuda().eval()
48
 
 
67
  raise ValueError(f"Unknown model variant: {variant}. Available: {list(all_model_cfg.keys())}")
68
 
69
  model_path = all_model_cfg[variant].model_path # by default, this will use meanaudio_s_full.pth or fluxaudio_s_full.pth
70
+ if not model_path.exists():
71
+ log.info(f'Model not found at {model_path}')
72
+ log.info('Downloading models to "./weights/"...')
73
+ snapshot_download(repo_id="AndreasXi/MeanAudio", local_dir="./weights",allow_patterns=["*.pt", "*.pth"] )
74
+
75
  model = all_model_cfg[variant]
76
  seq_cfg = model.seq_cfg
77
  seq_cfg.duration = duration