Replace the ubuntu-18.04 with 22.04 in CI (#2793)

pull/2789/head^2
Zaida Zhou 2023-05-11 14:03:24 +08:00 committed by GitHub
parent 595f8fdff3
commit 883d339cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 138 additions and 73 deletions

View File

@ -48,9 +48,9 @@ jobs:
pyenv install << parameters.python >> pyenv install << parameters.python >>
pyenv global << parameters.python >> pyenv global << parameters.python >>
- run: - run:
name: Upgrade pip name: Upgrade pip and wheel
command: | command: |
python -m pip install pip --upgrade python -m pip install pip wheel --upgrade
- run: - run:
name: Install PyTorch name: Install PyTorch
command: python -m pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html command: python -m pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
@ -62,7 +62,7 @@ jobs:
command: | command: |
rm -rf .eggs rm -rf .eggs
python setup.py check -m -s python setup.py check -m -s
python -m pip install -e . python -m pip install -e . -v
no_output_timeout: 20m no_output_timeout: 20m
environment: environment:
MMCV_WITH_OPS: 1 MMCV_WITH_OPS: 1
@ -116,9 +116,9 @@ jobs:
pyenv install 3.7.0 pyenv install 3.7.0
pyenv global 3.7.0 pyenv global 3.7.0
- run: - run:
name: Upgrade pip name: Upgrade pip and wheel
command: | command: |
python -m pip install pip --upgrade python -m pip install pip wheel --upgrade
- run: - run:
name: Install PyTorch name: Install PyTorch
command: python -m pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 -f https://download.pytorch.org/whl/torch_stable.html command: python -m pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 -f https://download.pytorch.org/whl/torch_stable.html
@ -139,7 +139,7 @@ jobs:
command: | command: |
rm -rf .eggs rm -rf .eggs
python setup.py check -m -s python setup.py check -m -s
python -m pip install -e . python -m pip install -e . -v
environment: environment:
MMCV_WITH_OPS: 1 MMCV_WITH_OPS: 1
MMCV_WITH_ORT: 1 MMCV_WITH_ORT: 1

View File

@ -28,7 +28,7 @@ env:
jobs: jobs:
build_without_torch: build_without_torch:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
python-version: [3.7] python-version: [3.7]
@ -38,6 +38,8 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Upgrade pip and wheel
run: pip install pip wheel --upgrade
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Build and install - name: Build and install
@ -65,7 +67,7 @@ jobs:
--ignore=tests/test_utils/test_torch_ops.py --ignore=tests/test_utils/test_torch_ops.py
build_without_ops: build_without_ops:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
env: env:
MMCV_WITH_OPS: 0 MMCV_WITH_OPS: 0
strategy: strategy:
@ -85,12 +87,14 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Upgrade pip and wheel
run: pip install pip wheel --upgrade
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Install PyTorch - name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Build and install - name: Build and install
run: rm -rf .eggs && pip install -e . run: rm -rf .eggs && pip install -e . -v
- name: Validate the installation - name: Validate the installation
run: python -c "import mmcv" run: python -c "import mmcv"
- name: Run unittests - name: Run unittests
@ -99,7 +103,7 @@ jobs:
pytest tests/ --ignore=tests/test_ops pytest tests/ --ignore=tests/test_ops
build_cpu: build_cpu:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
python-version: [3.7] python-version: [3.7]
@ -121,13 +125,14 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Upgrade pip and wheel
run: pip install pip wheel --upgrade
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Install PyTorch - name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
# pstuil is an optional package to detect the number of CPU for compiling mmcv - name: Install ninja to speed the compilation
- name: Install psutil run: pip install ninja psutil
run: pip install psutil
- name: Create sdist and untar - name: Create sdist and untar
run: | run: |
MMCV_WITH_OPS=1 python setup.py sdist MMCV_WITH_OPS=1 python setup.py sdist
@ -136,7 +141,7 @@ jobs:
- name: Build and install from sdist - name: Build and install from sdist
run: | run: |
pushd /tmp/mmcv-full* pushd /tmp/mmcv-full*
pip install -e . pip install -e . -v
popd popd
- name: Validate the installation - name: Validate the installation
run: python -c "import mmcv" run: python -c "import mmcv"
@ -148,7 +153,7 @@ jobs:
coverage report -m coverage report -m
build_cu101: build_cu101:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
container: container:
image: pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel image: pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel
env: env:
@ -182,36 +187,32 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Upgrade pip and wheel
run: pip install pip wheel --upgrade
- name: Fetch GPG keys - name: Fetch GPG keys
run: | run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Install python-dev - name: Install python-dev
run: apt-get update && apt-get install -y python${{matrix.python-version}}-dev run: apt-get update && apt-get install -y python${{matrix.python-version}}-dev
if: ${{matrix.python-version != '3.9'}} if: ${{matrix.python-version == '3.6'}}
- name: Install Pillow
run: python -m pip install Pillow==6.2.2
if: ${{matrix.torchvision == '0.4.2'}}
# When we use a third-party container, we need to add python -m to call
# the user-installed pip when we use the pip command, otherwise it will
# call the system pip
- name: Install PyTorch - name: Install PyTorch
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies - name: Install system dependencies
run: apt-get update && apt-get install -y ffmpeg libturbojpeg ninja-build run: apt-get update && apt-get install -y ffmpeg libturbojpeg ninja-build
- name: Install dependencies for compiling onnx when python=3.9 - name: Install dependencies for compiling onnx when python=3.9
run: python -m pip install protobuf && apt-get -y install libprotobuf-dev protobuf-compiler cmake run: pip install protobuf && apt-get -y install libprotobuf-dev protobuf-compiler cmake
if: ${{matrix.python-version == '3.9'}} if: ${{matrix.python-version == '3.9'}}
# pstuil is an optional package to detect the number of CPU for compiling mmcv - name: Install ninja to speed the compilation
- name: Install psutil run: pip install ninja psutil
run: python -m pip install psutil - name: Install pre-built opencv-python for python3.6
run: pip install opencv-python --prefer-binary
if: ${{matrix.python-version == '3.6'}}
- name: Build and install - name: Build and install
run: rm -rf .eggs && python -m pip install -e . run: rm -rf .eggs && pip install -e . -v
- name: Validate the installation
run: python -c "import mmcv"
- name: Run unittests and generate coverage report - name: Run unittests and generate coverage report
run: | run: |
python -m pip install -r requirements/test.txt pip install -r requirements/test.txt
coverage run --branch --source=mmcv -m pytest tests/ coverage run --branch --source=mmcv -m pytest tests/
coverage xml coverage xml
coverage report -m coverage report -m
@ -227,7 +228,7 @@ jobs:
fail_ci_if_error: false fail_ci_if_error: false
build_cu102: build_cu102:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
container: container:
image: pytorch/pytorch:1.9.0-cuda10.2-cudnn7-devel image: pytorch/pytorch:1.9.0-cuda10.2-cudnn7-devel
env: env:
@ -260,47 +261,46 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Upgrade pip and wheel
run: pip install pip wheel --upgrade
- name: Fetch GPG keys - name: Fetch GPG keys
run: | run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Add PPA
run: |
apt-get update && apt-get install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
- name: Install python-dev - name: Install python-dev
run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python${{matrix.python-version}}-dev run: apt-get update && apt-get install -y python${{matrix.python-version}}-dev
- name: python -m Install PyTorch if: ${{matrix.python-version == '3.6'}}
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html - name: Install PyTorch
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies - name: Install system dependencies
run: apt-get update && apt-get install -y ffmpeg libturbojpeg ninja-build run: apt-get update && apt-get install -y ffmpeg libturbojpeg ninja-build
# pstuil is an optional package to detect the number of CPU for compiling mmcv - name: Install ninja to speed the compilation
- name: Install psutil run: pip install ninja psutil
run: python -m pip install psutil
# the directory for header files for the Python C-API could be wrong since setuptools>=65.2.0 # the directory for header files for the Python C-API could be wrong since setuptools>=65.2.0
- name: Install specified version for setuptools when python==3.10 - name: Install specified version for setuptools when python==3.10
run: python -m pip install 'setuptools<=65.1.0' run: pip install 'setuptools<=65.1.0'
if: ${{matrix.python-version == '3.10'}} if: ${{matrix.python-version == '3.10'}}
- name: Install pre-built opencv-python for python3.6
run: pip install opencv-python --prefer-binary
if: ${{matrix.python-version == '3.6'}}
- name: Build and install - name: Build and install
run: rm -rf .eggs && python -m pip install -e . run: rm -rf .eggs && pip install -e . -v
- name: Validate the installation
run: python -c "import mmcv"
- name: Run unittests and generate coverage report - name: Run unittests and generate coverage report
run: | run: |
python -m pip install -r requirements/test.txt pip install -r requirements/test.txt
coverage run --branch --source=mmcv -m pytest tests/ coverage run --branch --source=mmcv -m pytest tests/
coverage xml coverage xml
if: ${{matrix.python-version != '3.10'}} if: ${{matrix.python-version != '3.10'}}
# special treatment for python3.10 because onnx and onnxruntime don't provide python3.10 pre-built packages # special treatment for python3.10 because onnx and onnxruntime don't provide python3.10 pre-built packages
- name: Run unittests and generate coverage report for python3.10 - name: Run unittests and generate coverage report for python3.10
run: | run: |
python -m pip install -r requirements/test.txt pip install -r requirements/test.txt
coverage run --branch --source=mmcv -m pytest tests/ --ignore=tests/test_ops/test_onnx.py --ignore=tests/test_ops/test_tensorrt.py --ignore=tests/test_ops/test_tensorrt_preprocess.py coverage run --branch --source=mmcv -m pytest tests/ --ignore=tests/test_ops/test_onnx.py --ignore=tests/test_ops/test_tensorrt.py --ignore=tests/test_ops/test_tensorrt_preprocess.py
coverage xml coverage xml
if: ${{matrix.python-version == '3.10'}} if: ${{matrix.python-version == '3.10'}}
build_cu116: build_cu116:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
container: container:
image: pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel image: pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel
env: env:
@ -319,34 +319,27 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Upgrade pip and wheel
run: pip install pip wheel --upgrade
- name: Fetch GPG keys - name: Fetch GPG keys
run: | run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Add PPA - name: Install PyTorch
run: | run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
apt-get update && apt-get install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
- name: Install python-dev
run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python${{matrix.python-version}}-dev
- name: python -m Install PyTorch
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies - name: Install system dependencies
run: apt-get update && apt-get install -y ffmpeg libturbojpeg ninja-build run: apt-get update && apt-get install -y ffmpeg libturbojpeg ninja-build
# pstuil is an optional package to detect the number of CPU for compiling mmcv - name: Install ninja to speed the compilation
- name: Install psutil run: pip install ninja psutil
run: python -m pip install psutil
# the directory for header files for the Python C-API could be wrong since setuptools>=65.2.0 # the directory for header files for the Python C-API could be wrong since setuptools>=65.2.0
- name: Install specified version for setuptools when python==3.10 - name: Install specified version for setuptools when python==3.10
run: python -m pip install 'setuptools<=65.1.0' run: pip install 'setuptools<=65.1.0'
if: ${{matrix.python-version == '3.10'}} if: ${{matrix.python-version == '3.10'}}
- name: Build and install - name: Build and install
run: rm -rf .eggs && python -m pip install -e . run: rm -rf .eggs && pip install -e . -v
- name: Validate the installation
run: python -c "import mmcv"
- name: Run unittests and generate coverage report - name: Run unittests and generate coverage report
run: | run: |
python -m pip install -r requirements/test.txt pip install -r requirements/test.txt
coverage run --branch --source=mmcv -m pytest tests/ --ignore=tests/test_ops/test_onnx.py --ignore=tests/test_ops/test_tensorrt.py --ignore=tests/test_ops/test_tensorrt_preprocess.py coverage run --branch --source=mmcv -m pytest tests/ --ignore=tests/test_ops/test_onnx.py --ignore=tests/test_ops/test_tensorrt.py --ignore=tests/test_ops/test_tensorrt_preprocess.py
coverage xml coverage xml
@ -370,10 +363,12 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.7 python-version: 3.7
- name: Upgrade pip and wheel
run: python -m pip install pip wheel --upgrade
- name: Install PyTorch - name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu --no-cache-dir -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu --no-cache-dir -f https://download.pytorch.org/whl/torch_stable.html
- name: Build and install - name: Build and install
run: pip install -e . run: pip install -e . -v
- name: Validate the installation - name: Validate the installation
run: python -c "import mmcv" run: python -c "import mmcv"
- name: Run unittests - name: Run unittests
@ -399,10 +394,12 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.7 python-version: 3.7
- name: Upgrade pip and wheel
run: python -m pip install pip wheel --upgrade
- name: Install PyTorch - name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu --no-cache-dir -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu --no-cache-dir -f https://download.pytorch.org/whl/torch_stable.html
- name: Build and install - name: Build and install
run: pip install -e . run: pip install -e . -v
- name: Validate the installation - name: Validate the installation
run: python -c "import mmcv" run: python -c "import mmcv"
- name: Run unittests - name: Run unittests
@ -434,6 +431,8 @@ jobs:
python-version: 3.7 python-version: 3.7
- name: Install system dependencies - name: Install system dependencies
run: brew install ffmpeg jpeg-turbo run: brew install ffmpeg jpeg-turbo
- name: Upgrade pip and wheel
run: pip install pip wheel --upgrade
- name: Install utils - name: Install utils
run: pip install psutil run: pip install psutil
- name: Install Pillow - name: Install Pillow
@ -444,7 +443,7 @@ jobs:
- name: Build and install - name: Build and install
run: | run: |
rm -rf .eggs rm -rf .eggs
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e . CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e . -v
- name: Validate the installation - name: Validate the installation
run: python -c "import mmcv" run: python -c "import mmcv"
- name: Run unittests - name: Run unittests

View File

@ -18,7 +18,7 @@ env:
jobs: jobs:
build_parrots: build_parrots:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
container: container:
image: ghcr.io/cokedong/parrots:pat0.21.0a0_cuda11 image: ghcr.io/cokedong/parrots:pat0.21.0a0_cuda11
credentials: credentials:

View File

@ -8,7 +8,7 @@ concurrency:
jobs: jobs:
lint: lint:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.7 - name: Set up Python 3.7

View File

@ -8,7 +8,7 @@ concurrency:
jobs: jobs:
build-n-publish: build-n-publish:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
if: startsWith(github.event.ref, 'refs/tags') if: startsWith(github.event.ref, 'refs/tags')
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -26,7 +26,7 @@ jobs:
twine upload dist/* -u __token__ -p ${{ secrets.pypi_password }} twine upload dist/* -u __token__ -p ${{ secrets.pypi_password }}
build-n-publish_with_ops: build-n-publish_with_ops:
runs-on: ubuntu-18.04 runs-on: ubuntu-22.04
if: startsWith(github.event.ref, 'refs/tags') if: startsWith(github.event.ref, 'refs/tags')
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -7,3 +7,4 @@ sphinx==4.0.2
sphinx-copybutton sphinx-copybutton
sphinx_markdown_tables>=0.0.16 sphinx_markdown_tables>=0.0.16
torch torch
urllib3<2.0.0

View File

@ -5,13 +5,78 @@ CommandLine:
pytest tests/test_runner/test_hooks.py pytest tests/test_runner/test_hooks.py
xdoctest tests/test_hooks.py zero xdoctest tests/test_hooks.py zero
""" """
import logging
import tempfile
import torch import torch
import torch.nn as nn import torch.nn as nn
from torch.utils.data import DataLoader from torch.utils.data import DataLoader
from mmcv.cnn.rfsearch import Conv2dRFSearchOp, RFSearchHook from mmcv.cnn.rfsearch import Conv2dRFSearchOp, RFSearchHook
from tests.test_runner.test_hooks import _build_demo_runner from mmcv.runner import build_runner
def _build_demo_runner_without_hook(runner_type='EpochBasedRunner',
max_epochs=1,
max_iters=None,
multi_optimizers=False):
class Model(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(2, 1)
self.conv = nn.Conv2d(3, 3, 3)
def forward(self, x):
return self.linear(x)
def train_step(self, x, optimizer, **kwargs):
return dict(loss=self(x))
def val_step(self, x, optimizer, **kwargs):
return dict(loss=self(x))
model = Model()
if multi_optimizers:
optimizer = {
'model1':
torch.optim.SGD(model.linear.parameters(), lr=0.02, momentum=0.95),
'model2':
torch.optim.SGD(model.conv.parameters(), lr=0.01, momentum=0.9),
}
else:
optimizer = torch.optim.SGD(model.parameters(), lr=0.02, momentum=0.95)
tmp_dir = tempfile.mkdtemp()
runner = build_runner(
dict(type=runner_type),
default_args=dict(
model=model,
work_dir=tmp_dir,
optimizer=optimizer,
logger=logging.getLogger(),
max_epochs=max_epochs,
max_iters=max_iters))
return runner
def _build_demo_runner(runner_type='EpochBasedRunner',
max_epochs=1,
max_iters=None,
multi_optimizers=False):
log_config = dict(
interval=1, hooks=[
dict(type='TextLoggerHook'),
])
runner = _build_demo_runner_without_hook(runner_type, max_epochs,
max_iters, multi_optimizers)
runner.register_checkpoint_hook(dict(interval=1))
runner.register_logger_hooks(log_config)
return runner
def test_rfsearchhook(): def test_rfsearchhook():