huggingface / setfit

Efficient few-shot learning with Sentence Transformers
https://hf.co/docs/setfit
Apache License 2.0
2.25k stars 223 forks source link

Oversized required packages in setfit #422

Closed emremrah closed 1 year ago

emremrah commented 1 year ago

Problem

The packages that setfit installs seem very big.

Background

We are going to deploy a docker image that contains a package that installs setfit. In this scenario the image size is very important for us.

Below you can see the sizes of packages in a a fresh environment vs. after installing setfit only: newly created environment: image

after installing setfit: image

I see that only torch is 1.3G but what about nvidia? How necessary is it? Is there anything could be done to reduce the size? Is it possible to make it an extra required package?

Thanks.

tomaarsen commented 1 year ago

Hello!

Hmm, that is odd. I can't find a package called nvidia in my install, perhaps it has a different name?

> pip show nvidia
WARNING: Package(s) not found: nvidia

I also printed out the dependencies of SetFit:

setfit==0.8.0.dev0
├── datasets [required: >=2.3.0, installed: 2.11.0]
│   ├── aiohttp [required: Any, installed: 3.8.3]
│   │   ├── aiosignal [required: >=1.1.2, installed: 1.3.1]
│   │   │   └── frozenlist [required: >=1.1.0, installed: 1.3.3]
│   │   ├── async-timeout [required: >=4.0.0a3,<5.0, installed: 4.0.2]
│   │   ├── attrs [required: >=17.3.0, installed: 22.2.0]
│   │   ├── charset-normalizer [required: >=2.0,<3.0, installed: 2.1.1]
│   │   ├── frozenlist [required: >=1.1.1, installed: 1.3.3]
│   │   ├── multidict [required: >=4.5,<7.0, installed: 6.0.4]
│   │   └── yarl [required: >=1.0,<2.0, installed: 1.8.2]
│   │       ├── idna [required: >=2.0, installed: 3.4]
│   │       └── multidict [required: >=4.0, installed: 6.0.4]
│   ├── dill [required: >=0.3.0,<0.3.7, installed: 0.3.5.1]
│   ├── fsspec [required: >=2021.11.1, installed: 2023.1.0]
│   ├── huggingface-hub [required: >=0.11.0,<1.0.0, installed: 0.12.0]
│   │   ├── filelock [required: Any, installed: 3.9.0]
│   │   ├── packaging [required: >=20.9, installed: 23.1]
│   │   ├── PyYAML [required: >=5.1, installed: 6.0]
│   │   ├── requests [required: Any, installed: 2.28.2]
│   │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   │   ├── tqdm [required: >=4.42.1, installed: 4.64.1]
│   │   │   └── colorama [required: Any, installed: 0.4.6]
│   │   └── typing-extensions [required: >=3.7.4.3, installed: 4.4.0]
│   ├── multiprocess [required: Any, installed: 0.70.13]
│   │   └── dill [required: >=0.3.5.1, installed: 0.3.5.1]
│   ├── numpy [required: >=1.17, installed: 1.23.4]
│   ├── packaging [required: Any, installed: 23.1]
│   ├── pandas [required: Any, installed: 2.0.0]
│   │   ├── numpy [required: >=1.20.3, installed: 1.23.4]
│   │   ├── python-dateutil [required: >=2.8.2, installed: 2.8.2]
│   │   │   └── six [required: >=1.5, installed: 1.16.0]
│   │   ├── pytz [required: >=2020.1, installed: 2022.7.1]
│   │   └── tzdata [required: >=2022.1, installed: 2023.3]
│   ├── pyarrow [required: >=8.0.0, installed: 11.0.0]
│   │   └── numpy [required: >=1.16.6, installed: 1.23.4]
│   ├── PyYAML [required: >=5.1, installed: 6.0]
│   ├── requests [required: >=2.19.0, installed: 2.28.2]
│   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   ├── responses [required: <0.19, installed: 0.18.0]
│   │   ├── requests [required: >=2.0,<3.0, installed: 2.28.2]
│   │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   │   └── urllib3 [required: >=1.25.10, installed: 1.26.14]
│   ├── tqdm [required: >=4.62.1, installed: 4.64.1]
│   │   └── colorama [required: Any, installed: 0.4.6]
│   └── xxhash [required: Any, installed: 3.2.0]
├── evaluate [required: >=0.3.0, installed: 0.3.0]
│   ├── datasets [required: >=2.0.0, installed: 2.11.0]
│   │   ├── aiohttp [required: Any, installed: 3.8.3]
│   │   │   ├── aiosignal [required: >=1.1.2, installed: 1.3.1]
│   │   │   │   └── frozenlist [required: >=1.1.0, installed: 1.3.3]
│   │   │   ├── async-timeout [required: >=4.0.0a3,<5.0, installed: 4.0.2]
│   │   │   ├── attrs [required: >=17.3.0, installed: 22.2.0]
│   │   │   ├── charset-normalizer [required: >=2.0,<3.0, installed: 2.1.1]
│   │   │   ├── frozenlist [required: >=1.1.1, installed: 1.3.3]
│   │   │   ├── multidict [required: >=4.5,<7.0, installed: 6.0.4]
│   │   │   └── yarl [required: >=1.0,<2.0, installed: 1.8.2]
│   │   │       ├── idna [required: >=2.0, installed: 3.4]
│   │   │       └── multidict [required: >=4.0, installed: 6.0.4]
│   │   ├── dill [required: >=0.3.0,<0.3.7, installed: 0.3.5.1]
│   │   ├── fsspec [required: >=2021.11.1, installed: 2023.1.0]
│   │   ├── huggingface-hub [required: >=0.11.0,<1.0.0, installed: 0.12.0]
│   │   │   ├── filelock [required: Any, installed: 3.9.0]
│   │   │   ├── packaging [required: >=20.9, installed: 23.1]
│   │   │   ├── PyYAML [required: >=5.1, installed: 6.0]
│   │   │   ├── requests [required: Any, installed: 2.28.2]
│   │   │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   │   │   ├── tqdm [required: >=4.42.1, installed: 4.64.1]
│   │   │   │   └── colorama [required: Any, installed: 0.4.6]
│   │   │   └── typing-extensions [required: >=3.7.4.3, installed: 4.4.0]
│   │   ├── multiprocess [required: Any, installed: 0.70.13]
│   │   │   └── dill [required: >=0.3.5.1, installed: 0.3.5.1]
│   │   ├── numpy [required: >=1.17, installed: 1.23.4]
│   │   ├── packaging [required: Any, installed: 23.1]
│   │   ├── pandas [required: Any, installed: 2.0.0]
│   │   │   ├── numpy [required: >=1.20.3, installed: 1.23.4]
│   │   │   ├── python-dateutil [required: >=2.8.2, installed: 2.8.2]
│   │   │   │   └── six [required: >=1.5, installed: 1.16.0]
│   │   │   ├── pytz [required: >=2020.1, installed: 2022.7.1]
│   │   │   └── tzdata [required: >=2022.1, installed: 2023.3]
│   │   ├── pyarrow [required: >=8.0.0, installed: 11.0.0]
│   │   │   └── numpy [required: >=1.16.6, installed: 1.23.4]
│   │   ├── PyYAML [required: >=5.1, installed: 6.0]
│   │   ├── requests [required: >=2.19.0, installed: 2.28.2]
│   │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   │   ├── responses [required: <0.19, installed: 0.18.0]
│   │   │   ├── requests [required: >=2.0,<3.0, installed: 2.28.2]
│   │   │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   │   │   └── urllib3 [required: >=1.25.10, installed: 1.26.14]
│   │   ├── tqdm [required: >=4.62.1, installed: 4.64.1]
│   │   │   └── colorama [required: Any, installed: 0.4.6]
│   │   └── xxhash [required: Any, installed: 3.2.0]
│   ├── dill [required: Any, installed: 0.3.5.1]
│   ├── fsspec [required: >=2021.05.0, installed: 2023.1.0]
│   ├── huggingface-hub [required: >=0.7.0, installed: 0.12.0]
│   │   ├── filelock [required: Any, installed: 3.9.0]
│   │   ├── packaging [required: >=20.9, installed: 23.1]
│   │   ├── PyYAML [required: >=5.1, installed: 6.0]
│   │   ├── requests [required: Any, installed: 2.28.2]
│   │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   │   ├── tqdm [required: >=4.42.1, installed: 4.64.1]
│   │   │   └── colorama [required: Any, installed: 0.4.6]
│   │   └── typing-extensions [required: >=3.7.4.3, installed: 4.4.0]
│   ├── multiprocess [required: Any, installed: 0.70.13]
│   │   └── dill [required: >=0.3.5.1, installed: 0.3.5.1]
│   ├── numpy [required: >=1.17, installed: 1.23.4]
│   ├── packaging [required: Any, installed: 23.1]
│   ├── pandas [required: Any, installed: 2.0.0]
│   │   ├── numpy [required: >=1.20.3, installed: 1.23.4]
│   │   ├── python-dateutil [required: >=2.8.2, installed: 2.8.2]
│   │   │   └── six [required: >=1.5, installed: 1.16.0]
│   │   ├── pytz [required: >=2020.1, installed: 2022.7.1]
│   │   └── tzdata [required: >=2022.1, installed: 2023.3]
│   ├── requests [required: >=2.19.0, installed: 2.28.2]
│   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   ├── responses [required: <0.19, installed: 0.18.0]
│   │   ├── requests [required: >=2.0,<3.0, installed: 2.28.2]
│   │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
│   │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
│   │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
│   │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
│   │   └── urllib3 [required: >=1.25.10, installed: 1.26.14]
│   ├── tqdm [required: >=4.62.1, installed: 4.64.1]
│   │   └── colorama [required: Any, installed: 0.4.6]
│   └── xxhash [required: Any, installed: 3.2.0]
└── sentence-transformers [required: >=2.2.1, installed: 2.2.2]
    ├── huggingface-hub [required: >=0.4.0, installed: 0.12.0]
    │   ├── filelock [required: Any, installed: 3.9.0]
    │   ├── packaging [required: >=20.9, installed: 23.1]
    │   ├── PyYAML [required: >=5.1, installed: 6.0]
    │   ├── requests [required: Any, installed: 2.28.2]
    │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
    │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
    │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
    │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
    │   ├── tqdm [required: >=4.42.1, installed: 4.64.1]
    │   │   └── colorama [required: Any, installed: 0.4.6]
    │   └── typing-extensions [required: >=3.7.4.3, installed: 4.4.0]
    ├── nltk [required: Any, installed: 3.8.1]
    │   ├── click [required: Any, installed: 8.1.3]
    │   │   └── colorama [required: Any, installed: 0.4.6]
    │   ├── joblib [required: Any, installed: 1.2.0]
    │   ├── regex [required: >=2021.8.3, installed: 2022.10.31]
    │   └── tqdm [required: Any, installed: 4.64.1]
    │       └── colorama [required: Any, installed: 0.4.6]
    ├── numpy [required: Any, installed: 1.23.4]
    ├── scikit-learn [required: Any, installed: 1.1.1]
    │   ├── joblib [required: >=1.0.0, installed: 1.2.0]
    │   ├── numpy [required: >=1.17.3, installed: 1.23.4]
    │   ├── scipy [required: >=1.3.2, installed: 1.10.1]
    │   │   └── numpy [required: >=1.19.5,<1.27.0, installed: 1.23.4]
    │   └── threadpoolctl [required: >=2.0.0, installed: 3.1.0]
    ├── scipy [required: Any, installed: 1.10.1]
    │   └── numpy [required: >=1.19.5,<1.27.0, installed: 1.23.4]
    ├── sentencepiece [required: Any, installed: 0.1.97]
    ├── torch [required: >=1.6.0, installed: 1.13.1+cu117]
    │   └── typing-extensions [required: Any, installed: 4.4.0]
    ├── torchvision [required: Any, installed: 0.14.1]
    │   ├── numpy [required: Any, installed: 1.23.4]
    │   ├── Pillow [required: >=5.3.0,!=8.3.*, installed: 9.4.0]
    │   ├── requests [required: Any, installed: 2.28.2]
    │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
    │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
    │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
    │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
    │   ├── torch [required: ==1.13.1, installed: 1.13.1+cu117]
    │   │   └── typing-extensions [required: Any, installed: 4.4.0]
    │   └── typing-extensions [required: Any, installed: 4.4.0]
    ├── tqdm [required: Any, installed: 4.64.1]
    │   └── colorama [required: Any, installed: 0.4.6]
    └── transformers [required: >=4.6.0,<5.0.0, installed: 4.28.1]
        ├── filelock [required: Any, installed: 3.9.0]
        ├── huggingface-hub [required: >=0.11.0,<1.0, installed: 0.12.0]
        │   ├── filelock [required: Any, installed: 3.9.0]
        │   ├── packaging [required: >=20.9, installed: 23.1]
        │   ├── PyYAML [required: >=5.1, installed: 6.0]
        │   ├── requests [required: Any, installed: 2.28.2]
        │   │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
        │   │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
        │   │   ├── idna [required: >=2.5,<4, installed: 3.4]
        │   │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
        │   ├── tqdm [required: >=4.42.1, installed: 4.64.1]
        │   │   └── colorama [required: Any, installed: 0.4.6]
        │   └── typing-extensions [required: >=3.7.4.3, installed: 4.4.0]
        ├── numpy [required: >=1.17, installed: 1.23.4]
        ├── packaging [required: >=20.0, installed: 23.1]
        ├── PyYAML [required: >=5.1, installed: 6.0]
        ├── regex [required: !=2019.12.17, installed: 2022.10.31]
        ├── requests [required: Any, installed: 2.28.2]
        │   ├── certifi [required: >=2017.4.17, installed: 2022.12.7]
        │   ├── charset-normalizer [required: >=2,<4, installed: 2.1.1]
        │   ├── idna [required: >=2.5,<4, installed: 3.4]
        │   └── urllib3 [required: >=1.21.1,<1.27, installed: 1.26.14]
        ├── tokenizers [required: >=0.11.1,<0.14,!=0.11.3, installed: 0.13.3]
        └── tqdm [required: >=4.27, installed: 4.64.1]
            └── colorama [required: Any, installed: 0.4.6]

