Skip to content

Commit d435378

Browse files
authored
Merge branch 'main' into prototype-references/classification
2 parents 959af2d + b1f6c9e commit d435378

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1514
-403
lines changed

.circleci/config.yml

Lines changed: 0 additions & 10 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: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,6 @@ commands:
152152
args: --no-build-isolation <<# parameters.editable >> --editable <</ parameters.editable >> .
153153
descr: Install torchvision <<# parameters.editable >> in editable mode <</ parameters.editable >>
154154

155-
install_prototype_dependencies:
156-
steps:
157-
- pip_install:
158-
args: iopath
159-
descr: Install third-party dependencies
160-
- pip_install:
161-
args: --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu
162-
descr: Install torchdata from nightly releases
163-
164155
# Most of the test suite is handled by the `unittest` jobs, with completely different workflow and setup.
165156
# This command can be used if only a selection of tests need to be run, for ad-hoc files.
166157
run_tests_selective:
@@ -326,7 +317,6 @@ jobs:
326317
- checkout
327318
- install_torchvision:
328319
editable: true
329-
- install_prototype_dependencies
330320
- pip_install:
331321
args: mypy
332322
descr: Install Python type check utilities

.github/workflows/build-conda-m1.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build M1 Conda
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- nightly
8+
workflow_dispatch:
9+
10+
jobs:
11+
generate-matrix:
12+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
13+
with:
14+
package-type: conda
15+
os: macos-arm64
16+
test-infra-repository: pytorch/test-infra
17+
test-infra-ref: main
18+
build:
19+
needs: generate-matrix
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- repository: pytorch/vision
25+
pre-script: ""
26+
post-script: ""
27+
conda-package-directory: packaging/torchvision
28+
smoke-test-script: test/smoke_test.py
29+
package-name: torchvision
30+
name: ${{ matrix.repository }}
31+
uses: pytorch/test-infra/.github/workflows/build_conda_macos.yml@main
32+
with:
33+
conda-package-directory: ${{ matrix.conda-package-directory }}
34+
repository: ${{ matrix.repository }}
35+
ref: ""
36+
test-infra-repository: pytorch/test-infra
37+
test-infra-ref: main
38+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
39+
pre-script: ${{ matrix.pre-script }}
40+
post-script: ${{ matrix.post-script }}
41+
package-name: ${{ matrix.package-name }}
42+
smoke-test-script: ${{ matrix.smoke-test-script }}
43+
runner-type: macos-m1-12
44+
# Using "development" as trigger event so these binaries are not uploaded
45+
# to official channels yet
46+
trigger-event: development
47+
secrets:
48+
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build Macos Conda
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- nightly
8+
workflow_dispatch:
9+
10+
jobs:
11+
generate-matrix:
12+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
13+
with:
14+
package-type: conda
15+
os: macos
16+
test-infra-repository: pytorch/test-infra
17+
test-infra-ref: main
18+
build:
19+
needs: generate-matrix
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- repository: pytorch/vision
25+
pre-script: ""
26+
post-script: ""
27+
conda-package-directory: packaging/torchvision
28+
smoke-test-script: test/smoke_test.py
29+
package-name: torchvision
30+
name: ${{ matrix.repository }}
31+
uses: pytorch/test-infra/.github/workflows/build_conda_macos.yml@main
32+
with:
33+
conda-package-directory: ${{ matrix.conda-package-directory }}
34+
repository: ${{ matrix.repository }}
35+
ref: ""
36+
test-infra-repository: pytorch/test-infra
37+
test-infra-ref: main
38+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
39+
pre-script: ${{ matrix.pre-script }}
40+
post-script: ${{ matrix.post-script }}
41+
package-name: ${{ matrix.package-name }}
42+
smoke-test-script: ${{ matrix.smoke-test-script }}
43+
runner-type: macos-12
44+
# Using "development" as trigger event so these binaries are not uploaded
45+
# to official channels yet
46+
trigger-event: development
47+
secrets:
48+
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}

.github/workflows/prototype-tests.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ jobs:
2828
uses: actions/checkout@v3
2929

3030
- name: Install PyTorch nightly builds
31-
run: pip install --progress-bar=off --pre torch torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu/
31+
run: pip install --progress-bar=off --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu/
3232

3333
- name: Install torchvision
3434
run: pip install --progress-bar=off --no-build-isolation --editable .
3535

3636
- name: Install other prototype dependencies
37-
run: pip install --progress-bar=off scipy pycocotools h5py iopath
37+
run: pip install --progress-bar=off scipy pycocotools h5py
3838

