r9y9 / nnmnkwii

Library to build speech synthesis systems designed for easy and fast prototyping.
https://r9y9.github.io/nnmnkwii/latest/
Other
393 stars 73 forks source link

Fix label time overflow on environment which size of np.int is 4bytes. #108

Closed taroushirani closed 4 years ago

taroushirani commented 4 years ago

On environment which size of np.int is 4 bytes, HTSLabelFile.round_() may return negative start_time or end_time due to integer overflow. Replacing np.int with np.int64 solves this problem.

P.S. I have no idea why the size of np.int is 4 bytes even though anaconda's python is 64bit.

$ winpty python
Python 3.6.10 |Anaconda, Inc.| (default, May  7 2020, 19:46:08) [MSC v.1916 64 b
it (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.maxsize)
9223372036854775807
>>> from nnmnkwii.io import hts
>>> label_path="large_time_example.lab"
>>> labels = hts.load(label_path)
>>> print(labels)
2135126050 2137647058 c@m^a-d+e=i_00%00^00_00~00-1!2[xx$1]xx/A:2-1-1@JPN~0/B:2_1
_1@JPN|0/C:1+1+1@JPN&0/D:A3!9#0$4/4%119|1&25;12-xx/E:B3]11^0=4/4~119!1@25#12+xx]
6$1|17[2&84]12=87^13~10#12_27;47$132&228%36[64|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#xx|
xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~m2+p2!xx^xx/F:Db4#1#0-4
/4$119$1+100%48;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
2135126050 2137647058 v@a^d-e+i=s_00%00^00_00~00-2!1[xx$xx]xx/A:2-1-1@JPN~0/B:2_
1_1@JPN|0/C:1+1+1@JPN&0/D:A3!9#0$4/4%119|1&25;12-xx/E:B3]11^0=4/4~119!1@25#12+xx
]6$1|17[2&84]12=87^13~10#12_27;47$132&228%36[64|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#xx
|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~m2+p2!xx^xx/F:Db4#1#0-
4/4$119$1+100%48;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
2137647058 2147731092 v@d^e-i+s=o_00%00^00_00~00-1!1[xx$xx]xx/A:2-1-1@JPN~0/B:1_
1_1@JPN|0/C:2+1+1@JPN&0/D:B3!11#0$4/4%119|1&25;12-xx/E:Db4]1^0=4/4~119!1@100#48+
xx]1$5|0[20&0]96=0^100~11#11_30;45$144&216%40[60|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#x
x|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~m2+m7!xx^xx/F:Gb3#6#0
-4/4$119$1+25%12;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
2147731092 2150252100 c@e^i-s+o=r_00%00^00_00~00-1!2[xx$1]xx/A:1-1-1@JPN~0/B:2_1
_1@JPN|0/C:2+1+1@JPN&0/D:Db4!1#0$4/4%119|1&100;48-xx/E:Gb3]6^0=4/4~119!1@25#12+x
x]2$4|10[10&48]48=50^50~12#10_40;35$192&168%53[47|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#
xx|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~p7+p2!xx^xx/F:Ab3#8#
0-4/4$119$1+25%12;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
>>> print(labels.round_())
2135150000 2137650000 c@m^a-d+e=i_00%00^00_00~00-1!2[xx$1]xx/A:2-1-1@JPN~0/B:2_1
_1@JPN|0/C:1+1+1@JPN&0/D:A3!9#0$4/4%119|1&25;12-xx/E:B3]11^0=4/4~119!1@25#12+xx]
6$1|17[2&84]12=87^13~10#12_27;47$132&228%36[64|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#xx|
xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~m2+p2!xx^xx/F:Db4#1#0-4
/4$119$1+100%48;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
2135150000 2137650000 v@a^d-e+i=s_00%00^00_00~00-2!1[xx$xx]xx/A:2-1-1@JPN~0/B:2_
1_1@JPN|0/C:1+1+1@JPN&0/D:A3!9#0$4/4%119|1&25;12-xx/E:B3]11^0=4/4~119!1@25#12+xx
]6$1|17[2&84]12=87^13~10#12_27;47$132&228%36[64|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#xx
|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~m2+p2!xx^xx/F:Db4#1#0-
4/4$119$1+100%48;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
2137650000 -2147217296 v@d^e-i+s=o_00%00^00_00~00-1!1[xx$xx]xx/A:2-1-1@JPN~0/B:1
_1_1@JPN|0/C:2+1+1@JPN&0/D:B3!11#0$4/4%119|1&25;12-xx/E:Db4]1^0=4/4~119!1@100#48
+xx]1$5|0[20&0]96=0^100~11#11_30;45$144&216%40[60|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#
xx|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~m2+m7!xx^xx/F:Gb3#6#
0-4/4$119$1+25%12;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
-2147217296 -2144717296 c@e^i-s+o=r_00%00^00_00~00-1!2[xx$1]xx/A:1-1-1@JPN~0/B:2
_1_1@JPN|0/C:2+1+1@JPN&0/D:Db4!1#0$4/4%119|1&100;48-xx/E:Gb3]6^0=4/4~119!1@25#12
+xx]2$4|10[10&48]48=50^50~12#10_40;35$192&168%53[47|0]0-n^xx+xx~xx=xx@xx$xx!xx%x
x#xx|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~p7+p2!xx^xx/F:Ab3#
8#0-4/4$119$1+25%12;xx/G:8_8/H:21_21/I:25_25/J:3~3@45
codecov-io commented 4 years ago

Codecov Report

Merging #108 into master will increase coverage by 17.16%. The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #108       +/-   ##
===========================================
+ Coverage   64.45%   81.62%   +17.16%     
===========================================
  Files          32       32               
  Lines        1899     1899               
===========================================
+ Hits         1224     1550      +326     
+ Misses        675      349      -326     
Impacted Files Coverage Δ
nnmnkwii/io/hts.py 93.58% <33.33%> (ø)
nnmnkwii/autograd/_impl/modspec.py 50.00% <0.00%> (+50.00%) :arrow_up:
nnmnkwii/util/linalg.py 100.00% <0.00%> (+62.50%) :arrow_up:
nnmnkwii/paramgen/__init__.py 75.00% <0.00%> (+75.00%) :arrow_up:
nnmnkwii/autograd/_impl/mlpg.py 96.00% <0.00%> (+96.00%) :arrow_up:
nnmnkwii/baseline/gmm.py 97.05% <0.00%> (+97.05%) :arrow_up:
nnmnkwii/preprocessing/alignment.py 97.53% <0.00%> (+97.53%) :arrow_up:
nnmnkwii/paramgen/_mlpg.py 100.00% <0.00%> (+100.00%) :arrow_up:
nnmnkwii/autograd/__init__.py 100.00% <0.00%> (+100.00%) :arrow_up:
nnmnkwii/baseline/__init__.py 100.00% <0.00%> (+100.00%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 616fc60...2628e3c. Read the comment docs.

r9y9 commented 4 years ago

Thanks for catching this. I also had a similar issue before but no idea why too. Anyway, LGTM.

r9y9 commented 4 years ago

Note to me: add a changelog entry