Giter Club home page Giter Club logo

pbdl-book's People

Contributors

abdrysdale avatar alonfnt avatar amanmdesai avatar andrinr avatar bobarna avatar caic99 avatar thunil avatar topsy404 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pbdl-book's Issues

Question about "1.2 Finding the inverse function of a parabola"

My anaconda list is followed:

  • numpy=1.23.4
  • tensorflow-gpu=2.10.0
  • keras=2.10.0

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!

cant reproduce the result of Reducing Numerical Errors with Deep Learning

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!

cannot reproduce results burgers

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?

Possible loss of "t“ in a equation

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 $=0.5$ in this example)". I think that $=0.5$ should possibly be $t=0.5$.

Thank you!

TypeError: unsupported operand type(s) for >>: 'CenteredGrid' and 'StaggeredGrid' in Navier-Stokes Forward Simulation

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?

Issue on page /physicalloss-code.html

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; $\theta$)?

EPUB variant

Cudos to the team!

Is it possible or planned to produce EPUB version (to download and read offline on e-reader or mobile)?

module 'phi.math' has no attribute 'expand_dims'

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.

Issue on intro-teaser.ipynb

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)

Question with a photo in 3.4.4 RANS training data

photo
I have a question about this photo in 3.4.4. The in-uy inside of the airfoil shape is $1.0$, but I find the following sentence in the original paper of the Supervised training for RANS flows around airfoils example.

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 $0.0$. I am a newbie in the filed of Physic-based Deep Learning, if I said something please forgive me.
Thank you for your works.

Is a PyTorch version in the horizon?

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.

minor typo in intro-teaser notebook

In the plot for the Standard Approach in the teaser parabola example, the x and y axis labels appear to be mislabeled.
Minor typo fix:

plt.xlabel('x')
plt.ylabel('y')
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.