tum-pbs / pbdl-book Goto Github PK
View Code? Open in Web Editor NEWWelcome to the Physics-based Deep Learning Book (v0.2)
Home Page: https://physicsbaseddeeplearning.org/
Welcome to the Physics-based Deep Learning Book (v0.2)
Home Page: https://physicsbaseddeeplearning.org/
My anaconda list is followed:
I copied the following code in page6:
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
# X-Data
N = 200
X = np.random.random(N)
# Generation Y-Data
sign = (- np.ones((N,)))**np.random.randint(2,size=N)
Y = np.sqrt(X) * sign
# Neural network
act = tf.keras.layers.ReLU()
nn_sv = tf.keras.models.Sequential([
tf.keras.layers.Dense(10, activation=act),
tf.keras.layers.Dense(10, activation=act),
tf.keras.layers.Dense(1,activation='linear')
])
# Loss function
loss_sv = tf.keras.losses.MeanSquaredError()
optimizer_sv = tf.keras.optimizers.Adam(learning_rate=0.001)
nn_sv.compile(optimizer=optimizer_sv, loss=loss_sv)
# Training
results_sv = nn_sv.fit(X, Y, epochs=5, batch_size= 5, verbose=1)
But when I runned the code and it runned to Epoch of 1/5:
# Training
results_sv = nn_sv.fit(X, Y, epochs=5, batch_size= 5, verbose=1)
The following quitions occured:
Output exceeds the [size limit]. Open the full output data [in a text editor]
ValueError Traceback (most recent call last)
d:\code\pyMyself\pinn\donw.ipynb Cell 8 in <cell line: 2>()
1 # Training
----> 2 results_sv = nn_sv.fit(X, Y, epochs=5, batch_size= 5, verbose=1)
File d:\Ana\Anaconda3\envs\deepdeS\lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 # tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File ~\AppData\Local\Temp_autograph_generated_filelji_gey6.py:15, in outer_factory..inner_factory..tf__train_function(iterator)
13 try:
14 do_return = True
---> 15 retval = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False
ValueError: in user code:
File "d:\Ana\Anaconda3\envs\deepdeS\lib\site-packages\keras\engine\training.py", line 1160, in train_function *
return step_function(self, iterator)
...
Call arguments received by layer "sequential_2" " f"(type Sequential):
• inputs=tf.Tensor(shape=(5,), dtype=float32)
• training=True
• mask=None
Could you please tell me what kind of step I did wrong?
Thank you very much!
hello,when i try to reproduce the result of the Reducing Numerical Errors with Deep Learning,i meet some problem that cant make the trainning runs well,the error saids:
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice
Traceback (most recent call last):
File "C:/Users/XXX/XXX/PBDL/NS/NS_DPNN_org.py", line 380, in
loss = training_step_jit(dens_gt, vel_gt, re_nr, math.tensor(steps))
File "E:\anaconda3\envs\PBDL\lib\site-packages\phi\math_functional.py", line 149, in call
native_result = self.traceskey
File "E:\anaconda3\envs\PBDL\lib\site-packages\phi\tf_tf_backend.py", line 106, in
return lambda *args: self.as_registered.call(compiled, *args, name=f"run jit-compiled '{f.name}'")
File "E:\anaconda3\envs\PBDL\lib\site-packages\phi\math\backend_backend.py", line 306, in call
return f(*args)
File "E:\anaconda3\envs\PBDL\lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "E:\anaconda3\envs\PBDL\lib\site-packages\tensorflow\python\eager\execute.py", line 55, in quick_execute
inputs, attrs, num_outputs)
tensorflow.python.framework.errors_impl.UnknownError: {{function_node __inference_native(training_step)_41157}} JIT compilation failed.
[[{{node mod_2}}]] [Op:__inference_native(training_step)_41157]
firstly i think its beacause of my tensorflow and cuda are not suitable, but i have successed with the code of the "Burgers Optimization with a Physics-Informed NN", the trainning runs well in this course.
im very confussed with this, please give me a hand ,thanks very much!
Hi,
I cannot reproduce the results of the notebook of chapter 8 on burgers optimization (diffphys-code-burgers.ipynb).
The gradient with math.gradients(loss, values) gives completely different values and then the optimization steps return a loss of nan.
How can I reproduce the same results of the book?
Hello!
In the section of Burgers Optimization with a Physics-Informed NN
> Preliminaries
, there is a sentence of "We'll also define the boundary_tx
function which gives an array of constraints for the solution (all for
Thank you!
Your issue content here.
Thanks for the wonderful work with vivid examples.
When I try to run the Navier-Stokes Forward Simulation demo, I got the following error.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-6c1e44e4d5ef> in <module>()
7 return velocity, smoke, pressure
8
----> 9 velocity, smoke, pressure = step(velocity, smoke, None, dt=DT)
10
11 print("Max. velocity and mean marker density: " + format( [ math.max(velocity.values) , math.mean(smoke.values) ] ))
<ipython-input-4-6c1e44e4d5ef> in step(velocity, smoke, pressure, dt, buoyancy_factor)
1 def step(velocity, smoke, pressure, dt=1.0, buoyancy_factor=1.0):
2 smoke = advect.semi_lagrangian(smoke, velocity, dt) + INFLOW
----> 3 buoyancy_force = smoke * (0, buoyancy_factor) >> velocity # resamples smoke to velocity sample points
4 velocity = advect.semi_lagrangian(velocity, velocity, dt) + dt * buoyancy_force
5 velocity = diffuse.explicit(velocity, NU, dt)
TypeError: unsupported operand type(s) for >>: 'CenteredGrid' and 'StaggeredGrid'
What do the >>
mean here?
the binder link doesn't work. the error message suggests it may be related to the switch from master to main
The terminology/notation in the first paragrph of the Formulation section seems very confusing, and does not seem to align up with how things are defined in Models and equations section (or in the Notations section).
E.g. x is defined as neural network input or spatial location in Notation, but here it seems to be a solution to u. Should x actually be f(x;$\theta$) or u(x;
Cudos to the team!
Is it possible or planned to produce EPUB version (to download and read offline on e-reader or mobile)?
My version:tensorflow 2.6.2;phiflow 2.2.0...
And when I run the code in "Burgers Optimization with a Physics-Informed NN", the AttributeError showed "module 'phi.math' has no attribute 'expand_dims' ". I don't know if it's a version problem.
This section cannot be run locally, so I'm missing two files "burgers-groundtruth-solution.npz" and "burgers-pinn-solution.npz". I would like to ask if you can provide these two files so that I can run the following comparison locally? Thanks so much to you.
Hi,
thank you so much for this wonderful resource! What about adding the possibillity to print the whole book to PDF, or to some other format such as epub, mobi, etc.? This would be very useful for people who want to read it offline. See for example a similar issue for another HTML book:
The code for dp part is as follows:
#Training
results_dp = nn_dp.fit(X, X, epochs=5, batch_size=5, verbose=1)
The second parameter of the fit method should have been Y in place of X i.e. nn_dp.fit(X, Y, epochs=5, batch_size=5, verbose=1)
The variable pressure
is not introduced, resulting in an error when running the copy & pasted code.
I have a question about this photo in 3.4.4. The in-uy inside of the airfoil shape is
Both velocity channels are initialized to the x and y component of the freestream conditions, respectively, with a zero velocity inside of the airfoil shape.
Maybe the in-uy inside of the airfoil shape should by
Thank you for your works.
This project piques my interest, and I would like to read through the book. I have worked on projects with TF/Keras before.
But I would really like a PyTorch version.
Do you have any updates on that?
I would be able to suggest this book to many people if it had a PyTorch version.
Thanks for this great project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.