-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
layer.trainable example not working #3804
Comments
The docs do point out this behaviour:
Though we probably want to update the docs since the lines at the bottom imply the opposite:
I don't see a trivial solution for doing what you want, so I would suggest trying to avoid using this pattern and just setting the flag to be what you need before training the model. |
The docs are ok. The lines you point out mean that, since they share a layer, training the non-frozen model will also change the weights of the frozen one. But training the frozen one should not change anything. This feature used to work properly in the past. |
That's a good point; the thing is that |
Oh, I see. Great, thanks! |
I load a pre-trained model as a layer in another model. Everything is fine is I set the pre-trained model trainable=False. However, if I set it True, I got a hundred lines of errors. The last chunk is this: It seems something is missing in order to make the combined system trainable? |
I have the same problem while loading a pre-trained model checkpoint: [[Node: training/Adam/gradients/time_distributed_2/while_1/TensorArrayStack/TensorArrayGatherV3_grad/TensorArrayGrad/TensorArrayGradV3 = TensorArrayGradV3[_class=["loc:@time_distributed_2/while_1/TensorArray_2"], source="training/Adam/gradients", _device="/job:localhost/replica:0/task:0/device:CPU:0"](training/Adam/gradients/time_distributed_2/while_1/TensorArrayStack/TensorArrayGatherV3_grad/TensorArrayGrad/TensorArrayGradV3/StackPopV2, training/Adam/gradients/time_distributed_2/while_1/TensorArrayStack/TensorArrayGatherV3_grad/TensorArrayGrad/TensorArrayGradV3/StackPopV2_1)]] Could you fix it? |
Please make sure that the boxes below are checked before you submit your issue. Thank you!
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
The example in https://keras.io/getting-started/faq/#how-can-i-freeze-keras-layers does not work.
The example fails with both TF and theano.
Both models will do whatever you put in the second layer.trainable line.
Code to try:
The text was updated successfully, but these errors were encountered: