Skip to content
Merged
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
42 changes: 42 additions & 0 deletions .github/workflows/cron-mmar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: cron-mmar

on:
schedule:
- cron: "0 2 * * *" # at 02:00 UTC
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
# automatically cancel the previously triggered workflows when there's a newer version
group: mmar-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
cron-load:
if: github.repository == 'Project-MONAI/MONAI'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: cache weekly timestamp
id: pip-cache
run: echo "::set-output name=datew::$(date '+%Y-%V')"
- name: cache for pip
uses: actions/cache@v2
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-dev.txt
- name: Loading MMARs
run: |
# clean up temporary files
$(pwd)/runtests.sh --clean
# run tests
python -m tests.ngc_mmar_loading
37 changes: 37 additions & 0 deletions tests/ngc_mmar_loading.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import unittest

import torch
from parameterized import parameterized

from monai.apps.mmars import MODEL_DESC, load_from_mmar
from monai.config import print_debug_info


class TestAllDownloadingMMAR(unittest.TestCase):
def setUp(self):
print_debug_info()
self.test_dir = "./"

@parameterized.expand((item,) for item in MODEL_DESC)
def test_loading_mmar(self, item):
pretrained_model = load_from_mmar(item=item, mmar_dir="./", map_location="cpu")
self.assertTrue(isinstance(pretrained_model, torch.nn.Modules))

def tearDown(self):
print(os.listdir(self.test_dir))


if __name__ == "__main__":
unittest.main()