You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS Platform and Distribution (e.g., Linux Ubuntu 20.04):
TensorFlow version and how it was installed (source or binary):
TensorFlow-Addons version and how it was installed (source or binary):
Python version:
Is GPU used? (yes/no):
Describe the bug
Compiling model...
'compile' took 0.007720 s
Training model...
Step Train loss Test loss Test metric
0 [9.10e-03, 7.54e-03, 2.72e-02, 1.26e+00, 2.77e-01] [9.10e-03, 7.54e-03, 2.72e-02, 1.26e+00, 2.77e-01] []
Traceback (most recent call last):
File "E:\python\Paper_Programs\05_deepxde\examples\pinn_inverse\Navier_Stokes_inverse.py", line 124, in
loss_history, train_state = model.train(
File "E:\python\Paper_Programs\05_deepxde\deepxde\utils\internal.py", line 22, in wrapper
result = f(*args, **kwargs)
File "E:\python\Paper_Programs\05_deepxde\deepxde\model.py", line 650, in train
self.train_sgd(iterations, display_every)
File "E:\python\Paper_Programs\05_deepxde\deepxde\model.py", line 668, in train_sgd
self.train_step(
File "E:\python\Paper_Programs\05_deepxde\deepxde\model.py", line 560, in train_step
self.train_step(inputs, targets, auxiliary_vars)
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\86186\AppData\Local\Temp_autograph_generated_file66hkpahi.py", line 16, in tf__train_step
ag.converted_call(ag.ld(opt).apply_gradients, (ag_.converted_call(ag__.ld(zip), (ag__.ld(grads), ag__.ld(trainable_variables)), None, fscope),), None, fscope)
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 282, in apply_gradients
self.apply(grads, trainable_variables)
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 329, in apply
self._overwrite_variables_directly_with_gradients(
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 618, in _overwrite_variables_directly_with_gradients
if v.overwrite_with_gradient:
AttributeError: in user code:
File "E:\python\Paper_Programs\05_deepxde\deepxde\model.py", line 249, in train_step *
opt.apply_gradients(zip(grads, trainable_variables))
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 282, in apply_gradients **
self.apply(grads, trainable_variables)
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 329, in apply
self._overwrite_variables_directly_with_gradients(
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 618, in _overwrite_variables_directly_with_gradients
if v.overwrite_with_gradient:
AttributeError: 'ResourceVariable' object has no attribute 'overwrite_with_gradient'
Can anyone solve this problem?
The text was updated successfully, but these errors were encountered:
This code assumes the list of training variables are all either tf.Variable or a KerasVariable, it simply checks the first in the list to see if it has the overwrite_with_gradient attr, and if it does in then continues the method to iterate over them all calling that method....
I had mostly KerasVariables but I has added some custom tf.Variables at the end of the list... which causes the error.
As a workaround I simply put my tf.Variable at the beginning of the list as passed to optimizer.apply_gradients(), it then doesn't iterate the main loop using the overwrite_with_gradient optimization.... not sure of the side effects though, but so far so good!
System information
Describe the bug
Compiling model...
'compile' took 0.007720 s
Training model...
Step Train loss Test loss Test metric
0 [9.10e-03, 7.54e-03, 2.72e-02, 1.26e+00, 2.77e-01] [9.10e-03, 7.54e-03, 2.72e-02, 1.26e+00, 2.77e-01] []
Traceback (most recent call last):
File "E:\python\Paper_Programs\05_deepxde\examples\pinn_inverse\Navier_Stokes_inverse.py", line 124, in
loss_history, train_state = model.train(
File "E:\python\Paper_Programs\05_deepxde\deepxde\utils\internal.py", line 22, in wrapper
result = f(*args, **kwargs)
File "E:\python\Paper_Programs\05_deepxde\deepxde\model.py", line 650, in train
self.train_sgd(iterations, display_every)
File "E:\python\Paper_Programs\05_deepxde\deepxde\model.py", line 668, in train_sgd
self.train_step(
File "E:\python\Paper_Programs\05_deepxde\deepxde\model.py", line 560, in train_step
self.train_step(inputs, targets, auxiliary_vars)
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\86186\AppData\Local\Temp_autograph_generated_file66hkpahi.py", line 16, in tf__train_step
ag.converted_call(ag.ld(opt).apply_gradients, (ag_.converted_call(ag__.ld(zip), (ag__.ld(grads), ag__.ld(trainable_variables)), None, fscope),), None, fscope)
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 282, in apply_gradients
self.apply(grads, trainable_variables)
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 329, in apply
self._overwrite_variables_directly_with_gradients(
File "C:\Users\86186\anaconda\envs\05_deepxde\lib\site-packages\keras\src\optimizers\base_optimizer.py", line 618, in _overwrite_variables_directly_with_gradients
if v.overwrite_with_gradient:
AttributeError: in user code:
Can anyone solve this problem?
The text was updated successfully, but these errors were encountered: