diff --git a/.github/workflows/fork-smoke.yml b/.github/workflows/fork-smoke.yml new file mode 100644 index 00000000000..cc1b438b33a --- /dev/null +++ b/.github/workflows/fork-smoke.yml @@ -0,0 +1,30 @@ +name: Fork Smoke Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + smoke-test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.12] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + - name: Run smoke test + run: | + python -c "import torchvision; print(torchvision.__version__)" diff --git a/.gitignore b/.gitignore index c2d4d2a1c42..149c9358f68 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,7 @@ xcuserdata/ .envrc scripts/release_notes/data.json +.aider* + +__pycache__/ +.pytest_cache/ diff --git a/FORK.md b/FORK.md new file mode 100644 index 00000000000..618e9602c2e --- /dev/null +++ b/FORK.md @@ -0,0 +1,14 @@ +# Nueramarcos Fork of torchvision + +Personal fork of [pytorch/vision](https://github.com/pytorch/vision). + +## Install + +```bash +git clone https://github.com/Nueramarcos/vision.git +cd vision +pip install -e . +python -c "import torchvision; print(torchvision.__version__)" +``` + +Maintained by [Nueramarcos](https://github.com/Nueramarcos). diff --git a/README.md b/README.md index d861bca97cc..5be25012b0f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # torchvision +## Fork Notice + +Maintained by [Nueramarcos](https://github.com/Nueramarcos). See [FORK.md](FORK.md). + +[![License](https://img.shields.io/github/license/pytorch/vision)](https://github.com/pytorch/vision/blob/main/LICENSE) +[![Language](https://img.shields.io/github/languages/top/pytorch/vision?color=blue)](https://github.com/pytorch/vision/search?q=language:) +[![Fork Smoke](https://github.com/Nueramarcos/vision/actions/workflows/fork-smoke.yml/badge.svg)](https://github.com/Nueramarcos/vision/actions/workflows/fork-smoke.yml) + [![total torchvision downloads](https://pepy.tech/badge/torchvision)](https://pepy.tech/project/torchvision) [![documentation](https://img.shields.io/badge/dynamic/json.svg?label=docs&url=https%3A%2F%2Fpypi.org%2Fpypi%2Ftorchvision%2Fjson&query=%24.info.version&colorB=brightgreen&prefix=v)](https://pytorch.org/vision/stable/index.html) @@ -27,7 +35,6 @@ versions. | `2.9` | `0.24` | `>=3.10`, `<=3.14` | | `2.8` | `0.23` | `>=3.9`, `<=3.13` | | `2.7` | `0.22` | `>=3.9`, `<=3.13` | -| `2.6` | `0.21` | `>=3.9`, `<=3.12` |
older versions @@ -66,7 +73,7 @@ Torchvision currently supports the following image backends: - [Pillow](https://python-pillow.org/) - [Pillow-SIMD](https://github.com/uploadcare/pillow-simd) - a **much faster** drop-in replacement for Pillow with SIMD. -Read more in in our [docs](https://pytorch.org/vision/stable/transforms.html). +Read more in our [docs](https://pytorch.org/vision/stable/transforms.html). ## Documentation @@ -109,3 +116,4 @@ If you find TorchVision useful in your work, please consider citing the followin howpublished = {\url{https://github.com/pytorch/vision}} } ``` +``` \ No newline at end of file diff --git a/torchvision/datasets/sun397.py b/torchvision/datasets/sun397.py index a27f86d9579..a49ce3dd877 100644 --- a/torchvision/datasets/sun397.py +++ b/torchvision/datasets/sun397.py @@ -1,5 +1,6 @@ from pathlib import Path from typing import Any, Callable, Optional, Union +from urllib.error import URLError from .folder import default_loader @@ -26,8 +27,11 @@ class SUN397(VisionDataset): ``torchvision.io.decode_image`` for decoding image data into tensors directly. """ - _DATASET_URL = "http://vision.princeton.edu/projects/2010/SUN/SUN397.tar.gz" _DATASET_MD5 = "8ca2778205c41d23104230ba66911c7a" + _DATASET_MIRRORS = ( + "https://vision.princeton.edu/projects/2010/SUN/SUN397.tar.gz", + "http://vision.princeton.edu/projects/2010/SUN/SUN397.tar.gz", + ) def __init__( self, @@ -78,4 +82,22 @@ def _check_exists(self) -> bool: def _download(self) -> None: if self._check_exists(): return - download_and_extract_archive(self._DATASET_URL, download_root=self.root, md5=self._DATASET_MD5) + + errors: list[BaseException] = [] + for url in self._DATASET_MIRRORS: + try: + download_and_extract_archive(url, download_root=self.root, md5=self._DATASET_MD5) + return + except (RuntimeError, URLError) as err: + errors.append(err) + + msg = "Error downloading SUN397:\n" + for url, err in zip(self._DATASET_MIRRORS, errors): + msg += f"Tried {url}, got:\n{err}\n" + msg += ( + "The Princeton and MIT mirrors for SUN397 are currently unavailable. " + "Download the archive manually and extract it under /SUN397/. " + "See https://github.com/pytorch/vision/issues/9348 and " + "https://github.com/pytorch/vision/issues/7637 (dataset mirroring)." + ) + raise RuntimeError(msg)