Comments (3)
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.
shape= [20000,256] rhs shape= [50000,256] 你修改了字典 要把之前的Model给删除了,要不然之前是按照[20000,256] Tensor当然会报错
from chatbot.
不好意思 我没明白您的意思,是说要把working_dir里的文件删除吗 我是第一次运行此代码 working_dir下所有文件都是删除的 我运行的自己的代码和数据 之前应该没有model
from chatbot.
Related Issues (20)
- 一直显示no module要怎么办? HOT 1
- execute.py 一直报错 HOT 3
- 关于微调和运行
- 报错问题
- 完成训练时候save 档案出现问题 HOT 1
- 数据问题
- 如果app.py放在web里面就无法运行,拿出来之后error calling function HOT 3
- 缺少'train_data/seq.data'文件,Tensowflow2.0的Seq2seq版本 HOT 2
- Pytorch版本:max_train_data_size设置为多少比较合理?
- 请问智能客服功能完善了吗?可以作为业务客服来使用吗?
- 请问如果用自己的数据进行微调的话,怎么解决模块加载时,形状不匹配的问题?
- 微信群二维码过期咯 HOT 2
- 提示error calling function怎么办的 HOT 2
- Chatbot Report
- 运行app.py时出现error calling function HOT 3
- 训练完提示形状不匹配啊
- 为什么会报错AttributeError: module 'execute' has no attribute 'predict'
- zip函数 not enough values to unpack (expected 2, got 0)
- Being used by scammers in the UK HOT 2
- ImportError: cannot import name 'dtensor'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatbot.