CompImg / LST-AI

LST-AI - Deep Learning Ensemble for Accurate MS Lesion Segmentation
https://doi.org/10.1016/j.nicl.2024.103611
MIT License
18 stars 4 forks source link

typing-extensions #22

Open MicaelAnderssonUmu opened 2 weeks ago

MicaelAnderssonUmu commented 2 weeks ago

Hello

I noticed that tensorflow requires typing-extensions to be of version <4.6.0, while torch requires a typing-extensions>=4.8.0. Have you experienced this problem and how did you solve it?

Best regards Micael

jqmcginnis commented 2 weeks ago

Hey @MicaelAnderssonUmu,

Thanks for reporting this! :slightly_smiling_face:

Initially, we decided to allow any pytorch version, given that HD-BET does not restrict this either (and LST-AI only uses tf). However, as h5 model weights are no longer really supported in tensorflow, we had to choose an older release for tensorflow, which seems to clash with newer pytorch versions.

As a quick fix, I think it is possible to add torch version requirements as a quick fix into our (that is LST-AI's) setup.py. I checked the different pytorch releases, and I believe the typing-extensions>=4.8.0 arrived in pytorch version 2.2.0. I created a branch with this version requirement here:

https://github.com/CompImg/LST-AI/blob/8bcd1939bf6fee9095386080bd3aba9a58743740/setup.py#L17-L26

To test the changes, I would kindly ask you to create a new environment (i.e. start the installation process detailed here) from scratch and checkout the jqm/tf_torch_typing_extension.

git clone https://github.com/CompImg/LST-AI/
git checkout jqm/tf_torch_typing_extension
cd LST-AI
pip install -e .
cd ..

Please let me know if this works for you!

MicaelAnderssonUmu commented 2 weeks ago

I added torch<2.2.0 to the setup.py-file before installing the programs and now it worked. Thankyou very much! Instead, I now got an error for missing NVIDIA driver.

jqmcginnis commented 2 weeks ago

Can you provide the error message? :) Is it in the same environment or did you create a new environment?

jqmcginnis commented 2 weeks ago

Another option you could try would be installing pytorch first via pip:

https://pytorch.org/get-started/previous-versions/#v212

based on your nvidia-cuda version, select the appropriate installation command. Let me know if this resolves the issue :slightly_smiling_face:

MicaelAnderssonUmu commented 2 weeks ago

Thankyou for the advice. I am running on a cluster which neither supports conda nor docker. I can achieve it by the modules, but got stuck on dependencies.

May I suggest in the future to make a .sif-file so one can run it in a container?

Best regards Micael

jqmcginnis commented 2 weeks ago

hey @MicaelAnderssonUmu - somone mentioned singularity as well in this thread https://github.com/CompImg/LST-AI/issues/21. I will look into this, but I am new to singularity and thus cannot estimate how long it will take me to do it, given that we are facing an issue there. I am also busy with some other projects for the next two weeks, I will try to look into this, but it will take some time I am afraid. If you are familiar with the process, I would appreciate some advice :slightly_smiling_face: Thanks for your patience!

MicaelAnderssonUmu commented 2 weeks ago

I have not made any .sif-files myself. I am most familiar with Matlab and C, but have used some python programs. My experience is that if python programs are not distributed for a container, one need to spend a lot of time and effort to make them run (if possible at all).

lyhoo23618-csu commented 2 weeks ago

Hi, here is the sif file I made based on the Docker container provided. Perhaps you can try it to see if you encounter the same error as I did (#21).  I am not sure this is due to the error in the container or the error of my cluster environment. Google drive link: https://drive.google.com/file/d/1ICxTbWz1mH8izNJgXI41J7prBfPj8Yee/view?usp=drive_link

MicaelAnderssonUmu commented 1 week ago

I solved my situation by running on another computer and setting --device cpu