Giter Site home page Giter Site logo

Comments (3)

Goooaaal avatar Goooaaal commented on July 29, 2024

Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1322, in _do_call
return fn(*args)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [20000,256] rhs shape= [50000,256]
[[Node: save/Assign_14 = Assign[T=DT_FLOAT, _class=["loc:@embedding_attention_seq2seq/embedding_attention_decoder/embedding"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](embedding_attention_seq2seq/embedding_attention_decoder/embedding, save/RestoreV2:14)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/cb/app.py", line 76, in
sess, model, enc_vocab, rev_dec_vocab = execute.init_session(sess, conf='seq2seq_serve.ini')
File "C:\Users\Administrator\Desktop\cb\execute.py", line 214, in init_session
model = create_model(sess, True)
File "C:\Users\Administrator\Desktop\cb\execute.py", line 104, in create_model
model.saver.restore(session, ckpt.model_checkpoint_path)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 1752, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "C:\ProgramData\Anaconda3\lib\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: Assign requires shapes of both tensors to match. lhs shape= [20000,256] rhs shape= [50000,256]
[[Node: save/Assign_14 = Assign[T=DT_FLOAT, _class=["loc:@embedding_attention_seq2seq/embedding_attention_decoder/embedding"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](embedding_attention_seq2seq/embedding_attention_decoder/embedding, save/RestoreV2:14)]]

  Caused by op 'save/Assign_14', defined at:

File "C:/Users/Administrator/Desktop/cb/app.py", line 76, in
sess, model, enc_vocab, rev_dec_vocab = execute.init_session(sess, conf='seq2seq_serve.ini')
File "C:\Users\Administrator\Desktop\cb\execute.py", line 214, in init_session
model = create_model(sess, True)
File "C:\Users\Administrator\Desktop\cb\execute.py", line 94, in create_model
model = seq2seq_model.Seq2SeqModel( gConfig['enc_vocab_size'], gConfig['dec_vocab_size'], _buckets, gConfig['layer_size'], gConfig['num_layers'], gConfig['max_gradient_norm'], gConfig['batch_size'], gConfig['learning_rate'], gConfig['learning_rate_decay_factor'], forward_only=forward_only)
File "C:\Users\Administrator\Desktop\cb\seq2seq_model.py", line 168, in init
self.saver = tf.train.Saver(tf.all_variables())
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 1284, in init
self.build()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 1296, in build
self._build(self._filename, build_save=True, build_restore=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 1333, in _build
build_save=build_save, build_restore=build_restore)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 781, in _build_internal
restore_sequentially, reshape)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 422, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 113, in restore
self.op.get_shape().is_fully_defined())
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\state_ops.py", line 219, in assign
validate_shape=validate_shape)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 59, in assign
use_locking=use_locking, name=name)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "C:\ProgramData\Anaconda3\lib\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): Assign requires shapes of both tensors to match. lhs shape= [20000,256] rhs shape= [50000,256]
[[Node: save/Assign_14 = Assign[T=DT_FLOAT, _class=["loc:@embedding_attention_seq2seq/embedding_attention_decoder/embedding"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](embedding_attention_seq2seq/embedding_attention_decoder/embedding, save/RestoreV2:14)]]
作者说的直接更改字典大小应该是不可以的。如果不改变seq2seq.ini 的enc_vocab_size和dec_vaocab_size,仍然按照预定值20000使用,不会报错。 请问如何解决?

from chatbot.

zhaoyingjun avatar zhaoyingjun commented on July 29, 2024

shape= [20000,256] rhs shape= [50000,256] 你修改了字典 要把之前的Model给删除了,要不然之前是按照[20000,256] Tensor当然会报错

from chatbot.

Goooaaal avatar Goooaaal commented on July 29, 2024

不好意思 我没明白您的意思,是说要把working_dir里的文件删除吗 我是第一次运行此代码 working_dir下所有文件都是删除的 我运行的自己的代码和数据 之前应该没有model

from chatbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.