cmusphinx / g2p-seq2seq

G2P with Tensorflow
Other
669 stars 195 forks source link

Error in training seq2seq model in anaconda environment #136

Closed ellurunaresh closed 6 years ago

ellurunaresh commented 6 years ago

Hi, I was running g2p-seq2seq model with the latest recipe. I have installed the following packages. I didn't find any error during installation. pip install tensorflow==1.5.0 pip install tensor2tensor[tensorflow] tensor2tensor version=1.6.3 python version=3.6

While training the model in anaconda environment I got the below error. Please let me know if anybody knows how to handle this problem?

D:\work\g2p-seq2seq-master>C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\Scripts\g2p-seq2seq.exe --train train.txt --model_dir exp_train_model C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\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 INFO:tensorflow:Importing user module g2p_seq2seq from path C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\g2p_seq2seq-6.2.0a0-py3.6.egg INFO:tensorflow:Overriding hparams in transformer_base with eval_drop_long_sequences=1,batch_size=4096,num_hidden_layers=3,hidden_size=256,filter_size=512,num_heads=4,length_bucket_step=1.5,max_length=30,min_length_bucket=6 INFO:tensorflow:schedule=train_and_evaluate INFO:tensorflow:worker_gpu=1 INFO:tensorflow:sync=False WARNING:tensorflow:Schedule=train_and_evaluate. Assuming that training is running on a single machine. INFO:tensorflow:datashard_devices: ['gpu:0'] INFO:tensorflow:caching_devices: None INFO:tensorflow:ps_devices: ['gpu:0'] INFO:tensorflow:Using config: {'_task_type': None, '_task_id': 0, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x00000286963AECF8>, '_master': '', '_num_ps_replicas': 0, '_num_worker_replicas': 0, '_environment': 'local', '_is_chief': True, '_evaluation_master': '', '_tf_config': gpu_options { per_process_gpu_memory_fraction: 1.0 } , '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_secs': None, '_log_step_count_steps': 100, '_session_config': gpu_options { per_process_gpu_memory_fraction: 0.95 } allow_soft_placement: true graph_options { optimizer_options { } } , '_save_checkpoints_steps': 2000, '_keep_checkpoint_max': 1, '_keep_checkpoint_every_n_hours': 1, '_model_dir': 'tmp_model1', 'use_tpu': False, 't2t_device_info': {'num_async_replicas': 1}, 'data_parallelism': <tensor2tensor.utils.expert_utils.Parallelism object at 0x00000286963AEDD8>} WARNING:tensorflow:Estimator's model_fn (<function T2TModel.make_estimator_model_fn..wrapping_model_fn at 0x00000286FD106510>) includes params argument, but params are not passed to Estimator. INFO:tensorflow:Using ValidationMonitor WARNING:tensorflow:From C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\monitors.py:267: BaseMonitor.init__ (from tensorflow.contrib.learn.python.learn.monitors) is deprecated and will be removed after 2016-12-05. Instructions for updating: Monitors are deprecated. Please use tf.train.SessionRunHook. INFO:tensorflow:Using config: {'_task_type': None, '_task_id': 0, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x00000286963AECF8>, '_master': '', '_num_ps_replicas': 0, '_num_worker_replicas': 0, '_environment': 'local', '_is_chief': True, '_evaluation_master': '', '_tf_config': gpu_options { per_process_gpu_memory_fraction: 1.0 } , '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_secs': None, '_log_step_count_steps': 100, '_session_config': gpu_options { per_process_gpu_memory_fraction: 0.95 } allow_soft_placement: true graph_options { optimizer_options { } } , '_save_checkpoints_steps': 2000, '_keep_checkpoint_max': 1, '_keep_checkpoint_every_n_hours': 1, '_model_dir': 'tmp_model1', 'use_tpu': False, 't2t_device_info': {'num_async_replicas': 1}, 'data_parallelism': <tensor2tensor.utils.expert_utils.Parallelism object at 0x00000286963AEDD8>} WARNING:tensorflow:Estimator's model_fn (<function T2TModel.make_estimator_model_fn..wrapping_model_fn at 0x000002869650BB70>) includes params argument, but params are not passed to Estimator. INFO:tensorflow:Reading data files from tmp_model1\train.preprocessed INFO:tensorflow:Setting T2TModel mode to 'train' INFO:tensorflow:Using variable initializer: uniform_unit_scaling WARNING:tensorflow:Without a Problem, T2TModel.bottom is a passthrough. INFO:tensorflow:Building model body Traceback (most recent call last): File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 510, in _apply_op_helper preferred_dtype=default_dtype) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1022, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\constant_op.py", line 233, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\constant_op.py", line 212, in constant value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 413, in make_tensor_proto _AssertCompatible(values, dtype) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 328, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got 0.0 of type 'float' instead.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\Scripts\g2p-seq2seq-script.py", line 11, in load_entry_point('g2p-seq2seq==6.2.0a0', 'console_scripts', 'g2p-seq2seq')() File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\g2p_seq2seq-6.2.0a0-py3.6.egg\g2p_seq2seq\app.py", line 108, in main g2p_model.train() File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\g2p_seq2seq-6.2.0a0-py3.6.egg\g2p_seq2seq\g2p.py", line 255, in train execute_schedule(self.exp, self.params) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\g2p_seq2seq-6.2.0a0-py3.6.egg\g2p_seq2seq\g2p.py", line 587, in execute_schedule getattr(exp, params.schedule)() File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\experiment.py", line 661, in train_and_evaluate self.train(delay_secs=0) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\experiment.py", line 390, in train saving_listeners=self._saving_listeners) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\experiment.py", line 868, in _call_train saving_listeners=saving_listeners) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 314, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 743, in _train_model features, labels, model_fn_lib.ModeKeys.TRAIN, self.config) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 725, in _call_model_fn model_fn_results = self._model_fn(features=features, kwargs) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\utils\t2t_model.py", line 950, in wrapping_model_fn use_tpu=use_tpu) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\utils\t2t_model.py", line 1000, in estimator_model_fn logits, losses_dict = model(features) # pylint: disable=not-callable File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\layers\base.py", line 652, in call outputs = self.call(inputs, *args, *kwargs) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\utils\t2t_model.py", line 159, in call sharded_logits, losses = self.model_fn_sharded(sharded_features) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\utils\t2t_model.py", line 214, in model_fn_sharded sharded_logits, sharded_losses = dp(self.model_fn, datashard_to_features) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\utils\expert_utils.py", line 231, in call outputs.append(fns[i](my_args[i], my_kwargs[i])) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\utils\t2t_model.py", line 248, in model_fn body_out = self.body(transformed_features) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\models\transformer.py", line 163, in body inputs, target_space, hparams, features=features, losses=losses) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\models\transformer.py", line 75, in encode inputs, target_space, hparams, features=features)) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\models\transformer.py", line 700, in transformer_prepare_encoder encoder_padding = common_attention.embedding_to_padding(encoder_input) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\utils\expert_utils.py", line 58, in decorated return f(*args, kwargs) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensor2tensor\layers\common_attention.py", line 777, in embedding_to_padding return tf.to_float(tf.equal(emb_sum, 0.0)) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 1700, in equal "Equal", x=x, y=y, name=name) File "C:\Users\naresh.kumar\AppData\Local\Continuum\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 519, in _apply_op_helper repr(values), type(values).name)) TypeError: Expected int32 passed to parameter 'y' of op 'Equal', got 0.0 of type 'float' instead.**

nurtas-m commented 6 years ago

Hello, @ellurunaresh As I wrote earlier, g2p-seq2seq works with tensor2tensor=1.5.7. This error occurs with tensor2tensor higher than 1.5.7. Related to issue #114