mirror of https://github.com/coqui-ai/TTS.git
chore(bark): remove manual download of hubert model
Bark was previously adapted to download Hubert from HuggingFace, so the manual download is superfluous.
This commit is contained in:
parent
86b58fb6d9
commit
659b4852ba
|
@ -48,7 +48,6 @@
|
||||||
"https://coqui.gateway.scarf.sh/hf/bark/fine_2.pt",
|
"https://coqui.gateway.scarf.sh/hf/bark/fine_2.pt",
|
||||||
"https://coqui.gateway.scarf.sh/hf/bark/text_2.pt",
|
"https://coqui.gateway.scarf.sh/hf/bark/text_2.pt",
|
||||||
"https://coqui.gateway.scarf.sh/hf/bark/config.json",
|
"https://coqui.gateway.scarf.sh/hf/bark/config.json",
|
||||||
"https://coqui.gateway.scarf.sh/hf/bark/hubert.pt",
|
|
||||||
"https://coqui.gateway.scarf.sh/hf/bark/tokenizer.pth"
|
"https://coqui.gateway.scarf.sh/hf/bark/tokenizer.pth"
|
||||||
],
|
],
|
||||||
"default_vocoder": null,
|
"default_vocoder": null,
|
||||||
|
|
|
@ -96,7 +96,6 @@ class BarkConfig(BaseTTSConfig):
|
||||||
"coarse": os.path.join(self.CACHE_DIR, "coarse_2.pt"),
|
"coarse": os.path.join(self.CACHE_DIR, "coarse_2.pt"),
|
||||||
"fine": os.path.join(self.CACHE_DIR, "fine_2.pt"),
|
"fine": os.path.join(self.CACHE_DIR, "fine_2.pt"),
|
||||||
"hubert_tokenizer": os.path.join(self.CACHE_DIR, "tokenizer.pth"),
|
"hubert_tokenizer": os.path.join(self.CACHE_DIR, "tokenizer.pth"),
|
||||||
"hubert": os.path.join(self.CACHE_DIR, "hubert.pt"),
|
|
||||||
}
|
}
|
||||||
self.SMALL_REMOTE_MODEL_PATHS = {
|
self.SMALL_REMOTE_MODEL_PATHS = {
|
||||||
"text": {"path": os.path.join(self.REMOTE_BASE_URL, "text.pt")},
|
"text": {"path": os.path.join(self.REMOTE_BASE_URL, "text.pt")},
|
||||||
|
|
|
@ -40,7 +40,7 @@ class CustomHubert(nn.Module):
|
||||||
or you can train your own
|
or you can train your own
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, checkpoint_path, target_sample_hz=16000, seq_len_multiple_of=None, output_layer=9, device=None):
|
def __init__(self, target_sample_hz=16000, seq_len_multiple_of=None, output_layer=9, device=None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.target_sample_hz = target_sample_hz
|
self.target_sample_hz = target_sample_hz
|
||||||
self.seq_len_multiple_of = seq_len_multiple_of
|
self.seq_len_multiple_of = seq_len_multiple_of
|
||||||
|
|
|
@ -134,10 +134,9 @@ def generate_voice(
|
||||||
# generate semantic tokens
|
# generate semantic tokens
|
||||||
# Load the HuBERT model
|
# Load the HuBERT model
|
||||||
hubert_manager = HubertManager()
|
hubert_manager = HubertManager()
|
||||||
# hubert_manager.make_sure_hubert_installed(model_path=model.config.LOCAL_MODEL_PATHS["hubert"])
|
|
||||||
hubert_manager.make_sure_tokenizer_installed(model_path=model.config.LOCAL_MODEL_PATHS["hubert_tokenizer"])
|
hubert_manager.make_sure_tokenizer_installed(model_path=model.config.LOCAL_MODEL_PATHS["hubert_tokenizer"])
|
||||||
|
|
||||||
hubert_model = CustomHubert(checkpoint_path=model.config.LOCAL_MODEL_PATHS["hubert"]).to(model.device)
|
hubert_model = CustomHubert().to(model.device)
|
||||||
|
|
||||||
# Load the CustomTokenizer model
|
# Load the CustomTokenizer model
|
||||||
tokenizer = HubertTokenizer.load_from_checkpoint(
|
tokenizer = HubertTokenizer.load_from_checkpoint(
|
||||||
|
|
|
@ -243,7 +243,6 @@ class Bark(BaseTTS):
|
||||||
text_model_path=None,
|
text_model_path=None,
|
||||||
coarse_model_path=None,
|
coarse_model_path=None,
|
||||||
fine_model_path=None,
|
fine_model_path=None,
|
||||||
hubert_model_path=None,
|
|
||||||
hubert_tokenizer_path=None,
|
hubert_tokenizer_path=None,
|
||||||
eval=False,
|
eval=False,
|
||||||
strict=True,
|
strict=True,
|
||||||
|
@ -266,13 +265,11 @@ class Bark(BaseTTS):
|
||||||
text_model_path = text_model_path or os.path.join(checkpoint_dir, "text_2.pt")
|
text_model_path = text_model_path or os.path.join(checkpoint_dir, "text_2.pt")
|
||||||
coarse_model_path = coarse_model_path or os.path.join(checkpoint_dir, "coarse_2.pt")
|
coarse_model_path = coarse_model_path or os.path.join(checkpoint_dir, "coarse_2.pt")
|
||||||
fine_model_path = fine_model_path or os.path.join(checkpoint_dir, "fine_2.pt")
|
fine_model_path = fine_model_path or os.path.join(checkpoint_dir, "fine_2.pt")
|
||||||
hubert_model_path = hubert_model_path or os.path.join(checkpoint_dir, "hubert.pt")
|
|
||||||
hubert_tokenizer_path = hubert_tokenizer_path or os.path.join(checkpoint_dir, "tokenizer.pth")
|
hubert_tokenizer_path = hubert_tokenizer_path or os.path.join(checkpoint_dir, "tokenizer.pth")
|
||||||
|
|
||||||
self.config.LOCAL_MODEL_PATHS["text"] = text_model_path
|
self.config.LOCAL_MODEL_PATHS["text"] = text_model_path
|
||||||
self.config.LOCAL_MODEL_PATHS["coarse"] = coarse_model_path
|
self.config.LOCAL_MODEL_PATHS["coarse"] = coarse_model_path
|
||||||
self.config.LOCAL_MODEL_PATHS["fine"] = fine_model_path
|
self.config.LOCAL_MODEL_PATHS["fine"] = fine_model_path
|
||||||
self.config.LOCAL_MODEL_PATHS["hubert"] = hubert_model_path
|
|
||||||
self.config.LOCAL_MODEL_PATHS["hubert_tokenizer"] = hubert_tokenizer_path
|
self.config.LOCAL_MODEL_PATHS["hubert_tokenizer"] = hubert_tokenizer_path
|
||||||
|
|
||||||
self.load_bark_models()
|
self.load_bark_models()
|
||||||
|
|
Loading…
Reference in New Issue