Closed bhaveshshrimali closed 2 years ago
Just to add that the above traceback is the same irrespective of whether I run on my local machine or on colab. On my local machine I am running it inside a container built on top of the tensorflow docker image -- with the master branch of deeponet
cloned
Thanks in advance. Let me know if you need anymore info!
So if I set the default float to float64
, i.e.
dde.config.set_default_float("float64")
I now get a slightly different traceback (still the same error albeit at a different place)
Traceback (most recent call last):
File "testODE.py", line 143, in <module>
main()
File "testODE.py", line 140, in main
run(problem, system, space, T, m, nn, net, lr, epochs, num_train, num_test)
File "testODE.py", line 76, in run
losshistory, train_state = model.train(epochs=epochs, callbacks=[checker])
File "/usr/local/lib/python3.6/dist-packages/deepxde/utils/internal.py", line 26, in wrapper
result = f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/deepxde/model.py", line 353, in train
self._test()
File "/usr/local/lib/python3.6/dist-packages/deepxde/model.py", line 489, in _test
self.train_state.train_aux_vars,
File "/usr/local/lib/python3.6/dist-packages/deepxde/model.py", line 284, in _outputs_losses
outs = self.outputs_losses(training, inputs, targets, auxiliary_vars)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 885, in __call__
result = self._call(*args, **kwds)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 933, in _call
self._initialize(args, kwds, add_initializers_to=initializers)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 760, in _initialize
*args, **kwds))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 3066, in _get_concrete_function_internal_garbage_collected
graph_function, _ = self._maybe_define_function(args, kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 3463, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 3308, in _create_graph_function
capture_by_value=self._capture_by_value),
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py", line 1007, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 668, in wrapped_fn
out = weak_wrapped_fn().__wrapped__(*args, **kwds)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py", line 994, in wrapper
raise e.ag_error_metadata.to_exception(e)
TypeError: in user code:
/usr/local/lib/python3.6/dist-packages/deepxde/model.py:167 outputs_losses *
outputs_ = self.net(inputs, training=training)
/usr/local/lib/python3.6/dist-packages/deepxde/nn/tensorflow/deeponet.py:67 call *
x += self.b
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1383 binary_op_wrapper
raise e
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1367 binary_op_wrapper
return func(x, y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/dispatch.py:206 wrapper
return target(*args, **kwargs)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1700 _add_dispatch
return gen_math_ops.add_v2(x, y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_math_ops.py:465 add_v2
"AddV2", x=x, y=y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:558 _apply_op_helper
inferred_from[input_arg.type_attr]))
TypeError: Input 'y' of 'AddV2' Op has type float32 that does not match type float64 of argument 'x'.
So I tried explicitly declaring the type here https://github.com/lululxvi/deepxde/blob/8d417288ad97de074b9645ab29221c0eea4743b9/deepxde/nn/tensorflow/deeponet.py#L48
namely, changing the line to
self.b = tf.Variable(tf.zeros(1, dtype=tf.dtypes.float32))
Doing everything on float64
results in OOM error. (I'm not sure why though, my system does seem to have sufficient memory). Nonetheless, let's see how it progresses.
Could you try version 0.11.2?
Could you try version 0.11.2?
Thanks, will try it and report here. Note that I trimmed the problem size and after all the above twitches (a couple more of those tf.cast(...)
operations), things do seem to run at least. Will report things with 0.11.2
nontheless.
Thanks!
Hi @lululxvi , Thanks for putting together
deepxde
. I was trying to get started withODESystem
but noticed a couple of things that are off. First off, here is my version info:Now if I try to run the gravity pendulum ODE, I get a weird type mismatch error:
Here is the piece of code that I am trying to run (I cloned and manually appended the path to the git repo to directly import some of the submodules)
Taking a look briefly at the exports in deepxde.nn.tensorflow I think that the
Installation Guide
should point toDeepONetCartesianProd
and notDeepONet
, right? Or am I missing anything? Now even if I make that change, the code is not runnable as is. Do you have any inputs?I will keep exploring the library, but it'd be great if you could clarify a bit on how to make the above snippet runnable.
Thanks!