Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行nlu_joint 出错 #96

Closed
gallupliu opened this issue Sep 11, 2019 · 1 comment
Closed

运行nlu_joint 出错 #96

gallupliu opened this issue Sep 11, 2019 · 1 comment
Assignees
Labels
Bug Something isn't working Delta

Comments

@gallupliu
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
    设置nlu_joint.yaml 中optimizer->multitask为True
  2. Click on '....'
    run main.py
  3. Scroll down to '....'
    [ 2019-09-11 20:43:19,674 INFO base_solver.py:239 11187 ] Using multi-task optimizer
    Traceback (most recent call last):
    File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/python/util/nest.py", line 297, in assert_same_structure
    expand_composites)
    ValueError: The two structures don't have the same nested structure.

First structure: type=Tensor str=Tensor("train/cond_1/zeros:0", shape=(), dtype=float32)

Second structure: type=IndexedSlices str=IndexedSlices(indices=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape_1:0", shape=(?,), dtype=int32), values=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape:0", shape=(?, 300), dtype=float32), dense_shape=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Const:0", shape=(2,), dtype=int32))

More specifically: Substructure "type=IndexedSlices str=IndexedSlices(indices=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape_1:0", shape=(?,), dtype=int32), values=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape:0", shape=(?, 300), dtype=float32), dense_shape=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Const:0", shape=(2,), dtype=int32))" is a sequence, while substructure "type=Tensor str=Tensor("train/cond_1/zeros:0", shape=(), dtype=float32)" is not

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2001, in cond
nest.assert_same_structure(orig_res_t, orig_res_f, expand_composites=True)
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/python/util/nest.py", line 304, in assert_same_structure
% (str(e), str1, str2))
ValueError: The two structures don't have the same nested structure.

First structure: type=Tensor str=Tensor("train/cond_1/zeros:0", shape=(), dtype=float32)

Second structure: type=IndexedSlices str=IndexedSlices(indices=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape_1:0", shape=(?,), dtype=int32), values=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape:0", shape=(?, 300), dtype=float32), dense_shape=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Const:0", shape=(2,), dtype=int32))

More specifically: Substructure "type=IndexedSlices str=IndexedSlices(indices=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape_1:0", shape=(?,), dtype=int32), values=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape:0", shape=(?, 300), dtype=float32), dense_shape=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Const:0", shape=(2,), dtype=int32))" is a sequence, while substructure "type=Tensor str=Tensor("train/cond_1/zeros:0", shape=(), dtype=float32)" is not
Entire first structure:
.
Entire second structure:
.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/gallup/study/nlp/photon/main.py", line 114, in
app.run(main)
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "/home/gallup/study/nlp/photon/main.py", line 82, in main
solver.train_and_eval()
File "/home/gallup/study/nlp/photon/utils/solver/raw_solver.py", line 420, in train_and_eval
global_step)
File "/home/gallup/study/nlp/photon/utils/solver/base_solver.py", line 339, in get_train_op
global_step)
File "/home/gallup/study/nlp/photon/utils/solver/base_solver.py", line 290, in get_apply_gradients_op
grads_and_vars = self.clip_gradients(grads_and_vars, global_norm, multitask)
File "/home/gallup/study/nlp/photon/utils/solver/base_solver.py", line 269, in clip_gradients
grads_and_vars, clip_ratio)
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/contrib/opt/python/training/multitask_optimizer_wrapper.py", line 139, in clip_gradients_by_global_norm
nonzero_gradients = [_replace_nonexisting_grad(g) for g in gradients]
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/contrib/opt/python/training/multitask_optimizer_wrapper.py", line 139, in
nonzero_gradients = [_replace_nonexisting_grad(g) for g in gradients]
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/contrib/opt/python/training/multitask_optimizer_wrapper.py", line 137, in _replace_nonexisting_grad
lambda: grad)
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/gallup/anaconda3/envs/delta-py3.6-tf1.14/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2007, in cond
"Incompatible return values of true_fn and false_fn: {}".format(e))
ValueError: Incompatible return values of true_fn and false_fn: The two structures don't have the same nested structure.

First structure: type=Tensor str=Tensor("train/cond_1/zeros:0", shape=(), dtype=float32)

Second structure: type=IndexedSlices str=IndexedSlices(indices=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape_1:0", shape=(?,), dtype=int32), values=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape:0", shape=(?, 300), dtype=float32), dense_shape=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Const:0", shape=(2,), dtype=int32))

More specifically: Substructure "type=IndexedSlices str=IndexedSlices(indices=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape_1:0", shape=(?,), dtype=int32), values=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Reshape:0", shape=(?, 300), dtype=float32), dense_shape=Tensor("train/gradients/joint_bilstm_crf_model/embedding/embedding_lookup_grad/Const:0", shape=(2,), dtype=int32))" is a sequence, while substructure "type=Tensor str=Tensor("train/cond_1/zeros:0", shape=(), dtype=float32)" is not
Entire first structure:
.
Entire second structure:
4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@zh794390558 zh794390558 added Bug Something isn't working Delta labels Sep 12, 2019
@zh794390558
Copy link
Collaborator

multitask 这个参数应该没有用,请不要使用。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Delta
Projects
None yet
Development

No branches or pull requests

3 participants