Spaces:
Configuration error
Configuration error
Download wenet/ssl/init_model.py from ASLP-lab/OSUM: direct link, hf CLI and curl.
- Browser
- Download file 609 Bytes
-
https://huggingface.co/spaces/ASLP-lab/OSUM/resolve/main/wenet/ssl/init_model.py
- Command line
-
hf download hf://spaces/ASLP-lab/OSUM/wenet/ssl/init_model.py
-
curl -L -o init_model.py https://huggingface.co/spaces/ASLP-lab/OSUM/resolve/main/wenet/ssl/init_model.py
609 Bytes
| from wenet.ssl.bestrq.bestrq_model import BestRQModel | |
| from wenet.ssl.wav2vec2.wav2vec2_model import Wav2vec2Model | |
| from wenet.ssl.w2vbert.w2vbert_model import W2VBERTModel | |
| WENET_SSL_MODEL_CLASS = { | |
| "w2vbert_model": W2VBERTModel, | |
| "wav2vec_model": Wav2vec2Model, | |
| "bestrq_model": BestRQModel | |
| } | |
| def init_model(configs, encoder): | |
| assert 'model' in configs | |
| model_type = configs['model'] | |
| assert model_type in WENET_SSL_MODEL_CLASS.keys() | |
| model = WENET_SSL_MODEL_CLASS[model_type](encoder=encoder, | |
| **configs['model_conf']) | |
| return model | |