keithhon commited on
Commit
ce31d8a
·
1 Parent(s): b26f180

Upload utils/modelutils.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. utils/modelutils.py +17 -0
utils/modelutils.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ def check_model_paths(encoder_path: Path, synthesizer_path: Path, vocoder_path: Path):
4
+ # This function tests the model paths and makes sure at least one is valid.
5
+ if encoder_path.is_file() or encoder_path.is_dir():
6
+ return
7
+ if synthesizer_path.is_file() or synthesizer_path.is_dir():
8
+ return
9
+ if vocoder_path.is_file() or vocoder_path.is_dir():
10
+ return
11
+
12
+ # If none of the paths exist, remind the user to download models if needed
13
+ print("********************************************************************************")
14
+ print("Error: Model files not found. Follow these instructions to get and install the models:")
15
+ print("https://github.com/CorentinJ/Real-Time-Voice-Cloning/wiki/Pretrained-models")
16
+ print("********************************************************************************\n")
17
+ quit(-1)