MONAI Label doesn't work with torch<=1.10.0
See original GitHub issueDescribe the bug
After the PR https://github.com/Project-MONAI/MONAILabel/pull/731 added torchmaxflow==0.0.6rc1 to the requirements, MONAI Label stopped working for torch versions older than 1.10.0, specifically version 1.8.0.
I’ve also tried installing previous torchmaxflow versions (0.0.4 and 0.0.5) and still got the same error.
To Reproduce
- Using Linux/Ubuntu OS, create a virtual environment with Python=3.8 or Python=3.9.
- Once created, install requirements.txt.
Expected behavior
MONAI Label server starts
Screenshots
Environment
Ensuring you use the relevant python executable, please paste the output of:
================================
Printing MONAI config...
================================
MONAI version: 0.8.1
Numpy version: 1.22.3
Pytorch version: 1.8.0+cu111
MONAI flags: HAS_EXT = False, USE_COMPILED = False
MONAI rev id: 71ff399a3ea07aef667b23653620a290364095b1
Optional dependencies:
Pytorch Ignite version: 0.4.8
Nibabel version: 3.2.2
scikit-image version: 0.19.2
Pillow version: 9.1.0
Tensorboard version: 2.8.0
gdown version: 4.4.0
TorchVision version: 0.9.0+cu111
tqdm version: 4.64.0
lmdb version: 1.3.0
psutil version: 5.9.0
pandas version: NOT INSTALLED or UNKNOWN VERSION.
einops version: 0.4.1
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.
For details about installing the optional dependencies, please visit:
https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
================================
Printing system config...
================================
System: Linux
Linux version: Ubuntu 20.04.4 LTS
Platform: Linux-5.13.0-39-generic-x86_64-with-glibc2.31
Processor: x86_64
Machine: x86_64
Python version: 3.9.12
Process name: python
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Open files: []
Num physical CPUs: 24
Num logical CPUs: 48
Num usable CPUs: 48
CPU usage (%): [12.9, 11.5, 14.5, 14.8, 12.9, 16.4, 11.5, 14.3, 10.0, 14.5, 11.5, 11.3, 11.5, 12.9, 12.9, 12.9, 11.7, 14.3, 11.5, 12.7, 11.5, 11.3, 12.9, 12.9, 11.5, 12.9, 11.3, 11.3, 11.3, 12.9, 11.5, 11.5, 12.7, 11.5, 12.7, 14.5, 12.9, 11.3, 12.9, 12.9, 11.5, 11.5, 11.3, 11.5, 12.9, 11.3, 14.8, 98.4]
CPU freq. (MHz): 2
Load avg. in last 1, 5, 15 mins (%): [1.7, 1.4, 1.4]
Disk usage (%): 84.6
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 125.7
Available memory (GB): 110.5
Used memory (GB): 13.7
================================
Printing GPU config...
================================
Num GPUs: 2
Has CUDA: True
CUDA version: 11.1
cuDNN enabled: True
cuDNN version: 8005
Current device: 0
Library compiled for CUDA architectures: ['sm_37', 'sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86']
GPU 0 Name: NVIDIA RTX A6000
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 84
GPU 0 Total memory (GB): 47.5
GPU 0 CUDA capability (maj.min): 8.6
GPU 1 Name: NVIDIA RTX A6000
GPU 1 Is integrated: False
GPU 1 Is multi GPU board: False
GPU 1 Multi processor count: 84
GPU 1 Total memory (GB): 47.5
GPU 1 CUDA capability (maj.min): 8.6
Additional context
I’m using torch version 1.8.0 because it is the only one compatible with my GPU card (?)
Newer torch versions create the following error:
NVIDIA RTX A6000 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the NVIDIA RTX A6000 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/
Which I solved by installing the following versions:
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Soon monai core also dropping support for older torch version… lets fix the readme/requirements… we need scribbles… so lets recommend users to use torch >= 1.10
Apologies for delayed response on this.
As mentioned in https://github.com/Project-MONAI/MONAILabel/pull/731#issuecomment-1097323581 and discussed in that thread, an alternate could be to use numpy for maxflow (instead of torch).
I have a variant of maxflow library that interfaces through numpy (https://github.com/masadcv/numpymaxflow) – it still needs a lot of testing and debugging but may be a good alternative for getting rid of torch version tied to torchmaxflow library. I will update and open a PR to switch to this once it is ready.