Using machine learning packages such as pytorch in pybamm #4309
Replies: 3 comments 4 replies
-
I have never used pytorch, but PyBaMM is not designed to be compatible with it so I don't think what you suggest is possible. |
Beta Was this translation helpful? Give feedback.
-
If you can convert your pytorch model to JAX, then you might be able to use the JAX solver in pybamm to solve it and calculate gradients for training. We're also trying to get the IDAKLU solver to use JAX models as well, so this might be a possibility in the future. If you go down this route I'd be keen to hear about it! |
Beta Was this translation helpful? Give feedback.
-
Okay, what about the below approach? Would this be a reasonable approximation? time = np.linspace(0, 100, 100000) |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am interested in using a machine learning model which uses a pybamm variable as input as shown below.
x = pybamm.Variable("x")
dx/dt = 4 * x + pytorch_model(x)
where consider pytorch_model as a simple feedforward model.
But I am unable to simulate as shown above as the input to the pytorch_model is a symbolic term and not a numerical value which the pytorch_model usually expects.
Please let me know how do I achieve this
@martinjrobins @brosaplanella @valentinsulzer
Beta Was this translation helpful? Give feedback.
All reactions