3939
- name: Install test requirements
4040
run: pip install --progress-bar=off pytest pytest-mock pytest-cov
@@ -52,16 +52,6 @@ jobs:
5252
--cov-report=term-missing \
5353
test/test_prototype_features*.py
5454
55-
- name: Run prototype datasets tests
56-
if: success() || ( failure() && steps.setup.conclusion == 'success' )
57-
shell: bash
58-
run: |
59-
pytest \
60-
--durations=20 \
61-
--cov=torchvision/prototype/datasets \
62-
--cov-report=term-missing \
63-
test/test_prototype_datasets*.py
64-
6555
- name: Run prototype transforms tests
6656
if: success() || ( failure() && steps.setup.conclusion == 'success' )
6757
shell: bash

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ supported Python versions.
2121
+--------------------------+--------------------------+---------------------------------+
2222
| ``torch`` | ``torchvision`` | ``python`` |
2323
+==========================+==========================+=================================+
24-
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.7``, ``<=3.10`` |
24+
| ``main`` / ``nightly`` | ``main`` / ``nightly`` | ``>=3.7.2``, ``<=3.10`` |
2525
+--------------------------+--------------------------+---------------------------------+
26-
| ``1.13.0`` | ``0.14.0`` | ``>=3.7``, ``<=3.10`` |
26+
| ``1.13.0`` | ``0.14.0`` | ``>=3.7.2``, ``<=3.10`` |
2727
+--------------------------+--------------------------+---------------------------------+
2828
| ``1.12.0`` | ``0.13.0`` | ``>=3.7``, ``<=3.10`` |
2929
+--------------------------+--------------------------+---------------------------------+

docs/source/conf.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,14 @@ def inject_weight_metadata(app, what, name, obj, options, lines):
362362
max_visible = 3
363363
v_sample = ", ".join(v[:max_visible])
364364
v = f"{v_sample}, ... ({len(v)-max_visible} omitted)" if len(v) > max_visible else v_sample
365+
elif k == "_ops":
366+
if obj.__name__.endswith("_QuantizedWeights"):
367+
v = f"{v} giga instructions per sec"
368+
else:
369+
v = f"{v} giga floating-point operations per sec"
370+
elif k == "_weight_size":
371+
v = f"{v} MB (file size)"
372+
365373
table.append((str(k), str(v)))
366374
table = tabulate(table, tablefmt="rst")
367375
lines += [".. rst-class:: table-weights"] # Custom CSS class, see custom_torchvision.css
@@ -385,27 +393,38 @@ def generate_weights_table(module, table_name, metrics, dataset, include_pattern
385393
if exclude_patterns is not None:
386394
weights = [w for w in weights if all(p not in str(w) for p in exclude_patterns)]
387395

396+
ops_name = "GIPS" if "QuantizedWeights" in weights_endswith else "GFLOPS"
397+
388398
metrics_keys, metrics_names = zip(*metrics)
389-
column_names = ["Weight"] + list(metrics_names) + ["Params", "Recipe"]
399+
column_names = (
400+
["Weight"] + list(metrics_names) + ["Params"] + [ops_name, "Size (MB)", "Recipe"]
401+
) # Final column order
390402
column_names = [f"**{name}**" for name in column_names] # Add bold
391403

392-
content = [
393-
(
404+
content = []
405+
for w in weights:
406+
row = [
394407
f":class:`{w} <{type(w).__name__}>`",
395408
*(w.meta["_metrics"][dataset][metric] for metric in metrics_keys),
396409
f"{w.meta['num_params']/1e6:.1f}M",
410+
f"{w.meta['_ops']:.3f}",
411+
f"{round(w.meta['_weight_size'], 1):.1f}",
397412
f"`link <{w.meta['recipe']}>`__",
398-
)
399-
for w in weights
400-
]
413+
]
414+
415+
content.append(row)
416+
417+
column_widths = ["110"] + ["18"] * len(metrics_names) + ["18"] * 3 + ["10"]
418+
widths_table = " ".join(column_widths)
419+
401420
table = tabulate(content, headers=column_names, tablefmt="rst")
402421

403422
generated_dir = Path("generated")
404423
generated_dir.mkdir(exist_ok=True)
405424
with open(generated_dir / f"{table_name}_table.rst", "w+") as table_file:
406425
table_file.write(".. rst-class:: table-weights\n") # Custom CSS class, see custom_torchvision.css
407426
table_file.write(".. table::\n")
408-
table_file.write(f" :widths: 100 {'20 ' * len(metrics_names)} 20 10\n\n")
427+
table_file.write(f" :widths: {widths_table} \n\n")
409428
table_file.write(f"{textwrap.indent(table, ' ' * 4)}\n\n")
410429

411430

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def run(self):
546546
"scipy": ["scipy"],
547547
},
548548
ext_modules=get_extensions(),
549-
python_requires=">=3.7",
549+
python_requires=">=3.7.2",
550550
cmdclass={
551551
"build_ext": BuildExtension.with_options(no_python_abi_suffix=True),
552552
"clean": clean,

0 commit comments

Comments
 (0)