google-research / torchsde

Differentiable SDE solvers with GPU support and efficient sensitivity analysis.
Apache License 2.0
1.51k stars 194 forks source link

Missing attributes of `brownian_lib` #51

Closed dboyliao closed 3 years ago

dboyliao commented 3 years ago
Screen Shot 2020-09-07 at 4 27 26 PM

When I run the tests, it looks like BrownianTree and BrownianPath are missing in brownian_lib module. After inspecting the test itself, it looks like BrownianTree and BrownianPath from brownian_lib and _brownian should work compatibly.

I think there are two ways to fix it:

  1. add an if hasattr check in the testing code
  2. add import statements from _brownian in brownian_lib/__init__.py if the imports in the try block fails.
lxuechen commented 3 years ago

Thanks for redirecting here!

It seems possible that the C++ code didn't compile properly, though I can't really be sure that's the case given that I only have little information on the installation process and system config you have. I'd recommend going with the first option (check attribute and use pytest.skip with appropriate message). Ideally, it'd be great if you could send in the PR on dev branch if you'd like, as we're doing some major developments there (it will be a v0.2.0 release later this month); if you feel that's a hassle, you could drop a message about that and I'll send in a fix shortly.

dboyliao commented 3 years ago

As for the installation, I'm running PyTorch on a machine that has only cuda10 driver available. So I have to install PyTorch v1.4 instead of v1.6 as required by torchsde. Maybe that's the root cause of the error. That's also why I'd like to run the tests to see if v1.4 has broken anything or not. Fortunately, all tests pass.

I'll send a PR later when I get time to do it. I'm trying neural sde for time series data and busy on running experiments.

lxuechen commented 3 years ago

Ok, thanks! No worries, let me send in the fix shortly, and thanks for reporting!

lxuechen commented 3 years ago

Just as a side note, torch==1.6.0 is mostly strictly required for using generators in the C++ versions of BrownianTree; so as far I can tell, it shouldn't break anything else. The sub-package brownian_lib is also set to be optionally installed, so that's likely the reason for the previous failing tests.