Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What version of torch? #8

Open
aijianiula0601 opened this issue Nov 4, 2023 · 3 comments
Open

What version of torch? #8

aijianiula0601 opened this issue Nov 4, 2023 · 3 comments

Comments

@aijianiula0601
Copy link

What version of the following module is? Please give us the detailed version.

torch
torchvision
torchaudio
torchtext

I have the following problem:
/python3.11/site-packages/torchtext/lib/libtorchtext.so: undefined symbol: _ZN5torch3jit21setUTF8DecodingIgnoreEb

And what's your cuda version? Thank you

@GiJeongCho
Copy link

me too.. i saw same erorr
my versions
conda install torchtext==0.17.0
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121

OSError: /home/edutem/anaconda3/envs/vits2/lib/python3.11/site-packages/torchtext/lib/libtorchtext.so: undefined symbol: _ZN3c109TupleTypeC1ESt6vectorINS_4Type24SingletonOrSharedTypePtrIS2_EESaIS4_EESt8optionalINS_13QualifiedNameEESt10shared_ptrINS_14FunctionSchemaEE

@Wyzix33
Copy link

Wyzix33 commented Sep 1, 2024

i was able to run it using pip install torch==2.1.0+cu121 torchvision==0.16.0+cu121 torchaudio==2.1.0+cu121 torchtext==0.16.0 -f https://download.pytorch.org/whl/torch_stable.html
and pip install numpy==1.26.4
also the interface was not working, i ended up doing this:

import IPython.display as ipd
import torch
from torch.utils.data import DataLoader
from text import tokenizer
from torchtext.vocab import Vocab

from utils.task import load_vocab
from text.symbols import  UNK_ID
from utils.task import load_checkpoint
from utils.hparams import get_hparams_from_file
from data_utils import TextAudioSpeakerLoader, TextAudioSpeakerCollate
from model.models import SynthesizerTrn
from text.symbols import symbols
from text import tokenizer



model = "romanian_base"
checkpoint = "G_87000.pth"
hps = get_hparams_from_file(f"./datasets/{model}/config.yaml")
text_cleaners = hps.data.text_cleaners
vocab_file = f"./datasets/{model}/vocab.txt"
token_idx = text_cleaners.index("tokenize_text")
token_cleaners = text_cleaners[token_idx:]

def separate_text_cleaners(text_cleaners):
    final_list = []
    temp_list = []

    for cleaner in text_cleaners:
        if cleaner == "phonemize_text":
            if temp_list:
                final_list.append(temp_list)
            final_list.append([cleaner])
            temp_list = []
        else:
            temp_list.append(cleaner)

    if temp_list:
        final_list.append(temp_list)

    return final_list


text_cleaners = text_cleaners[:token_idx]
text_cleaners = separate_text_cleaners(text_cleaners)
vocab = load_vocab(vocab_file)

filter_length = hps.data.n_mels if hps.data.use_mel else hps.data.n_fft // 2 + 1
segment_size = hps.train.segment_size // hps.data.hop_length
net_g = SynthesizerTrn(len(symbols), filter_length, segment_size, **hps.model).cuda()
_ = net_g.eval()
_ = load_checkpoint(f"./datasets/{model}/logs/{checkpoint}", net_g, None)

text = "example text for testing"
for cleaners in text_cleaners:
    text = tokenizer(text, Vocab, cleaners, language=hps.data.language)
temp = tokenizer(text, vocab, token_cleaners, language=hps.data.language)
assert UNK_ID not in temp, f"Found unknown symbol:\n{text}\n{detokenizer(temp)}"
print(temp)
stn_tst =  torch.LongTensor(temp)
with torch.no_grad():
    x_tst = stn_tst.cuda().unsqueeze(0)
    x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).cuda()

    out = net_g.infer(x_tst, x_tst_lengths, noise_scale=0.667, noise_scale_w=0.8, length_scale=1)
    audio = out[0][0, 0].data.cpu().float().numpy()
ipd.display(ipd.Audio(audio, rate=hps.data.sample_rate, normalize=False))

@annam-airia
Copy link

annam-airia commented Nov 12, 2024

i was able to run it using pip install torch==2.1.0+cu121 torchvision==0.16.0+cu121 torchaudio==2.1.0+cu121 torchtext==0.16.0 -f https://download.pytorch.org/whl/torch_stable.html and pip install numpy==1.26.4 also the interface was not working, i ended up doing this:

import IPython.display as ipd
import torch
from torch.utils.data import DataLoader
from text import tokenizer
from torchtext.vocab import Vocab

from utils.task import load_vocab
from text.symbols import  UNK_ID
from utils.task import load_checkpoint
from utils.hparams import get_hparams_from_file
from data_utils import TextAudioSpeakerLoader, TextAudioSpeakerCollate
from model.models import SynthesizerTrn
from text.symbols import symbols
from text import tokenizer



model = "romanian_base"
checkpoint = "G_87000.pth"
hps = get_hparams_from_file(f"./datasets/{model}/config.yaml")
text_cleaners = hps.data.text_cleaners
vocab_file = f"./datasets/{model}/vocab.txt"
token_idx = text_cleaners.index("tokenize_text")
token_cleaners = text_cleaners[token_idx:]

def separate_text_cleaners(text_cleaners):
    final_list = []
    temp_list = []

    for cleaner in text_cleaners:
        if cleaner == "phonemize_text":
            if temp_list:
                final_list.append(temp_list)
            final_list.append([cleaner])
            temp_list = []
        else:
            temp_list.append(cleaner)

    if temp_list:
        final_list.append(temp_list)

    return final_list


text_cleaners = text_cleaners[:token_idx]
text_cleaners = separate_text_cleaners(text_cleaners)
vocab = load_vocab(vocab_file)

filter_length = hps.data.n_mels if hps.data.use_mel else hps.data.n_fft // 2 + 1
segment_size = hps.train.segment_size // hps.data.hop_length
net_g = SynthesizerTrn(len(symbols), filter_length, segment_size, **hps.model).cuda()
_ = net_g.eval()
_ = load_checkpoint(f"./datasets/{model}/logs/{checkpoint}", net_g, None)

text = "example text for testing"
for cleaners in text_cleaners:
    text = tokenizer(text, Vocab, cleaners, language=hps.data.language)
temp = tokenizer(text, vocab, token_cleaners, language=hps.data.language)
assert UNK_ID not in temp, f"Found unknown symbol:\n{text}\n{detokenizer(temp)}"
print(temp)
stn_tst =  torch.LongTensor(temp)
with torch.no_grad():
    x_tst = stn_tst.cuda().unsqueeze(0)
    x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).cuda()

    out = net_g.infer(x_tst, x_tst_lengths, noise_scale=0.667, noise_scale_w=0.8, length_scale=1)
    audio = out[0][0, 0].data.cpu().float().numpy()
ipd.display(ipd.Audio(audio, rate=hps.data.sample_rate, normalize=False))

Hi Wyzix33, thanks for the help. Wondering how you delt with the import "from text.symbols import symbols" when the content for symbols.py is:

"""
Set of symbols
"""
_punctuation = ';:,.!?¡¿—…"«»“”'

"""
Special symbols
"""

special_symbols = ["", "", "", "", "", ""]
PAD_ID, UNK_ID, BOS_ID, EOS_ID = 0, 1, 2, 3

... without 'symbols'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants