Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

underflow in dt nan #244

Closed
huanranchen opened this issue Nov 21, 2023 · 3 comments
Closed

underflow in dt nan #244

huanranchen opened this issue Nov 21, 2023 · 3 comments

Comments

@huanranchen
Copy link

Hi,
when using dopri5 algorithm, it sometimes occurs "underflow in dt nan". Could we set a upper bound and a lower bound for dt to avoid such problems?

@rtqichen
Copy link
Owner

rtqichen commented Mar 12, 2024

There is a min_step argument if you use any RK adaptive-step solver like the default dopri5. https://github.com/rtqichen/torchdiffeq/blob/master/torchdiffeq/_impl/rk_common.py#L146

odeint(..., method="dopri5", options={"min_step": 0.01})

Depending on your application, it might be worth thinking more about how to model a less stiff ODE though (if that is a possibility).

@huanranchen
Copy link
Author

Thanks a lot!

This error occurs since dt is too small. By setting "min_step": 0.01, it works!

There is a min_step argument if you use any RK adaptive-step solver like the default dopri5. https://github.com/rtqichen/torchdiffeq/blob/master/torchdiffeq/_impl/rk_common.py#L146

odeint(..., method="dopri5", options={"min_step": 0.01})

Depending on your application, it might be worth thinking more about how to model a less stiff ODE though (if that is a possibility).

@huanranchen
Copy link
Author

There is a min_step argument if you use any RK adaptive-step solver like the default dopri5. https://github.com/rtqichen/torchdiffeq/blob/master/torchdiffeq/_impl/rk_common.py#L146

odeint(..., method="dopri5", options={"min_step": 0.01})

Depending on your application, it might be worth thinking more about how to model a less stiff ODE though (if that is a possibility).

But this version (enabling setting min_step) hasn't been updated on pip. If we use pip to install torchdiffeq, we still cannot set min_step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants