Open JianfengNing opened 2 years ago
What backend did you use?
@lululxvi I use Tensorflow 2.3.4, this gives the same error? How can I correct it? Thank you
What backend did you use?
I'm having a similar issue. Backend: tensorflow.compat.v1 Please see below the full anonymized log. Please note that TensorFlow is installed by: pip3 install --user --upgrade tensorflow_gpu
Thanks!
...% DDEBACKEND=tensorflow.compat.v1 python3 deeponet_pde.py Using backend: tensorflow.compat.v1
WARNING:tensorflow:From /[HOME-PATH]/.local/lib/python3.6/site-packages/tensorflow/python/compat/v2_compat.py:101: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version. Instructions for updating: non-resource variables are not supported in the long term WARNING:tensorflow:From /[HOME-PATH]/.local/lib/python3.6/site-packages/deepxde/nn/initializers.py:116: The name tf.keras.initializers.he_normal is deprecated. Please use tf.compat.v1.keras.initializers.he_normal instead.
Generating operator data... 'gen_operator_data' took 1.471246 s
Generating operator data... 'gen_operator_data' took 1.306810 s
Compiling model...
Building DeepONet...
/[HOME-PATH]/.local/lib/python3.6/site-packages/keras/legacy_tf_layers/core.py:236: UserWarning: tf.layers.dense
is deprecated and will be removed in a future version. Please use tf.keras.layers.Dense
instead.
warnings.warn('tf.layers.dense
is deprecated and '
/[HOME-PATH]/.local/lib/python3.6/site-packages/keras/engine/base_layer_v1.py:1676: UserWarning: layer.apply
is deprecated and will be removed in a future version. Please use layer.__call__
method instead.
warnings.warn('layer.apply
is deprecated and '
'build' took 0.124214 s
2022-01-28 13:40:35.658490: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-01-28 13:40:37.683726: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:39] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0. 2022-01-28 13:40:37.683957: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 10793 MB memory: -> device: 0, name: Tesla K40m, pci bus id: 0000:02:00.0, compute capability: 3.5 'compile' took 4.943070 s
Initializing variables... Training model...
Step Train loss Test loss Test metric
0 [1.60e-01] [1.95e-01] [1.63e-01]
50 [1.05e-02] [2.28e-02] [2.15e-02]
Best model at step 50: train loss: 1.05e-02 test loss: 2.28e-02 test metric: [2.15e-02]
'train' took 5.478015 s
Traceback (most recent call last):
File "deeponet_pde.py", line 285, in
Following [1], it seems that changing tf.trainable_variables() to tf.compat.v1.trainable_variables() would work. Now, getting "ValueError: The passed save_path is not a valid checkpoint: model/model.ckpt-43000" error in saver.py but that should not be related to tf.compat.v1.trainable_variables().
Do you have the file "model.ckpt-43000" in the folder "model"?
@udemirezen @cfd-ai Note the code here requires DeepXDE v0.11.2, see https://github.com/lululxvi/deeponet#installation-guide New version of DeepXDE may require some modification of the code.
We will release the DeepONet code for the new DeepXDE version soon. Check https://arxiv.org/abs/2111.05512 later
deeponet_pde.py, line 173, change print("# Parameters:", np.sum([np.prod(v.get_shape().as_list()) for v in tf.trainable_variables()])) to print("# Parameters:", np.sum([np.prod(v.get_shape().as_list()) for v in tf.compat.v1.trainable_variables()]))
The problem can be solved.
Traceback (most recent call last): File "D:/Desktop/Codes/deeponet-master/deeponet-master/src/deeponet_pde.py", line 285, in
main()
File "D:/Desktop/Codes/deeponet-master/deeponet-master/src/deeponet_pde.py", line 281, in main
run(problem, system, space, T, m, nn, net, lr, epochs, num_train, num_test)
File "D:/Desktop/Codes/deeponet-master/deeponet-master/src/deeponet_pde.py", line 173, in run
print("# Parameters:", np.sum([np.prod(v.get_shape().as_list()) for v in tf.trainable_variables()]))
AttributeError: module 'tensorflow' has no attribute 'trainable_variables'
how to solve this error?