But there's no nvidia there. Could it be that torch installs this?

emremrah commented 1 year ago

There is no package named nvidia, rather than the pip collects couple of packages under nvidia folder.

And you're right, it seems like torch installs them, not setfit...

(torch_test) emre@...$ pip install torch==2.0.1
Collecting torch==2.0.1
  Using cached torch-2.0.1-cp39-cp39-manylinux1_x86_64.whl (619.9 MB)
Collecting filelock (from torch==2.0.1)
  Obtaining dependency information for filelock from https://files.pythonhosted.org/packages/5e/5d/97afbafd9d584ff1b45fcb354a479a3609bd97f912f8f1f6c563cb1fae21/filelock-3.12.4-py3-none-any.whl.metadata
  Using cached filelock-3.12.4-py3-none-any.whl.metadata (2.8 kB)
Collecting typing-extensions (from torch==2.0.1)
  Obtaining dependency information for typing-extensions from https://files.pythonhosted.org/packages/24/21/7d397a4b7934ff4028987914ac1044d3b7d52712f30e2ac7a2ae5bc86dd0/typing_extensions-4.8.0-py3-none-any.whl.metadata
  Using cached typing_extensions-4.8.0-py3-none-any.whl.metadata (3.0 kB)
Collecting sympy (from torch==2.0.1)
  Using cached sympy-1.12-py3-none-any.whl (5.7 MB)
