pytorch/tnt

Issue with torch 1.13

dmtrs opened this issue · 1 comments

dmtrs commented

🐛 Describe the bug

Can not import torchtnt.framework due to AttributeError.

Traceback (most recent call last):
  File "/Users/foo/app/runner/trainer/__init__.py", line 4, in <module>
    import torchtnt.framework
  File "/Users/foo/Library/Caches/pypoetry/virtualenvs/sp-mcom8aNU-py3.9/lib/python3.9/site-packages/torchtnt/framework/__init__.py", line 7, in <module>
    from .auto_unit import AutoUnit
  File "/Users/foo/Library/Caches/pypoetry/virtualenvs/sp-mcom8aNU-py3.9/lib/python3.9/site-packages/torchtnt/framework/auto_unit.py", line 23, in <module>
    from torchtnt.framework.unit import EvalUnit, PredictUnit, TrainUnit
  File "/Users/foo/Library/Caches/pypoetry/virtualenvs/sp-mcom8aNU-py3.9/lib/python3.9/site-packages/torchtnt/framework/unit.py", line 24, in <module>
    TLRScheduler = torch.optim.lr_scheduler.LRScheduler
AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'LRScheduler'

From torch documentation it does not seem to have a torch.optim.lr_scheduler in stable version. https://pytorch.org/docs/stable/optim.html. Please also see BC-breaking change after 1.10 that may affect optimizer and lr step.

From requirements.txt it does not seem this is locked in particular torch version.

What is current working supported torch version for torchtnt=0.0.4? Is there plans to have particular supported torch versions?

Versions

% poetry run python collect_env.py                                                                                                                                                                      ✹ ✭
Collecting environment information...
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 10.14.6 (x86_64)
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.13 (main, Sep  3 2022, 22:36:35)  [Clang 10.0.1 (clang-1001.0.46.4)] (64-bit runtime)
Python platform: macOS-10.14.6-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.23.5
[pip3] torch==1.13.1
[pip3] torchtnt==0.0.4
[conda] Could not collect
dmtrs commented

It seems the issue with the torch version not having this update as expected:

Python 3.9.16 (main, Dec 21 2022, 11:35:55)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch.optim.lr_scheduler
>>> torch.__version__
'1.13.1'
>>> torch.optim.lr_scheduler.LRScheduler
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'LRScheduler'