Skip to content

Commit 4bf6086

Browse files
pmeierfmassa
andauthored
add torchdata as prototype dependency (#4499)
* add torchdata as prototype dependency * ignore torchdata for mypy * move git dependency out of conda environment file * try unsetting PYTORCH_VERSION env var * cleanup * move installation of torchdata after installtion of PyTorch * regenerate circlci config * remove branch from torchdata download link Co-authored-by: Francisco Massa <[email protected]>
1 parent f749835 commit 4bf6086

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.circleci/config.yml.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ jobs:
200200
pip install --user --progress-bar off mypy
201201
pip install --user --progress-bar off types-requests
202202
pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
203+
pip install --user --progress-bar off git+https://github.com/pytorch/data.git
203204
pip install --user --progress-bar off --editable .
204205
mypy --config-file mypy.ini
205206

.circleci/unittest/linux/scripts/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ fi
2626
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
2727
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest
2828

29+
printf "Installing torchdata from source"
30+
pip install git+https://github.com/pytorch/data.git
31+
32+
2933
if [ $PYTHON_VERSION == "3.6" ]; then
3034
printf "Installing minimal PILLOW version\n"
3135
# Install the minimal PILLOW version. Otherwise, let setup.py install the latest

.circleci/unittest/windows/scripts/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}"
2929
# conda-forge channel is required for cudatoolkit 11.1 on Windows, see https://github.com/pytorch/vision/issues/4458
3030
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest
3131

32+
printf "Installing torchdata from source"
33+
pip install git+https://github.com/pytorch/data.git
34+
35+
3236
if [ $PYTHON_VERSION == "3.6" ]; then
3337
printf "Installing minimal PILLOW version\n"
3438
# Install the minimal PILLOW version. Otherwise, let setup.py install the latest

mypy.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ ignore_missing_imports = True
6767
[mypy-defusedxml.*]
6868

6969
ignore_missing_imports = True
70+
71+
[mypy-torchdata.*]
72+
73+
ignore_missing_imports = True

torchvision/prototype/datasets/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
try:
2+
import torchdata
3+
except (ModuleNotFoundError, TypeError) as error:
4+
raise ModuleNotFoundError(
5+
"`torchvision.prototype.datasets` depends on PyTorch's `torchdata` (https://github.com/pytorch/data). "
6+
"You can install it with `pip install git+https://github.com/pytorch/data.git`. "
7+
"Note that you cannot install it with `pip install torchdata`, since this is another package."
8+
) from error
9+
10+
111
from ._home import home
212
from . import decoder, utils
313

0 commit comments

Comments
 (0)