Collecting networkx (from torch==2.0.1)
  Using cached networkx-3.1-py3-none-any.whl (2.1 MB)
Collecting jinja2 (from torch==2.0.1)
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting nvidia-cuda-nvrtc-cu11==11.7.99 (from torch==2.0.1)
  Using cached nvidia_cuda_nvrtc_cu11-11.7.99-2-py3-none-manylinux1_x86_64.whl (21.0 MB)
Collecting nvidia-cuda-runtime-cu11==11.7.99 (from torch==2.0.1)
  Using cached nvidia_cuda_runtime_cu11-11.7.99-py3-none-manylinux1_x86_64.whl (849 kB)
Collecting nvidia-cuda-cupti-cu11==11.7.101 (from torch==2.0.1)
  Using cached nvidia_cuda_cupti_cu11-11.7.101-py3-none-manylinux1_x86_64.whl (11.8 MB)
Collecting nvidia-cudnn-cu11==8.5.0.96 (from torch==2.0.1)
  Using cached nvidia_cudnn_cu11-8.5.0.96-2-py3-none-manylinux1_x86_64.whl (557.1 MB)
Collecting nvidia-cublas-cu11==11.10.3.66 (from torch==2.0.1)
  Using cached nvidia_cublas_cu11-11.10.3.66-py3-none-manylinux1_x86_64.whl (317.1 MB)
