g2p-seq2seq
g2p-seq2seq copied to clipboard
error in g2p_seq2seq test
Hi!
I've installed g2p_seq2seq in windows10 successfully, but when I want to test it(with python setup.py test in CMD) I have the below error.
could help me?
F:\R.V\university\pro\PROJECT 2\SoftWares\g2p-seq2seq-master>python setup.py test
running test
running egg_info
writing g2p_seq2seq.egg-info\PKG-INFO
writing dependency_links to g2p_seq2seq.egg-info\dependency_links.txt
writing entry points to g2p_seq2seq.egg-info\entry_points.txt
writing requirements to g2p_seq2seq.egg-info\requires.txt
writing top-level names to g2p_seq2seq.egg-info\top_level.txt
reading manifest file 'g2p_seq2seq.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'g2p_seq2seq.egg-info\SOURCES.txt'
running build_ext
C:\Users\ida\AppData\Local\Programs\Python\Python36\lib\site-packages\h5py_init_.py:36: FutureWarning: Conversion of the second argument of issubdtype from float
to np.floating
is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type
.
from ._conv import register_converters as _register_converters
test_decode (tests.g2p_unittest.TestG2P) ... f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p_trainer_utils.py:211: ResourceWarning: unclosed file <_io.TextIOWrapper name='F:\R.V\university\pro\PROJECT 2\SoftWares\g2p-seq2seq-master\tests\models\decode\model.params' mode='r' encoding='cp1252'>
model_params = json.load(open(params_file_path))
C:\Users\ida\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\tf_logging.py:114: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
_get_logger().warn(msg, *args, **kwargs)
WARNING:tensorflow:Schedule=train_and_evaluate. Assuming that training is running on a single machine.
[2018-06-02 14:16:53,797] Schedule=train_and_evaluate. Assuming that training is running on a single machine.
WARNING:tensorflow:Estimator's model_fn (<function T2TModel.make_estimator_model_fn.
====================================================================== ERROR: test_decode (tests.g2p_unittest.TestG2P)
Traceback (most recent call last): File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p.py", line 447, in __decode_from_file for result in result_iter: File "C:\Users\ida\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\estimator\estimator.py", line 421, in predict input_fn, model_fn_lib.ModeKeys.PREDICT) File "C:\Users\ida\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\estimator\estimator.py", line 585, in _get_features_from_input_fn result = self._call_input_fn(input_fn, mode) File "C:\Users\ida\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\estimator\estimator.py", line 694, in _call_input_fn return input_fn(**kwargs) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p.py", line 439, in input_fn gen_fn = decoding.make_input_fn_from_generator(input_gen) File "C:\Users\ida\AppData\Local\Programs\Python\Python36\lib\site-packages\tensor2tensor\utils\decoding.py", line 324, in make_input_fn_from_generator first_ex = six.next(gen) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p.py", line 562, in _decode_batch_input_fn input_ids = vocabulary.encode(_inputs) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p_encoder.py", line 68, in encode if isinstance(symbols_line, unicode): NameError: name 'unicode' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\tests\g2p_unittest.py", line 33, in test_decode g2p_model.decode(output_file_path=output_file_path) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p.py", line 289, in decode inputs, decodes = self.__decode_from_file(self.test_path) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p.py", line 473, in __decode_from_file raise StandardError("Invalid model in {}".format(self.params.model_dir)) NameError: name 'StandardError' is not defined
====================================================================== ERROR: test_evaluate (tests.g2p_unittest.TestG2P)
Traceback (most recent call last): File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\tests\g2p_unittest.py", line 46, in test_evaluate g2p_model.evaluate() File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p.py", line 308, in evaluate self.problem.target_vocab): File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p_problem.py", line 191, in tabbed_generator source_ints = source_vocab.encode(source) + eos_list File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p_encoder.py", line 68, in encode if isinstance(symbols_line, unicode): NameError: name 'unicode' is not defined
====================================================================== ERROR: test_train (tests.g2p_unittest.TestG2P)
Traceback (most recent call last): File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\tests\g2p_unittest.py", line 22, in test_train test_path=dev_path) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p.py", line 66, in init test_path=test_path, cleanup=cleanup) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p_problem.py", line 67, in init test_path=self.test_path) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p_encoder.py", line 189, in load_create_vocabs source_vocab.store_to_file(vocab_filename) File "f:\r.v\university\pro\project 2\softwares\g2p-seq2seq-master\g2p_seq2seq\g2p_encoder.py", line 150, in store_to_file for i in xrange(len(self._id_to_sym)): NameError: name 'xrange' is not defined
Ran 3 tests in 0.352s
FAILED (errors=3) Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0> error: Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>
Can anyone help me??? I will be grateful.
Hello, @VBR1016 We had fixed some problems related with running on python3. Can you, please, clone the latest version of g2p-seq2seq. Also, current version of g2p-seq2seq works only with tensor2tensor ver 1.5.7. Be sure that you have installed old tensor2tensor=1.5.7.
The version of my tensor2tensor and tensorflow is 1.5.7 and 1.5.0.I'm working with windows 10 and the version of my python is 3.6.5.my biggest problem is that I really don't know how to use this toolkit. The codes for using this toolkit which is in it's website for making dictionary, does'nt work for me. Please help me. Thanks in advance
I am getting this error as well. Windows, Python version 3.5.5, tensorflow version 1.8, tensor2tensor 1.5.7. All the errors look like python 2 scripts running under python 3, but it looks like y'all already know that. Glad someone else is getting this too.
Okay, so I did have to update my version and these previous errors went away. So I had to 'git fetch master' and 'git pull'. However, I got 3 different errors relating to python 3 vs python2 again, this time the same one x3, and this time I checked and the files are like this on github as well:
running test running egg_info writing requirements to g2p_seq2seq.egg-info\requires.txt writing dependency_links to g2p_seq2seq.egg-info\dependency_links.txt writing top-level names to g2p_seq2seq.egg-info\top_level.txt writing g2p_seq2seq.egg-info\PKG-INFO writing entry points to g2p_seq2seq.egg-info\entry_points.txt reading manifest file 'g2p_seq2seq.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'g2p_seq2seq.egg-info\SOURCES.txt' running build_ext test_decode (tests.g2p_unittest.TestG2P) ... f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_trainer_utils.py:210: ResourceWarning: unclosed file <_io.TextIOWrapper name='F:\projects\seq2seq_raplyrics\g2p-seq2seq\tests\models\decode\model.params' mode='r' encoding='cp1252'> model_params = json.load(open(params_file_path)) ERROR test_evaluate (tests.g2p_unittest.TestG2P) ... ERROR test_train (tests.g2p_unittest.TestG2P) ... ERROR
====================================================================== ERROR: test_decode (tests.g2p_unittest.TestG2P)
Traceback (most recent call last): File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\tests\g2p_unittest.py", line 34, in test_decode g2p_model = G2PModel(params, test_path=decode_file_path) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p.py", line 66, in init test_path=test_path, cleanup=cleanup) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_problem.py", line 72, in init vocab_filename) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 177, in load_create_vocabs source_vocab = GraphemePhonemeEncoder(vocab_filename=vocab_filename) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 61, in init self._init_vocab_from_file(vocab_filename) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 103, in _init_vocab_from_file self._init_vocab(sym_gen(), add_reserved_symbols=False) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 133, in _init_vocab enumerate(sym_generator, start=non_reserved_start_index)) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 100, in sym_gen sym = line.decode("utf-8").strip() AttributeError: 'str' object has no attribute 'decode'
====================================================================== ERROR: test_evaluate (tests.g2p_unittest.TestG2P)
Traceback (most recent call last): File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\tests\g2p_unittest.py", line 47, in test_evaluate g2p_model = G2PModel(params, test_path=gt_path) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p.py", line 66, in init test_path=test_path, cleanup=cleanup) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_problem.py", line 72, in init vocab_filename) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 177, in load_create_vocabs source_vocab = GraphemePhonemeEncoder(vocab_filename=vocab_filename) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 61, in init self._init_vocab_from_file(vocab_filename) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 103, in _init_vocab_from_file self._init_vocab(sym_gen(), add_reserved_symbols=False) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 133, in _init_vocab enumerate(sym_generator, start=non_reserved_start_index)) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 100, in sym_gen sym = line.decode("utf-8").strip() AttributeError: 'str' object has no attribute 'decode'
====================================================================== ERROR: test_train (tests.g2p_unittest.TestG2P)
Traceback (most recent call last): File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\tests\g2p_unittest.py", line 24, in test_train test_path=dev_path) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p.py", line 66, in init test_path=test_path, cleanup=cleanup) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_problem.py", line 67, in init test_path=self.test_path) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 183, in load_create_vocabs vocab_list = build_vocab_list(data_path, vocab_list) File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\g2p_seq2seq\g2p_encoder.py", line 163, in build_vocab_list items = line.decode("utf-8").strip().split() AttributeError: 'str' object has no attribute 'decode'
Ran 3 tests in 0.007s
FAILED (errors=3) Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0> error: Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>
I solved these issues by simply removing the "decode" part. It's not unicode anymore so it doesn't need it. Later on down the line I run into another error:
====================================================================== ERROR: test_train (tests.g2p_unittest.TestG2P)
Traceback (most recent call last): File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\tests\g2p_unittest.py", line 35, in test_train shutil.rmtree(model_dir, ignore_errors=False, onerror=handleRemoveReadonly) File "C:\Users\Max\Anaconda3\envs\tensorflow\lib\shutil.py", line 494, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Users\Max\Anaconda3\envs\tensorflow\lib\shutil.py", line 384, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File "C:\Users\Max\Anaconda3\envs\tensorflow\lib\shutil.py", line 393, in _rmtree_unsafe onerror(os.rmdir, path, sys.exc_info()) File "C:\Users\Max\Anaconda3\envs\tensorflow\lib\shutil.py", line 391, in _rmtree_unsafe os.rmdir(path) OSError: [WinError 145] The directory is not empty: 'F:\projects\seq2seq_raplyrics\g2p-seq2seq\tests\models\train\eval'
Ran 3 tests in 33.835s
FAILED (errors=1) Test failed: <unittest.runner.TextTestResult run=3 errors=1 failures=0> error: Test failed: <unittest.runner.TextTestResult run=3 errors=1 failures=0>
This seems to be a problem with windows and shutil.rmtree. \models\train\eval is set to read-only and we get this error because of it. chmod has limited uses in windows, so you might have to use pywin32. Haven't solved it yet. Also, this should perhaps be a new issue, as we're now several errors down the line.
Okie dokie I actually got it! I had to change line 35 from "shutil.rmtree(model_dir)" to "shutil.rmtree(model_dir, ignore_errors=True)" and it worked. It deletes everything in the "train" folder except for the eval folder. That's the intended behavior, right?
which of programs you mean to change shutil.rmtree(model_dir)??? you said line 35 of it.
g2p_unittest.py. Look here: "Traceback (most recent call last): File "f:\projects\seq2seq_raplyrics\g2p-seq2seq\tests\g2p_unittest.py", line 35, in test_train shutil.rmtree(model_dir, ignore_errors=False, onerror=handleRemoveReadonly)"
Your current line 35 will most likely just be "shutil.rmtree(model_dir)" as that extra stuff was something I tried that didn't work. So flag ignore_errors=True and well.... the errors will be ignored lol
Thanks a lot! I,ve solved my errors too. The solution of error (NameError: name 'unicode' is not defined) is to change unicode in g2p_encoder.py with bytes. The solution of error (NameError: name 'xrange' is not defined) is to change xrange in g2p_encoder.py with range. and the last solution and error has been explained above.
I have another question. How do you use g2p_seq2seq in windows??? because in it's website (https://github.com/cmusphinx/g2p-seq2seq) is not any code for windows. thanks in advance.
You can run most of the commands from the anaconda command line, which is what I've been doing. I've finally got it to pass the test, but interactive mode booted and failed when I typed in 'test.' I'm probably gonna start a new issue for it.
could you say how do you use this code (g2p-seq2seq --interactive --model model_folder_path) in anaconda command line, please?
replace 'model_folder_path' with the name of the saved model