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

RuntimeError: The size of tensor a (51) must match the size of tensor b (53) at non-singleton dimension 1 #131

Open
yinchyu opened this issue Dec 6, 2021 · 11 comments

Comments

@yinchyu
Copy link

yinchyu commented Dec 6, 2021

File "/data/home/scv1106/FastSpeech2/model/modules.py", line 121, in forward
x = x + pitch_embedding
RuntimeError: The size of tensor a (51) must match the size of tensor b (53) at non-singleton dimension 1

use biaobei dataset to training, but found the problem that the tensor is not in same dimension what should i do to reslove the problems?

@yanzhuangzhuang-beep
Copy link

我之前也是这样,我觉得是词库不是完整导致有的索引为空 数据不对齐。
但是当我补充完词汇后发现了新的问题 不知道是不是采样率的问题 你可以先打印缺少的字符 在text/system中

@yanzhuangzhuang-beep
Copy link

使用MFA后的数据 我的实验就正常可以跑了

@yinchyu
Copy link
Author

yinchyu commented Dec 10, 2021

我使用了mfa 生成的词汇表和声学模型,但是还是有这个问题,

@chenming6615
Copy link

Maybe your lexicon generated by MFA contains some phones that are not included in the phone list in the text/pinyin.py file.

finals = [
    "a1",
    "a2",
    "a3",
    "a4",
    "a5",
    "ai1",
    "ai2",
    "ai3",
    "ai4",
...
]

You can print out the missing phones by modifying the _symbols_to_sequence function in text/__init__.py into

def _symbols_to_sequence(symbols):
    missing=[s for s in symbols if not _should_keep_symbol(s)]
    if missing:
        print(missing)
    return [_symbol_to_id[s] for s in symbols if _should_keep_symbol(s)]

And add the missing phones into text/pinyin.py

@everschen
Copy link

if chinese, please try PR: #153

@AkiKagura
Copy link

我也遇到了类似的问题,但是我是刚训练的,mfa生成的音节已经不是拼音了,是一些我看不懂的符号

@tuntun990606
Copy link

我也遇到了类似的问题,但是我是刚训练的,mfa生成的音节已经不是拼音了,是一些我看不懂的符号

你需要把音素加到,text/symbols里

@jobanpreet495
Copy link

Maybe your lexicon generated by MFA contains some phones that are not included in the phone list in the text/pinyin.py file.

finals = [
    "a1",
    "a2",
    "a3",
    "a4",
    "a5",
    "ai1",
    "ai2",
    "ai3",
    "ai4",
...
]

You can print out the missing phones by modifying the _symbols_to_sequence function in text/__init__.py into

def _symbols_to_sequence(symbols):
    missing=[s for s in symbols if not _should_keep_symbol(s)]
    if missing:
        print(missing)
    return [_symbol_to_id[s] for s in symbols if _should_keep_symbol(s)]

And add the missing phones into text/pinyin.py

This worked

@laTH380
Copy link

laTH380 commented Nov 8, 2023

MFA によって生成された辞書には、ファイル内の電話リストに含まれていない電話が含まれている可能性がありますtext/pinyin.py

finals = [
    "a1",
    "a2",
    "a3",
    "a4",
    "a5",
    "ai1",
    "ai2",
    "ai3",
    "ai4",
...
]

_symbols_to_sequenceの関数をtext/__init__.py次のように変更することで、不足している電話機を印刷できます。

def _symbols_to_sequence(symbols):
    missing=[s for s in symbols if not _should_keep_symbol(s)]
    if missing:
        print(missing)
    return [_symbol_to_id[s] for s in symbols if _should_keep_symbol(s)]

不足している電話を追加します text/pinyin.py

this is useful when also training japanese model!
Thank you!!!

@Lakhjeet1082
Copy link

Maybe your lexicon generated by MFA contains some phones that are not included in the phone list in the text/pinyin.py file.

finals = [
    "a1",
    "a2",
    "a3",
    "a4",
    "a5",
    "ai1",
    "ai2",
    "ai3",
    "ai4",
...
]

You can print out the missing phones by modifying the _symbols_to_sequence function in text/__init__.py into

def _symbols_to_sequence(symbols):
    missing=[s for s in symbols if not _should_keep_symbol(s)]
    if missing:
        print(missing)
    return [_symbol_to_id[s] for s in symbols if _should_keep_symbol(s)]

And add the missing phones into text/pinyin.py
I am getting list of many missing phones, where should I exactly add them. Please guide me on this

@chenming6615
Copy link

Maybe your lexicon generated by MFA contains some phones that are not included in the phone list in the text/pinyin.py file.

finals = [
    "a1",
    "a2",
    "a3",
    "a4",
    "a5",
    "ai1",
    "ai2",
    "ai3",
    "ai4",
...
]

You can print out the missing phones by modifying the _symbols_to_sequence function in text/__init__.py into

def _symbols_to_sequence(symbols):
    missing=[s for s in symbols if not _should_keep_symbol(s)]
    if missing:
        print(missing)
    return [_symbol_to_id[s] for s in symbols if _should_keep_symbol(s)]

And add the missing phones into text/pinyin.py
I am getting list of many missing phones, where should I exactly add them. Please guide me on this

add them into to the finals list in the file text/pinyin.py

"vn5",

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

9 participants