Spaces:
Build error
Build error
Download vocoders/base_vocoder.py from TheEliEngineer/ProDiff: direct link, hf CLI and curl.
- Browser
- Download file 841 Bytes
-
https://huggingface.co/spaces/TheEliEngineer/ProDiff/resolve/main/vocoders/base_vocoder.py
- Command line
-
hf download hf://spaces/TheEliEngineer/ProDiff/vocoders/base_vocoder.py
-
curl -L -o base_vocoder.py https://huggingface.co/spaces/TheEliEngineer/ProDiff/resolve/main/vocoders/base_vocoder.py
841 Bytes
| import importlib | |
| VOCODERS = {} | |
| def register_vocoder(cls): | |
| VOCODERS[cls.__name__.lower()] = cls | |
| VOCODERS[cls.__name__] = cls | |
| return cls | |
| def get_vocoder_cls(hparams): | |
| if hparams['vocoder'] in VOCODERS: | |
| return VOCODERS[hparams['vocoder']] | |
| else: | |
| vocoder_cls = hparams['vocoder'] | |
| pkg = ".".join(vocoder_cls.split(".")[:-1]) | |
| cls_name = vocoder_cls.split(".")[-1] | |
| vocoder_cls = getattr(importlib.import_module(pkg), cls_name) | |
| return vocoder_cls | |
| class BaseVocoder: | |
| def spec2wav(self, mel): | |
| """ | |
| :param mel: [T, 80] | |
| :return: wav: [T'] | |
| """ | |
| raise NotImplementedError | |
| def wav2spec(wav_fn): | |
| """ | |
| :param wav_fn: str | |
| :return: wav, mel: [T, 80] | |
| """ | |
| raise NotImplementedError | |