Views
No views yet
microsoft/wavlm-large hidden layers ([1, 3, 7, 12, 18, 23]), with k=1000.pip install speechbrain transformers1import torch
2from speechbrain.lobes.models.huggingface_transformers.hubert import (HuBERT)
3
4inputs = torch.rand([3, 2000])
5model_hub = "facebook/hubert-large-ll60k"
6save_path = "savedir"
7ssl_layer_num = [7,23]
8deduplicate =[False, True]
9bpe_tokenizers=[None, None]
10vocoder_repo_id = "speechbrain/hifigan-hubert-k1000-LibriTTS"
11kmeans_dataset = "LibriSpeech"
12num_clusters = 1000
13ssl_model = HuBERT(model_hub, save_path,output_all_hiddens=True)
14model = DiscreteSSL(save_path, ssl_model, vocoder_repo_id=vocoder_repo_id, kmeans_dataset=kmeans_dataset,num_clusters=num_clusters)
15tokens, _, _ = model.encode(inputs,SSL_layers=ssl_layer_num, deduplicates=deduplicate, bpe_tokenizers=bpe_tokenizers)
16sig = model.decode(tokens, ssl_layer_num)1import torch
2from speechbrain.inference.vocoders import UnitHIFIGAN
3
4hifi_gan_unit = UnitHIFIGAN.from_hparams(source="speechbrain/hifigan-hubert-k1000-LibriTTS", savedir="pretrained_models/vocoder")
5codes = torch.randint(0, 99, (100, 1))
6waveform = hifi_gan_unit.decode_unit(codes)
7run_opts={"device":"cuda"} when calling the from_hparams method.@misc{SB2021,
author = {Ravanelli, Mirco and Parcollet, Titouan and Rouhe, Aku and Plantinga, Peter and Rastorgueva, Elena and Lugosch, Loren and Dawalatabad, Nauman and Ju-Chieh, Chou and Heba, Abdel and Grondin, Francois and Aris, William and Liao, Chien-Feng and Cornell, Samuele and Yeh, Sung-Lin and Na, Hwidong and Gao, Yan and Fu, Szu-Wei and Subakan, Cem and De Mori, Renato and Bengio, Yoshua },
title = {SpeechBrain},
year = {2021},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\\\\url{https://github.com/speechbrain/speechbrain}},
}