openfl
openfl copied to clipboard
PyTorch >=2.5.0 - TypeError: Type parameter +RV without a default follows type parameter with a default
Describe the bug Version: PyTorch >=2.5.0 PIP > 24.1.2 Torchvision >=0.20.1
The error shown in screenshot below occurs when using a dataset with PyTorch and Torchvision.
To Reproduce Steps to reproduce the behavior:
- Follow https://openfl.readthedocs.io/en/latest/tutorials/taskrunner.html# and run torch/mnist workspace with version mentioned above.
Expected behavior The experiment should run without any issues.
Screenshots
Solution
- Use PIP version <=24.1.2 for dependency management.
- Apply the following patch before importing datasets from torchvision.
import sys
import typing_extensions
sys.modules["pip._vendor.typing_extensions"] = typing_extensions
from torchvision import datasets
Thanks for publishing the workaround, @tanwarsh !