Mandarin audio.zip Above is my result.(the wave means “Thanks for BiaoBei, Thanks for the author’s work , thanks for community” in Mandarin) Now i want to deploy my model, so i saved model in pb format, but when i restoring pb model, I have encountered many problems. I stuck in these problem for two days.
here is restore code: if set mel and linear None, enqueue would throw error:
Traceback (most recent call last):
File "TTSPythonWrap2.py", line 81, in <module>
sess.run(enqueue, feed_dict=feed_dict)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1111, in _run
str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape () for Tensor 'linear_targets:0', which has shape '(?, ?, 1025)'
if i set mel and linear an zero ndarray with shape [1,1,80], [1,1,1025], it seems “is_training” will be set True and throw error :
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
return fn(*args)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 0 of dimension 1 out of bounds.
[[Node: prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=5, ellipsis_mask=0, end_mask=5, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/device:GPU:0"](prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/Enter, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack_1, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack_2)]]
[[Node: prefix/model/inference/encoder_cbhg/bidirectional_rnn/bw/bw/stack/_209 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_1776_prefix/model/inference/encoder_cbhg/bidirectional_rnn/bw/bw/stack", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "TTSPythonWrap2.py", line 86, in <module>
wav = sess.run(output)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 0 of dimension 1 out of bounds.
[[Node: prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=5, ellipsis_mask=0, end_mask=5, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/device:GPU:0"](prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/Enter, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack_1, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack_2)]]
[[Node: prefix/model/inference/encoder_cbhg/bidirectional_rnn/bw/bw/stack/_209 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_1776_prefix/model/inference/encoder_cbhg/bidirectional_rnn/bw/bw/stack", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Caused by op 'prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice', defined at:
File "TTSPythonWrap2.py", line 44, in <module>
name='prefix'
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
return func(*args, **kwargs)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 442, in import_graph_def
_ProcessNewOps(graph)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 234, in _ProcessNewOps
for new_op in graph._add_new_tf_operations(compute_devices=False): # pylint: disable=protected-access
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3563, in _add_new_tf_operations
for c_op in c_api_util.new_tf_operations(self)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3563, in <listcomp>
for c_op in c_api_util.new_tf_operations(self)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3450, in _create_op_from_tf_operation
ret = Operation(c_op, self)
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1740, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): slice index 0 of dimension 1 out of bounds.
[[Node: prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=5, ellipsis_mask=0, end_mask=5, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/device:GPU:0"](prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/Enter, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack_1, prefix/model/inference/decoder/while/BasicDecoderStep/TacoTrainingHelper/strided_slice/stack_2)]]
[[Node: prefix/model/inference/encoder_cbhg/bidirectional_rnn/bw/bw/stack/_209 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_1776_prefix/model/inference/encoder_cbhg/bidirectional_rnn/bw/bw/stack", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
restoring code:
from load import load_graph, load_graph_map
import tensorflow as tf
import numpy as np
from text import text_to_sequence
from util import audio
sentences = [
"sil x ia4 v3 t ian1 l iou2 k e4 sp1 t ian1 l iou2 uo3 b u4 l iou2 sil"
]
fix_model_pb = '/home/sxdz/workspace/PycharmProj/tacotron-phone/frozen_model/tacotron-1.pb'
in_out_ops = ['datafeeder/inputs:0', 'datafeeder/input_lengths:0', 'model/stats/linear_outputs:0']
def debug_shape(t):
print(t.get_shape().as_list())
with tf.Session() as sess:
# tf.global_variables_initializer().run()
# tf.local_variables_initializer().run()
x = tf.placeholder(tf.int32, [None, None])
x_len = tf.placeholder(tf.int32, [None])
mel_t = tf.placeholder(tf.float32, [None, None, 80], 'mel_targets'),
linear_t = tf.placeholder(tf.float32, [None, None, 1025], 'linear_targets')
input_map = {
'datafeeder/inputs:0': x,
'datafeeder/input_lengths:0': x_len,
'datafeeder/mel_targets:0': mel_t,
'datafeeder/linear_targets:0': linear_t
}
with tf.gfile.FastGFile(fix_model_pb, 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
sess.graph.as_default()
tf.import_graph_def(
graph_def,
input_map=input_map,
name='prefix'
)
# x = tf.get_default_graph().get_tensor_by_name('datafeeder/inputs:0')
# x_len = tf.get_default_graph().get_tensor_by_name('datafeeder/input_lengths:0')
# mel_t = tf.get_default_graph().get_tensor_by_name('datafeeder/mel_targets:0')
# linear_tt = tf.get_default_graph().get_tensor_by_name('datafeeder/linear_targets:0')
queue = tf.get_default_graph().get_operation_by_name('prefix/datafeeder/input_queue')
enqueue = tf.get_default_graph().get_operation_by_name('prefix/datafeeder/input_queue_enqueue')
dequeue = tf.get_default_graph().get_operation_by_name('prefix/datafeeder/input_queue_Dequeue')
output = tf.get_default_graph().get_tensor_by_name('prefix/model/inference/dense/BiasAdd:0')
cleaner_names = [x.strip() for x in ['transliteration_cleaners']]
seq = text_to_sequence(sentences[0], cleaner_names)
# # print(seq)
x_mel = np.zeros((80,), dtype=np.float32).reshape((1, 1, 80))
x_linear = np.zeros((1025,), dtype=np.float32).reshape((1, 1, 1025))
feed_dict = {
x: [np.asarray(seq, dtype=np.int32)],
x_len: np.asarray([len(seq)], dtype=np.int32),
**linear_t: x_linear,
mel_t: x_mel,**
}
sess.run(queue)
sess.run(enqueue, feed_dict=feed_dict)
# sess.run(dequeue)
wav = sess.run(output)
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
Deploy Definition & Meaning - Merriam-Webster
The meaning of DEPLOY is to extend (a military unit) especially in width. How to use deploy in a sentence.
Read more >DEPLOY | definition in the Cambridge English Dictionary
deploy meaning: 1. to use something or someone, especially in an effective way: 2. to move soldiers or equipment…. Learn more.
Read more >Deploy Definition & Meaning - Dictionary.com
to arrange in a position of readiness, or to move strategically or appropriately: to deploy a battery of new missiles. verb (used without...
Read more >deploy - Wiktionary
(transitive, ergative) To prepare and arrange (usually military unit or units) for use. quotations ▽ · (transitive, intransitive) To unfold, open, or otherwise ......
Read more >Deploy definition and meaning | Collins English Dictionary
1. Military. to spread out (troops) so as to form an extended front or line · 2. to arrange in a position of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can dump the graph def after loading it in synthesizer.py class by adding a extra line at the end of load function:
tf.train.write_graph(self.session.graph.as_graph_def(), "models/", "graph.pb", as_text=True)
Then execute the tensorflow’s freeze_graph program to freeze it:
$python freeze_graph.py --input_graph models/graph.pb --input_checkpoint logs-tacotron/model.ckpt-21000 --output_graph logs-tacotron/freezed.pb --output_node_names model/griffinlim/Squeeze
Hi, I made a class similar to synthesizer class with just few changes to run on the Deployment ready graph. This should work for you. This model has FIFO QUEUE for training only.