Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/fork-smoke.yml
Original file line number Diff line number Diff line change
@@ -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__)"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ xcuserdata/
.envrc

scripts/release_notes/data.json
.aider*

__pycache__/
.pytest_cache/
14 changes: 14 additions & 0 deletions FORK.md
Original file line number Diff line number Diff line change
@@ -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).
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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` |

<details>
<summary>older versions</summary>
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -109,3 +116,4 @@ If you find TorchVision useful in your work, please consider citing the followin
howpublished = {\url{https://github.com/pytorch/vision}}
}
```
```
26 changes: 24 additions & 2 deletions torchvision/datasets/sun397.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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,
Expand Down Expand Up @@ -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 <root>/SUN397/. "
"See https://github.com/pytorch/vision/issues/9348 and "
"https://github.com/pytorch/vision/issues/7637 (dataset mirroring)."
)
raise RuntimeError(msg)