Collecting nvidia-cufft-cu11==10.9.0.58 (from torch==2.0.1)
  Using cached nvidia_cufft_cu11-10.9.0.58-py3-none-manylinux1_x86_64.whl (168.4 MB)
Collecting nvidia-curand-cu11==10.2.10.91 (from torch==2.0.1)
  Using cached nvidia_curand_cu11-10.2.10.91-py3-none-manylinux1_x86_64.whl (54.6 MB)
Collecting nvidia-cusolver-cu11==11.4.0.1 (from torch==2.0.1)
  Using cached nvidia_cusolver_cu11-11.4.0.1-2-py3-none-manylinux1_x86_64.whl (102.6 MB)
Collecting nvidia-cusparse-cu11==11.7.4.91 (from torch==2.0.1)
  Using cached nvidia_cusparse_cu11-11.7.4.91-py3-none-manylinux1_x86_64.whl (173.2 MB)
Collecting nvidia-nccl-cu11==2.14.3 (from torch==2.0.1)
  Using cached nvidia_nccl_cu11-2.14.3-py3-none-manylinux1_x86_64.whl (177.1 MB)
Collecting nvidia-nvtx-cu11==11.7.91 (from torch==2.0.1)
  Using cached nvidia_nvtx_cu11-11.7.91-py3-none-manylinux1_x86_64.whl (98 kB)
