Skip to content

Commit

Permalink
Merge branch 'main' into opcheck-nms
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug authored Oct 19, 2023
2 parents b8c5f52 + e3fb8c0 commit 0eb13d2
Show file tree
Hide file tree
Showing 40 changed files with 5,566 additions and 8,371 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
runner: ${{ matrix.runner }}
gpu-arch-type: ${{ matrix.gpu-arch-type }}
gpu-arch-version: ${{ matrix.gpu-arch-version }}
test-infra-ref: main
script: |
set -euo pipefail
Expand All @@ -46,6 +47,7 @@ jobs:
with:
repository: pytorch/vision
runner: ${{ matrix.runner }}
test-infra-ref: main
script: |
set -euo pipefail
Expand All @@ -71,6 +73,7 @@ jobs:
runner: ${{ matrix.runner }}
gpu-arch-type: ${{ matrix.gpu-arch-type }}
gpu-arch-version: ${{ matrix.gpu-arch-version }}
test-infra-ref: main
script: |
set -euo pipefail
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ jobs:
with:
repository: pytorch/vision
upload-artifact: docs
test-infra-ref: main
script: |
set -euo pipefail
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
# Prepare conda
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
Expand All @@ -36,13 +37,13 @@ jobs:
# Should we maybe always do this in `./.github/scripts/setup-env.sh` so that we don't
# have to pay attention in all other workflows?
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
cd docs
echo '::group::Install doc requirements'
pip install --progress-bar=off -r requirements.txt
echo '::endgroup::'
if [[ ${{ github.event_name }} == push && (${{ github.ref_type }} == tag || (${{ github.ref_type }} == branch && ${{ github.ref_name }} == release/*)) ]]; then
echo '::group::Enable version string sanitization'
# This environment variable just has to exist and must not be empty. The actual value is arbitrary.
Expand All @@ -66,9 +67,9 @@ jobs:
cp $file build/html/_generated_ipynb_notebooks/
fi
done
cp -r build/html "${RUNNER_ARTIFACT_DIR}"
# On PRs we also want to upload the docs into our S3 bucket for preview.
if [[ ${{ github.event_name == 'pull_request' }} ]]; then
cp -r build/html/* "${RUNNER_DOCS_DIR}"
Expand All @@ -85,9 +86,10 @@ jobs:
repository: pytorch/vision
download-artifact: docs
ref: gh-pages
test-infra-ref: main
script: |
set -euo pipefail
REF_TYPE=${{ github.ref_type }}
REF_NAME=${{ github.ref_name }}
Expand All @@ -112,14 +114,14 @@ jobs:
rm -rf "${TARGET_FOLDER}"/*
mv "${RUNNER_ARTIFACT_DIR}"/html/* "${TARGET_FOLDER}"
git add "${TARGET_FOLDER}" || true
if [[ "${TARGET_FOLDER}" == main ]]; then
mkdir -p _static
rm -rf _static/*
cp -r "${TARGET_FOLDER}"/_static/* _static
git add _static || true
fi
git config user.name 'pytorchbot'
git config user.email '[email protected]'
git config http.postBuffer 524288000
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
test-infra-ref: main
script: |
set -euo pipefail
Expand All @@ -23,14 +24,14 @@ jobs:
conda create --name ci --quiet --yes python=3.8 pip
conda activate ci
echo '::endgroup::'
echo '::group::Install lint tools'
pip install --progress-bar=off pre-commit
echo '::endgroup::'
set +e
pre-commit run --all-files
if [ $? -ne 0 ]; then
git --no-pager diff
exit 1
Expand All @@ -40,9 +41,10 @@ jobs:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
test-infra-ref: main
script: |
set -euo pipefail
echo '::group::Setup environment'
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
Expand All @@ -53,7 +55,7 @@ jobs:
conda activate ci
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
echo '::endgroup::'
echo '::group::Install lint tools'
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o ./clang-format
chmod +x ./clang-format
Expand All @@ -62,7 +64,7 @@ jobs:
echo '::group::Lint C source'
set +e
./.github/scripts/run-clang-format.py -r torchvision/csrc --clang-format-executable ./clang-format
if [ $? -ne 0 ]; then
git --no-pager diff
exit 1
Expand All @@ -74,23 +76,24 @@ jobs:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
test-infra-ref: main
script: |
set -euo pipefail
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda activate ci
echo '::group::Install lint tools'
pip install --progress-bar=off mypy
echo '::endgroup::'
echo '::group::Lint Python types'
mypy --install-types --non-interactive --config-file mypy.ini
echo '::endgroup::'
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
gpu-arch-type: ${{ matrix.gpu-arch-type }}
gpu-arch-version: ${{ matrix.gpu-arch-version }}
timeout: 120
test-infra-ref: main
script: |
set -euo pipefail
Expand All @@ -41,7 +42,7 @@ jobs:
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
./.github/scripts/unittest.sh
unittests-macos:
strategy:
matrix:
Expand All @@ -62,6 +63,7 @@ jobs:
# and needs roughly 2 hours to just run the test suite
timeout: 240
runner: ${{ matrix.runner }}
test-infra-ref: main
script: |
set -euo pipefail
Expand Down Expand Up @@ -94,6 +96,7 @@ jobs:
gpu-arch-type: ${{ matrix.gpu-arch-type }}
gpu-arch-version: ${{ matrix.gpu-arch-version }}
timeout: 120
test-infra-ref: main
script: |
set -euxo pipefail
Expand All @@ -102,13 +105,14 @@ jobs:
export VSDEVCMD_ARGS=""
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
./.github/scripts/unittest.sh
onnx:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
test-infra-ref: main
script: |
set -euo pipefail
Expand All @@ -117,20 +121,20 @@ jobs:
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
# Prepare conda
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda activate ci
echo '::group::Install ONNX'
pip install --progress-bar=off onnx onnxruntime
echo '::endgroup::'
echo '::group::Install testing utilities'
pip install --progress-bar=off pytest
echo '::endgroup::'
echo '::group::Run ONNX tests'
pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 test/test_onnx.py
echo '::endgroup::'
Expand All @@ -139,6 +143,7 @@ jobs:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
test-infra-ref: main
script: |
set -euo pipefail
Expand All @@ -147,21 +152,21 @@ jobs:
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
# Prepare conda
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda activate ci
echo '::group::Pre-download model weights'
pip install --progress-bar=off aiohttp aiofiles tqdm
python scripts/download_model_urls.py
echo '::endgroup::'
echo '::group::Install testing utilities'
pip install --progress-bar=off pytest
echo '::endgroup::'
echo '::group::Run extended unittests'
export PYTORCH_TEST_WITH_EXTENDED=1
pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 test/test_extended_*.py
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update-viablestrict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
with:
repository: pytorch/vision
required_checks: "Build Linux,Build M1,Build Macos,Build Windows,Tests,CMake,Lint,Docs"
test-infra-ref: main
secrets:
ROCKSET_API_KEY: ${{ secrets.ROCKSET_API_KEY }}
GITHUB_DEPLOY_KEY : ${{ secrets.VISION_GITHUB_DEPLOY_KEY }}
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,5 @@ please read [GitHub's guides](https://docs.github.com/en/github/collaborating-wi

By contributing to Torchvision, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.

Contributors are also required to [sign our Contributor License Agreement](https://code.facebook.com/cla).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Torchvision currently supports the following video backends:
conflicting version of ffmpeg installed. Currently, this is only supported on Linux.

```
conda install -c conda-forge ffmpeg
conda install -c conda-forge 'ffmpeg<4.3'
python setup.py install
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def inject_weight_metadata(app, what, name, obj, options, lines):
used within the autoclass directive.
"""

if getattr(obj, ".__name__", "").endswith(("_Weights", "_QuantizedWeights")):
if getattr(obj, "__name__", "").endswith(("_Weights", "_QuantizedWeights")):

if len(obj) == 0:
lines[:] = ["There are no available pre-trained weights."]
Expand Down
2 changes: 1 addition & 1 deletion references/segmentation/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Semantic segmentation reference training scripts

This folder contains reference training scripts for semantic segmentation.
They serve as a log of how to train specific models, as provide baseline
They serve as a log of how to train specific models and provide baseline
training and evaluation scripts to quickly bootstrap research.

All models have been trained on 8x V100 GPUs.
Expand Down
Binary file modified test/assets/fakedata/draw_boxes_util.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions test/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ def make_bounding_boxes(
canvas_size=DEFAULT_SIZE,
*,
format=tv_tensors.BoundingBoxFormat.XYXY,
num_boxes=1,
dtype=None,
device="cpu",
):
Expand All @@ -419,8 +420,7 @@ def sample_position(values, max_value):

dtype = dtype or torch.float32

num_objects = 1
h, w = [torch.randint(1, c, (num_objects,)) for c in canvas_size]
h, w = [torch.randint(1, s, (num_boxes,)) for s in canvas_size]
y = sample_position(h, canvas_size[0])
x = sample_position(w, canvas_size[1])

Expand All @@ -443,12 +443,11 @@ def sample_position(values, max_value):
)


def make_detection_mask(size=DEFAULT_SIZE, *, dtype=None, device="cpu"):
def make_detection_masks(size=DEFAULT_SIZE, *, num_masks=1, dtype=None, device="cpu"):
"""Make a "detection" mask, i.e. (*, N, H, W), where each object is encoded as one of N boolean masks"""
num_objects = 1
return tv_tensors.Mask(
torch.testing.make_tensor(
(num_objects, *size),
(num_masks, *size),
low=0,
high=2,
dtype=dtype or torch.bool,
Expand Down
Loading

0 comments on commit 0eb13d2

Please sign in to comment.