gitmylo / bark-voice-cloning-HuBERT-quantizer

The code for the bark-voicecloning model. Training and inference.
MIT License
671 stars 111 forks source link

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' #26

Closed tangzeq closed 1 year ago

tangzeq commented 1 year ago

file: colab_notebook.ipynb when: large_quant_model = False # Use the larger pretrained model device = 'cuda' # 'cuda', 'cpu', 'cuda:0', 0, -1, torch.device('cuda')

import numpy as np import torch import torchaudio from encodec import EncodecModel from encodec.utils import convert_audio from hubert.hubert_manager import HuBERTManager from hubert.pre_kmeans_hubert import CustomHubert from hubert.customtokenizer import CustomTokenizer

model = ('quantifier_V1_hubert_base_ls960_23.pth', 'tokenizer_large.pth') if large_quant_model else ('quantifier_hubert_base_ls960_14.pth', 'tokenizer.pth')

print('Loading HuBERT...') hubert_model = CustomHubert(HuBERTManager.make_sure_hubert_installed(), device=device) print('Loading Quantizer...') quant_model = CustomTokenizer.load_from_checkpoint(HuBERTManager.make_sure_tokenizer_installed(model=model[0], local_file=model[1]), device) print('Loading Encodec...') encodec_model = EncodecModel.encodec_model_24khz() encodec_model.set_target_bandwidth(6.0) encodec_model.to(device)

print('Downloaded and loaded models!')

then:

TypeError Traceback (most recent call last)

in 9 from hubert.hubert_manager import HuBERTManager 10 from hubert.pre_kmeans_hubert import CustomHubert ---> 11 from hubert.customtokenizer import CustomTokenizer 12 13 model = ('quantifier_V1_hubert_base_ls960_23.pth', 'tokenizer_large.pth') if large_quant_model else ('quantifier_hubert_base_ls960_14.pth', 'tokenizer.pth') /data/bark_clone/hubert/customtokenizer.py in 151 152 --> 153 def auto_train(data_path, save_path='model.pth', load_model: str | None = None, save_epochs=1): 154 data_x, data_y = [], [] 155 TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
gitmylo commented 1 year ago

You need to run this on python 3.10 or higher, as I use | to indicate union types, which is a feature added in 3.10