mirror of
https://github.com/babysor/MockingBird.git
synced 2024-03-22 13:11:31 +08:00
Add error raise when no model folder found
This commit is contained in:
parent
6134c94b4d
commit
d3ba597be9
|
@ -29,12 +29,20 @@ if os.path.isdir(AUDIO_SAMPLES_DIR):
|
||||||
if os.path.isdir(SYN_MODELS_DIRT):
|
if os.path.isdir(SYN_MODELS_DIRT):
|
||||||
synthesizers = Enum('synthesizers', list((file.name, file) for file in Path(SYN_MODELS_DIRT).glob("**/*.pt")))
|
synthesizers = Enum('synthesizers', list((file.name, file) for file in Path(SYN_MODELS_DIRT).glob("**/*.pt")))
|
||||||
print("Loaded synthesizer models: " + str(len(synthesizers)))
|
print("Loaded synthesizer models: " + str(len(synthesizers)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {SYN_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
if os.path.isdir(ENC_MODELS_DIRT):
|
if os.path.isdir(ENC_MODELS_DIRT):
|
||||||
encoders = Enum('encoders', list((file.name, file) for file in Path(ENC_MODELS_DIRT).glob("**/*.pt")))
|
encoders = Enum('encoders', list((file.name, file) for file in Path(ENC_MODELS_DIRT).glob("**/*.pt")))
|
||||||
print("Loaded encoders models: " + str(len(encoders)))
|
print("Loaded encoders models: " + str(len(encoders)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {ENC_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
if os.path.isdir(VOC_MODELS_DIRT):
|
if os.path.isdir(VOC_MODELS_DIRT):
|
||||||
vocoders = Enum('vocoders', list((file.name, file) for file in Path(VOC_MODELS_DIRT).glob("**/*gan*.pt")))
|
vocoders = Enum('vocoders', list((file.name, file) for file in Path(VOC_MODELS_DIRT).glob("**/*gan*.pt")))
|
||||||
print("Loaded vocoders models: " + str(len(synthesizers)))
|
print("Loaded vocoders models: " + str(len(synthesizers)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {VOC_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
|
|
||||||
class Input(BaseModel):
|
class Input(BaseModel):
|
||||||
|
|
|
@ -34,14 +34,20 @@ if os.path.isdir(AUDIO_SAMPLES_DIR):
|
||||||
if os.path.isdir(EXT_MODELS_DIRT):
|
if os.path.isdir(EXT_MODELS_DIRT):
|
||||||
extractors = Enum('extractors', list((file.name, file) for file in Path(EXT_MODELS_DIRT).glob("**/*.pt")))
|
extractors = Enum('extractors', list((file.name, file) for file in Path(EXT_MODELS_DIRT).glob("**/*.pt")))
|
||||||
print("Loaded extractor models: " + str(len(extractors)))
|
print("Loaded extractor models: " + str(len(extractors)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {EXT_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
if os.path.isdir(CONV_MODELS_DIRT):
|
if os.path.isdir(CONV_MODELS_DIRT):
|
||||||
convertors = Enum('convertors', list((file.name, file) for file in Path(CONV_MODELS_DIRT).glob("**/*.pth")))
|
convertors = Enum('convertors', list((file.name, file) for file in Path(CONV_MODELS_DIRT).glob("**/*.pth")))
|
||||||
print("Loaded convertor models: " + str(len(convertors)))
|
print("Loaded convertor models: " + str(len(convertors)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {CONV_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
if os.path.isdir(VOC_MODELS_DIRT):
|
if os.path.isdir(VOC_MODELS_DIRT):
|
||||||
vocoders = Enum('vocoders', list((file.name, file) for file in Path(VOC_MODELS_DIRT).glob("**/*gan*.pt")))
|
vocoders = Enum('vocoders', list((file.name, file) for file in Path(VOC_MODELS_DIRT).glob("**/*gan*.pt")))
|
||||||
print("Loaded vocoders models: " + str(len(vocoders)))
|
print("Loaded vocoders models: " + str(len(vocoders)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {VOC_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
class Input(BaseModel):
|
class Input(BaseModel):
|
||||||
local_audio_file: audio_input_selection = Field(
|
local_audio_file: audio_input_selection = Field(
|
||||||
|
|
|
@ -13,9 +13,14 @@ ENC_MODELS_DIRT = "encoder\\saved_models"
|
||||||
if os.path.isdir(EXT_MODELS_DIRT):
|
if os.path.isdir(EXT_MODELS_DIRT):
|
||||||
extractors = Enum('extractors', list((file.name, file) for file in Path(EXT_MODELS_DIRT).glob("**/*.pt")))
|
extractors = Enum('extractors', list((file.name, file) for file in Path(EXT_MODELS_DIRT).glob("**/*.pt")))
|
||||||
print("Loaded extractor models: " + str(len(extractors)))
|
print("Loaded extractor models: " + str(len(extractors)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {EXT_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
if os.path.isdir(ENC_MODELS_DIRT):
|
if os.path.isdir(ENC_MODELS_DIRT):
|
||||||
encoders = Enum('encoders', list((file.name, file) for file in Path(ENC_MODELS_DIRT).glob("**/*.pt")))
|
encoders = Enum('encoders', list((file.name, file) for file in Path(ENC_MODELS_DIRT).glob("**/*.pt")))
|
||||||
print("Loaded encoders models: " + str(len(encoders)))
|
print("Loaded encoders models: " + str(len(encoders)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {ENC_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
class Model(str, Enum):
|
class Model(str, Enum):
|
||||||
VC_PPG2MEL = "ppg2mel"
|
VC_PPG2MEL = "ppg2mel"
|
||||||
|
|
|
@ -18,12 +18,20 @@ ENC_MODELS_DIRT = "encoder\\saved_models"
|
||||||
if os.path.isdir(EXT_MODELS_DIRT):
|
if os.path.isdir(EXT_MODELS_DIRT):
|
||||||
extractors = Enum('extractors', list((file.name, file) for file in Path(EXT_MODELS_DIRT).glob("**/*.pt")))
|
extractors = Enum('extractors', list((file.name, file) for file in Path(EXT_MODELS_DIRT).glob("**/*.pt")))
|
||||||
print("Loaded extractor models: " + str(len(extractors)))
|
print("Loaded extractor models: " + str(len(extractors)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {EXT_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
if os.path.isdir(CONV_MODELS_DIRT):
|
if os.path.isdir(CONV_MODELS_DIRT):
|
||||||
convertors = Enum('convertors', list((file.name, file) for file in Path(CONV_MODELS_DIRT).glob("**/*.pth")))
|
convertors = Enum('convertors', list((file.name, file) for file in Path(CONV_MODELS_DIRT).glob("**/*.pth")))
|
||||||
print("Loaded convertor models: " + str(len(convertors)))
|
print("Loaded convertor models: " + str(len(convertors)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {CONV_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
if os.path.isdir(ENC_MODELS_DIRT):
|
if os.path.isdir(ENC_MODELS_DIRT):
|
||||||
encoders = Enum('encoders', list((file.name, file) for file in Path(ENC_MODELS_DIRT).glob("**/*.pt")))
|
encoders = Enum('encoders', list((file.name, file) for file in Path(ENC_MODELS_DIRT).glob("**/*.pt")))
|
||||||
print("Loaded encoders models: " + str(len(encoders)))
|
print("Loaded encoders models: " + str(len(encoders)))
|
||||||
|
else:
|
||||||
|
raise Exception(f"Model folder {ENC_MODELS_DIRT} doesn't exist.")
|
||||||
|
|
||||||
class Model(str, Enum):
|
class Model(str, Enum):
|
||||||
VC_PPG2MEL = "ppg2mel"
|
VC_PPG2MEL = "ppg2mel"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user