odl icon indicating copy to clipboard operation
odl copied to clipboard

torch contrib broken

Open wuebbel opened this issue 6 months ago • 1 comments

contrib/torch/operator.py lacks the import statement

from odl.util.npy_compat import AVOID_UNNECESSARY_COPY

whch breaks the torch contrib at least in my installation.

Best, Frank

wuebbel avatar Jun 23 '25 09:06 wuebbel

My mistake! Thanks for reporting.

But with the import line, does it work then?

Note for future: we're still working on integrating the changes that make ODL "deep compatible" with PyTorch (and other backends that support the Python Array API). We hoped to have this finished already months ago, but to do it in a future-proof way without too much redundancy is tough. We now have an almost-working version that supports the Array API in the core though, and a version that works with PyTorch for specific use cases. It is mostly a matter of putting them together now.

leftaroundabout avatar Jun 23 '25 11:06 leftaroundabout

Is there any updates on this?

prbzrg avatar Aug 19 '25 17:08 prbzrg

@prbzrg you mean on the quick-fix for torch-contrib, or the proper ArrayAPI/PyTorch integration?

https://github.com/odlgroup/odl/pull/1691 is a one-liner that can just be merged.

The array API project meanwhile is still work in progress, you can follow it here: https://github.com/Emvlt/odl/commits/python_array_api_support/

leftaroundabout avatar Aug 20 '25 08:08 leftaroundabout

Right now, I just need the quick fix. Can it get a release?

prbzrg avatar Aug 20 '25 11:08 prbzrg

@prbzrg Hm, we didn't really intend to make any more 0.x releases, except perhaps backports for serious bugs in core ODL.

Using ODL-0.8.1 or the Github dev version is not an option for you?

leftaroundabout avatar Aug 20 '25 13:08 leftaroundabout

until now I used odl=0.8.1 but for the code I have that makes only work with torch<=2.7.0. is it safe to use the master branch? is it stable enough to be used in serious works?

prbzrg avatar Aug 20 '25 13:08 prbzrg

Well, the master branch is not stable in the sense of, we shall soon introduce the big changes for the 1.0 release into it. We only merge those after ensuring all tests and examples work, but there are two caveats:

  • Some old functionality will be broken (and the tests changed accordingly). This is unavoidable because parts of ODL used NumPy-specific features that cannot generalize across array backends.
  • There will probably be bugs not caught by the test suite / our own use cases, but still cause errors for users that do different things with ODL.

We're trying hard to minimize those problems, but can't promise you won't encounter them.

What you can of course do is pin the current commit to avoid any changes from affecting you; one way of doing this is to add ODL into your project as a Git submodule instead of installing it via a package manager.

Admittedly all of that is unsatisfying, so I suppose we should put out one more minor release (0.8.3) anyway. I will do that on Friday if no objections turn up.

leftaroundabout avatar Aug 20 '25 14:08 leftaroundabout

https://pypi.org/project/odl/0.8.3/

leftaroundabout avatar Aug 25 '25 15:08 leftaroundabout