aimagelab / mil4wsi

DAS-MIL: Distilling Across Scales for MILClassification of Histological WSIs
MIT License
35 stars 4 forks source link

solve virtual environment #24

Open lijinchang-shazhu opened 1 week ago

lijinchang-shazhu commented 1 week ago

Thank you for your work and contribution. Following the installation steps in readme, I use the command "mamba env update -- file environment. yml". there were packages that could not be resolved and did not exist when I was solving virtual environment dependencies. May I ask how I should solve it? image image

Bontempogianpaolo1 commented 6 days ago

Hi @lijinchang-shazhu,

It is the first time I have seen this issue. It is odd, especially because other users already tried this repo. Could you upload more details? (e.g. logs, OS, cuda version on your machine)

lijinchang-shazhu commented 6 days ago

Dear author Thank you for your response and assistance amidst your busy schedule. Thank you very much. I encountered an issue while trying to set up the environment for the project using the provided environment.yml file. Here are the other detailed information you have requested:

Thank you very much for responding and helping me solve the problem. If you need any further details, or if I should follow any other steps, please let me know.

Best regards, JinchangLI

Bontempogianpaolo1 commented 6 days ago

Hi @lijinchang-shazhu ,

You have a different CUDA version...In my opinion, the easiest way is to reinstall it manually. You need four main libraries to reproduce the work: 1) pyg with torch for the computing part https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html ;2) wandb for logging;3) submitit for run on slurm server https://github.com/facebookincubator/submitit; 4) scikit-learn for metrics https://scikit-learn.org/stable/install. I don't expect many code variations for that, but in case, I can help you. After that, we can open a dedicated branch for that! :)

lijinchang-shazhu commented 6 days ago

Hi @Bontempogianpaolo1

Thank you for your detailed suggestions and guidance. I appreciate your help. I will continue to manually reinstall the necessary libraries. This is my plan: Install PyTorch Geometry using the appropriate version of PyTorch: I will follow the installation instructions in the official PyTorch Geometry documentation.

Thank you again for your support!

Best regards, JinchangLi

lijinchang-shazhu commented 5 days ago

Dear Author @Bontempogianpaolo1 Thank you for your help yesterday. I followed your advice and reinstalled versions of CUDA and other important libraries. Thank you again!At the same time,I greatly appreciate your work and the contributions it has made to my research/work. However, Now there's another problem, I'm really sorry to bother you.The problem is like this, as shown in the following text.

I have encountered an issue while running main.py in the project, and I am seeking your guidance to resolve it. The error message I received is as follows:

Traceback (most recent call last):
  File "....../main.py", line 4, in <module>
    from utilsmil4wsi.process import processDataset
  File "....../mil4wsi/utilsmil4wsi/process.py", line 4, in <module>
    from models import selectModel
  File "....../mil4wsi/models/__init__.py", line 9, in <module>
    from models.hipt.hipt import HIPT_LGP_FC
  File "....../mil4wsi/models/hipt/hipt.py", line 6, in <module>
    import vision_transformer as vits
ModuleNotFoundError: No module named 'vision_transformer'

1. At the same time, I found these two pieces of code in hipt.py,

 sys.path.append('/mnt/beegfs/work/H2020DeciderFicarra/gbontempo/dino')
 sys.path.append('/homes/gbontempo/dasmil-extension')

which I cannot find. This means that any module in this directory cannot be found and imported by the Python interpreter. May I ask if this has caused a problem

2. It seems that the vision_transformer module is not included in the project directory. In `hipt.py`, I found that importing and using the 'vision_transformer' module as follows:

self.local_vit = **vits**.__dict__["vit_small"](patch_size=384, num_classes=0)

However, due to the missing module, I am unable to proceed. I have attempted to install the timm library and use its vit_small_patch16_384 model, but I am unsure if this aligns with the original design of your project.

Could you please provide more details about the vision_transformer module or suggest a solution to correctly import and utilize this module? Your assistance would be greatly appreciated.

Thank you once again for developing and sharing this excellent project. I look forward to your response.

Best regards,

JinchangLi

Bontempogianpaolo1 commented 5 days ago

hi @lijinchang-shazhu, HIPT is a hierarchical solution exploiting vits and DINO. Here their implementation here. You could fix If you download DINO, and export the repository_path( as explained in t2/readme.py) or copy the visionTransformer class in the current repo