-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Description
Motivation
"optree >= 0.13.0" is an optional dependency for PyTorch. There's not a good way to specify this in the package metadata, so we have code checks doing this. We ran into some issues with the PyTorch 2.7 release where the "optional dependency checking" code broken and we ended up (1) crashing on optree < 0.13.0 and (2) hard requiring optree >= 0.13.0. Furthermore, I submitted two fixes for this, where the first fix didn't work and the second one actually worked.
We should fix this so that future releases (e.g. 2.8.0) do not run into the risk of this problem.
Pitch
I see three high-level solutions:
- We continue to have optree as an optional dependency. We would need to beef up our CI. In particular, we want to test three configurations: optree == 0.13.0, no optree, and optree < 0.13.0
- We take the optree pypi package as a mandatory dependency.
- We take optree as a required pytorch submodule and build it into PyTorch.
From discussions with @malfet, @seemethere, @atalman and @albanD it sounded like we preferred (3). The risk of doing (2) is that we get into dependency hell: if a third-party library pins optree and pytorch pins optree then we end up in a not-so-good-place. The direction our project is going in is taking optree as a mandatory requirement somehow, so (1) seems not worth it.
Thoughts? @XuehaiPan @angelayi