Collecting triton==2.0.0 (from torch==2.0.1)
  Using cached triton-2.0.0-1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (63.3 MB)
Requirement already satisfied: setuptools in /home/emre/miniconda3/envs/torch_test/lib/python3.9/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch==2.0.1) (68.0.0)
Requirement already satisfied: wheel in /home/emre/miniconda3/envs/torch_test/lib/python3.9/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch==2.0.1) (0.38.4)
Collecting cmake (from triton==2.0.0->torch==2.0.1)
  Obtaining dependency information for cmake from https://files.pythonhosted.org/packages/de/94/cba4b3ddc0d4555967cce8fd6e9fbced98a6bf62857db71c2400a7b6e183/cmake-3.27.5-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata
  Using cached cmake-3.27.5-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (6.7 kB)
Collecting lit (from triton==2.0.0->torch==2.0.1)
  Using cached lit-16.0.6-py3-none-any.whl
Collecting MarkupSafe>=2.0 (from jinja2->torch==2.0.1)
  Obtaining dependency information for MarkupSafe>=2.0 from https://files.pythonhosted.org/packages/de/63/cb7e71984e9159ec5f45b5e81e896c8bdd0e45fe3fc6ce02ab497f0d790e/MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB)
Collecting mpmath>=0.19 (from sympy->torch==2.0.1)
  Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Using cached filelock-3.12.4-py3-none-any.whl (11 kB)
Using cached typing_extensions-4.8.0-py3-none-any.whl (31 kB)
Using cached MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Using cached cmake-3.27.5-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (26.1 MB)
Installing collected packages: mpmath, lit, cmake, typing-extensions, sympy, nvidia-nvtx-cu11, nvidia-nccl-cu11, nvidia-cusparse-cu11, nvidia-curand-cu11, nvidia-cufft-cu11, nvidia-cuda-runtime-cu11, nvidia-cuda-nvrtc-cu11, nvidia-cuda-cupti-cu11, nvidia-cublas-cu11, networkx, MarkupSafe, filelock, nvidia-cusolver-cu11, nvidia-cudnn-cu11, jinja2, triton, torch
Successfully installed MarkupSafe-2.1.3 cmake-3.27.5 filelock-3.12.4 jinja2-3.1.2 lit-16.0.6 mpmath-1.3.0 networkx-3.1 nvidia-cublas-cu11-11.10.3.66 nvidia-cuda-cupti-cu11-11.7.101 nvidia-cuda-nvrtc-cu11-11.7.99 nvidia-cuda-runtime-cu11-11.7.99 nvidia-cudnn-cu11-8.5.0.96 nvidia-cufft-cu11-10.9.0.58 nvidia-curand-cu11-10.2.10.91 nvidia-cusolver-cu11-11.4.0.1 nvidia-cusparse-cu11-11.7.4.91 nvidia-nccl-cu11-2.14.3 nvidia-nvtx-cu11-11.7.91 sympy-1.12 torch-2.0.1 triton-2.0.0 typing-extensions-4.8.0
tomaarsen commented 1 year ago

I see! I don't think there's getting around it then. Perhaps there's a torch-lite or something, but I'm not very confident.

emremrah commented 1 year ago

In torch there is a "no-cuda" option here: https://pytorch.org/get-started/locally/#no-cuda

But even if I install it, the torch package (which defaults to CUDA version) is in requirements of sentence-transformers, transformers etc.

Do you know if I install no-cuda version beforehand, when installing these packages, will pip skip installing torch? I'm going to try this and let you know.

tomaarsen commented 1 year ago

I think those third party dependencies only require the "regular" torch, not specifically torch with CUDA support. So I think it should be possible to install torch without CUDA and have everything still work. I'm not quite sure how big the dependencies become then though.

toppev commented 1 year ago

In my Dockerfile I installed the non-CUDA torch first (and torchvision) RUN pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu And after that setfit/sentencetransformers/whatever from my requirements.txt and that results in much smaller image size

tomaarsen commented 1 year ago

I think installing a minimal, cpu only, torch before any other packages should indeed work. The torch requirement will then be satisfied and it won't be installed with cuda anymore.

I'll close this for now.