cmusphinx / g2p-seq2seq

G2P with Tensorflow
Other
670 stars 194 forks source link

Train a new g2p-seq2seq model #106

Closed cbsandeep10 closed 6 years ago

cbsandeep10 commented 6 years ago

I am trying to train a model on a english dictionary from cmusphinx. g2p-seq2seq --train cmudict.0.7a --model-dir en-in-model

python --version : 2.7 pip --version : 8.1.1 tensorflow-gpu --version : 1.4.0 cuda --verison : 8.0

I get the following error : Traceback (most recent call last): File "/usr/local/bin/g2p-seq2seq", line 9, in load_entry_point('g2p-seq2seq==6.0.0a0', 'console_scripts', 'g2p-seq2seq')() File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 542, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2569, in load_entry_point return ep.load() File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2229, in load return self.resolve() File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2235, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "/usr/local/lib/python2.7/dist-packages/g2p_seq2seq-6.0.0a0-py2.7.egg/g2p_seq2seq/init.py", line 24, in from g2p_seq2seq import app File "/usr/local/lib/python2.7/dist-packages/g2p_seq2seq-6.0.0a0-py2.7.egg/g2p_seq2seq/app.py", line 72, in tf.flags.DEFINE_integer("eval_steps", 10, "Number of steps for evaluation.") File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/flags.py", line 112, in DEFINE_integer _define_helper(flag_name, default_value, docstring, int) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/flags.py", line 86, in _define_helper type=flagtype) File "/usr/lib/python2.7/argparse.py", line 1308, in add_argument return self._add_action(action) File "/usr/lib/python2.7/argparse.py", line 1682, in _add_action self._optionals._add_action(action) File "/usr/lib/python2.7/argparse.py", line 1509, in _add_action action = super(_ArgumentGroup, self)._add_action(action) File "/usr/lib/python2.7/argparse.py", line 1322, in _add_action self._check_conflict(action) File "/usr/lib/python2.7/argparse.py", line 1460, in _check_conflict conflict_handler(action, confl_optionals) File "/usr/lib/python2.7/argparse.py", line 1467, in _handle_conflict_error raise ArgumentError(action, message % conflict_string) argparse.ArgumentError: argument --eval_steps: conflicting option string(s): --eval_steps

nurtas-m commented 6 years ago

Hello, @cbsandeep10 !

What version of tensor2tensor did you install?

g2p-seq2seq --train cmudict.0.7a --model-dir en-in-model

And, may be it's a typo, but the flag "--model_dir" should be with underscore and not with hyphen.

cocoakeith commented 6 years ago

Hello I am trying to train new model on an English dictionary from cmusphinx too, and get another error Traceback (most recent call last): File "/usr/local/bin/g2p-seq2seq", line 11, in load_entry_point('g2p-seq2seq==6.0.0a0', 'console_scripts', 'g2p-seq2seq')() File "/usr/local/lib/python2.7/dist-packages/g2p_seq2seq-6.0.0a0-py2.7.egg/g2p_seq2seq/app.py", line 114, in main g2p_model.train() File "/usr/local/lib/python2.7/dist-packages/g2p_seq2seq-6.0.0a0-py2.7.egg/g2p_seq2seq/g2p.py", line 230, in train dev_preprocess_file_path=self.dev_preprocess_file_path) File "/usr/local/lib/python2.7/dist-packages/g2p_seq2seq-6.0.0a0-py2.7.egg/g2p_seq2seq/g2p_trainer_utils.py", line 219, in run hparams=hparams) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 250, in new_func return func(*args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 225, in run return _execute_schedule(experiment, schedule) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 52, in _execute_schedule return task() File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 666, in train_and_evaluate self.train(delay_secs=0) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 389, in train saving_listeners=self._saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 876, in _call_train saving_listeners=saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 355, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 821, in _train_model input_fn, model_fn_lib.ModeKeys.TRAIN)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 680, in _get_features_and_labels_from_input_fn result = self._call_input_fn(input_fn, mode) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 772, in _call_input_fn return input_fn(kwargs) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/input_fn_builder.py", line 105, in inputfn name="problem%d" % problem_idx) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/input_fn_builder.py", line 236, in features_for_problem shard=shard) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/data_reader.py", line 108, in input_pipeline shard=shard) File "/usr/local/lib/python2.7/dist-packages/g2p_seq2seq-6.0.0a0-py2.7.egg/g2p_seq2seq/g2p_problem.py", line 223, in dataset assert data_dir AssertionError

cocoakeith commented 6 years ago

Hi, @cbsandeep10 I met the same problem as you,I think you need to update the version of your tensor2tensor. BTW, @nurtas-m ,I guess this "AssertionError" is a bug, the "data_dir" is defined in params.py, and the value of it is the current path (self.data_dir = os.path.dirname(data_path)). It means data_dir="", when the program is executed to "assert data_dir", it throws AssertionError.

nshmyrev commented 6 years ago

@nurtas-m waiting for your reply here

cbsandeep10 commented 6 years ago

Forgive me for the late reply. I was able to train and decode successfully upon reinstalling tensorflow.

Thank you so much.

nishant260190 commented 6 years ago

assert data_dir AssertionError

I got the above mentioned assertion error and it is resolved by putting dict file in a folder as told here https://github.com/cmusphinx/g2p-seq2seq/issues/119#issuecomment-387062957