ashkamath / mdetr

Apache License 2.0
968 stars 125 forks source link

requirements for running the demo notebook #102

Open roy651 opened 9 months ago

roy651 commented 9 months ago

I tried running the demo notebook but apparently the requirements are not sorted out properly. The model and weights are roughly from 2021/2022 and torch and other libraries have evolved since. So FWIW this setup worked for me. I had to use Python 3.8:

torch==1.10.2
torchvision==0.11.3
tokenizers==0.11.6
transformers==4.16.2
timm==0.5.4
Lopa07 commented 6 months ago

This is helpful. Thank you!

pip3 install --upgrade --force-reinstall tokenizers==0.10.3 transformers==4.5.1 timm==0.5.4
pip install --upgrade --force-reinstall torch==1.7.1+cu110 torchvision==0.8.2+cu110 -f https://download.pytorch.org/whl/torch_stable.html

export CUBLAS_WORKSPACE_CONFIG=:4096:8
python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --dataset_config configs/pretrain.json --ema

The tokenizer version that is installed is 0.10.3. In the transformers package, the version requirement for tokenizers is >=0.10.1,<0.11. Still, this was giving the error packaging.version.InvalidVersion: Invalid version: '0.10.1,<0.11'. So changed the tokenizers version requirement in lib/python3.8/site-packages/transformers/dependency_versions_table.py from tokenizers>=0.10.1,<0.11 to tokenizers>=0.10.1. This worked.

Amaia-CARDIEL commented 3 months ago

Following earlier comments, I could make the model work in a virtual environment (not on colab but on my own GPU) by doing the following instal:

conda create -n mdetr_env_4 python=3.10.12 conda activate mdetr_env_4 pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html pip install tokenizers==0.11.6 pip install transformers==4.16.2 pip install timm==0.5.4 pip install scipy pip install matplotlib pip install scikit-image