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

[BUG] model load, then fit (re-train), error of layer_crf #244

Closed
CoSeCant-csc opened this issue Sep 20, 2019 · 1 comment
Closed

[BUG] model load, then fit (re-train), error of layer_crf #244

CoSeCant-csc opened this issue Sep 20, 2019 · 1 comment
Assignees
Labels
bug
Milestone

Comments

@CoSeCant-csc
Copy link

@CoSeCant-csc CoSeCant-csc commented Sep 20, 2019

You must follow the issue template and provide as much information as possible. otherwise, this issue will be closed.
请按照 issue 模板要求填写信息。如果没有按照 issue 模板填写,将会忽略并关闭这个 issue

Check List

Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.

You can post pictures, but if specific text or code is required to reproduce the issue, please provide the text in a plain text format for easy copy/paste.

Environment

  • OS [e.g. Mac OS, Linux]: Linux, Ubuntu 18.04
  • Python Version: 3.6
  • requirements.txt: tf-gpu==1.14.0
[Paste requirements.txt file here]

Issue Description

What

Hi, I have trained a model (BiLSTM_CRF_Model).
But when reload the mode, and do re-train, there is an error like this
Does anyone have ideas
Thx.

model = kashgari.utils.load_model(READ_MODEL_PATH)
model.compile_model(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit_without_generator(train_x, train_y,
          x_validate=dev_x,
          y_validate=dev_y,
          epochs=2,
          batch_size=64)

File "/home/userroot/.local/lib/python3.6/site-packages/kashgari/tasks/base_model.py", line 345, in fit_without_generator
**fit_kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 780, in fit
steps_name='steps_per_epoch')
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training_arrays.py", line 157, in model_iteration
f = _make_execution_function(model, mode)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training_arrays.py", line 532, in _make_execution_function
return model._make_execution_function(mode)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 2276, in _make_execution_function
self._make_train_function()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 2219, in _make_train_function
params=self._collected_trainable_weights, loss=self.total_loss)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 491, in get_updates
grads = self.get_gradients(loss, params)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 398, in get_gradients
"K.argmax, K.round, K.eval.".format(param))

ValueError: Variable <tf.Variable 'layer_crf/transitions:0' shape=(6, 6) dtype=float32> has None for gradient. Please make sure that all of your ops have a gradient defined (i.e. are differentiable). Common ops without gradient: K.argmax, K.round, K.eval.

Reproduce

[The steps to reproduce this issue. What is the URL you were trying to play, where did you put your code, etc.]

Other Comment

[Add anything else here]

@CoSeCant-csc CoSeCant-csc added the bug label Sep 20, 2019
@BrikerMan BrikerMan added this to the v0.5.4 milestone Sep 20, 2019
@BrikerMan

This comment has been minimized.

Copy link
Owner

@BrikerMan BrikerMan commented Sep 20, 2019

This is a confirmed bug, will fix in 0.5.4 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.