Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
e59cf64b
Unverified
Commit
e59cf64b
authored
Mar 08, 2023
by
Philip Meier
Committed by
GitHub
Mar 08, 2023
Browse files
port special tests from CircleCI to GHA (#7396)
parent
91b57697
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
129 additions
and
14 deletions
+129
-14
.github/scripts/setup-env.sh
.github/scripts/setup-env.sh
+0
-8
.github/scripts/unittest.sh
.github/scripts/unittest.sh
+18
-0
.github/workflows/test-linux.yml
.github/workflows/test-linux.yml
+65
-3
.github/workflows/test-macos.yml
.github/workflows/test-macos.yml
+5
-3
scripts/download_model_urls.py
scripts/download_model_urls.py
+41
-0
No files found.
.github/
unittest
.sh
→
.github/
scripts/setup-env
.sh
View file @
e59cf64b
...
...
@@ -95,11 +95,3 @@ echo '::endgroup::'
echo
'::group::Collect PyTorch environment information'
python
-m
torch.utils.collect_env
echo
'::endgroup::'
echo
'::group::Install testing utilities'
pip
install
--progress-bar
=
off pytest pytest-mock pytest-cov
echo
'::endgroup::'
echo
'::group::Run tests'
pytest
--durations
=
25
echo
'::endgroup::'
.github/scripts/unittest.sh
0 → 100755
View file @
e59cf64b
#!/usr/bin/env bash
set
-euo
pipefail
./.github/scripts/setup-env.sh
# Prepare conda
CONDA_PATH
=
$(
which conda
)
eval
"
$(
${
CONDA_PATH
}
shell.bash hook
)
"
conda activate ci
echo
'::group::Install testing utilities'
pip
install
--progress-bar
=
off pytest pytest-mock pytest-cov
echo
'::endgroup::'
echo
'::group::Run unittests'
pytest
--durations
=
25
echo
'::endgroup::'
.github/workflows/test-linux.yml
View file @
e59cf64b
name
:
Unit-t
ests on Linux
name
:
T
ests on Linux
on
:
pull_request
:
...
...
@@ -10,7 +10,7 @@ on:
workflow_dispatch
:
jobs
:
tests
:
unit
tests
:
strategy
:
matrix
:
python-version
:
...
...
@@ -34,8 +34,70 @@ jobs:
gpu-arch-version
:
${{ matrix.gpu-arch-version }}
timeout
:
120
script
:
|
set -euo pipefail
export PYTHON_VERSION=${{ matrix.python-version }}
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
./.github/unittest.sh
./.github/scripts/unittest.sh
onnx
:
uses
:
pytorch/test-infra/.github/workflows/linux_job.yml@main
with
:
repository
:
pytorch/vision
script
:
|
set -euo pipefail
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
./.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 --durations=25 -v test/test_onnx.py
echo '::endgroup::'
unittests-extended
:
uses
:
pytorch/test-infra/.github/workflows/linux_job.yml@main
with
:
repository
:
pytorch/vision
script
:
|
set -euo pipefail
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
./.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 --durations=25 -v test/test_extended_*.py
echo '::endgroup::'
.github/workflows/test-macos.yml
View file @
e59cf64b
name
:
Unit-t
ests on macOS
name
:
T
ests on macOS
on
:
pull_request
:
...
...
@@ -10,7 +10,7 @@ on:
workflow_dispatch
:
jobs
:
tests
:
unit
tests
:
strategy
:
matrix
:
python-version
:
...
...
@@ -31,7 +31,9 @@ jobs:
timeout
:
240
runner
:
${{ matrix.runner }}
script
:
|
set -euo pipefail
export PYTHON_VERSION=${{ matrix.python-version }}
export GPU_ARCH_TYPE=cpu
./.github/unittest.sh
./.github/
scripts/
unittest.sh
scripts/download_model_urls.py
0 → 100644
View file @
e59cf64b
import
asyncio
import
sys
from
pathlib
import
Path
from
time
import
perf_counter
from
urllib.parse
import
urlsplit
import
aiofiles
import
aiohttp
from
torchvision
import
models
from
tqdm.asyncio
import
tqdm
async
def
main
(
download_root
):
download_root
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
urls
=
{
weight
.
url
for
name
in
models
.
list_models
()
for
weight
in
iter
(
models
.
get_model_weights
(
name
))}
async
with
aiohttp
.
ClientSession
(
timeout
=
aiohttp
.
ClientTimeout
(
total
=
None
))
as
session
:
await
tqdm
.
gather
(
*
[
download
(
download_root
,
session
,
url
)
for
url
in
urls
])
async
def
download
(
download_root
,
session
,
url
):
response
=
await
session
.
get
(
url
,
params
=
dict
(
source
=
"ci"
))
assert
response
.
ok
file_name
=
Path
(
urlsplit
(
url
).
path
).
name
async
with
aiofiles
.
open
(
download_root
/
file_name
,
"wb"
)
as
f
:
async
for
data
in
response
.
content
.
iter_any
():
await
f
.
write
(
data
)
if
__name__
==
"__main__"
:
download_root
=
(
(
Path
(
sys
.
argv
[
1
])
if
len
(
sys
.
argv
)
>
1
else
Path
(
"~/.cache/torch/hub/checkpoints"
)).
expanduser
().
resolve
()
)
print
(
f
"Downloading model weights to
{
download_root
}
"
)
start
=
perf_counter
()
asyncio
.
get_event_loop
().
run_until_complete
(
main
(
download_root
))
stop
=
perf_counter
()
minutes
,
seconds
=
divmod
(
stop
-
start
,
60
)
print
(
f
"Download took
{
minutes
:
2.0
f
}
m
{
seconds
:
2.0
f
}
s"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment