Skip to content

Commit

Permalink
a few minor improvements with tests and flags (#1322)
Browse files Browse the repository at this point in the history
- added `-f` to the CMX core to be backwards compatible with CM commands
like `cm rm cache -f`
- disabled currently unused actions and added a few more tests
-
  • Loading branch information
gfursin authored Oct 13, 2024
2 parents 72734a1 + 554a70b commit 3bc1bb9
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions .github/workflows/test-cm-image-classification-onnx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: 'CM: image classification with ONNX'

on:
pull_request:
branches: [ "main", "dev" ]
paths:
- '.github/workflows/test-image-classification-onnx.yml'
- '**'
- '!**.md'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [ "3.10", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install cmind
cm pull repo --url=https://github.com/mlcommons/cm4mlops
cm run script --quiet --tags=get,sys-utils-cm
- name: Test image classification with ONNX
run: |
cmr "python app image-classification onnx" --quiet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: MLPerf inference resnet50
name: 'CM: MLPerf inference resnet50'

on:
pull_request:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/test-cmx-image-classification-onnx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: 'CMX: image classification with ONNX'

on:
pull_request:
branches: [ "main", "dev" ]
paths:
- '.github/workflows/test-image-classification-onnx.yml'
- '**'
- '!**.md'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [ "3.10", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install cmind
cmx pull repo --url=https://github.com/mlcommons/cm4mlops
cmx test core
- name: Test image classification with ONNX
run: |
cmx run script "python app image-classification onnx" --quiet
4 changes: 4 additions & 0 deletions cm/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## V3.2.0.1
- added `-f` to the CMX core to be backwards compatible
with CM commands like `cm rm cache -f`

## V3.2.0
- added `utils.test_input` to test if input has keys
and report them as error
Expand Down
2 changes: 1 addition & 1 deletion cm/cmind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Written by Grigori Fursin

__version__ = "3.2.0"
__version__ = "3.2.0.1"

from cmind.core import access
from cmind.core import x
Expand Down
9 changes: 8 additions & 1 deletion cm/cmind/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,14 @@ def x(self, i, out = None):
control_flags[flag] = control[flag]

# Check if unknown flags
# f should be deprecated in the future - used for backwards
# compatibility with older commands like cm/cmx rm cache -f

unknown_control_flags = [flag for flag in control_flags if flag not in [
'h', 'help', 'version', 'out', 'j', 'json',
'save_to_json_file', 'save_to_yaml_file', 'common',
'ignore_inheritance', 'log', 'logfile', 'raise', 'repro']]
'ignore_inheritance', 'log', 'logfile', 'raise', 'repro',
'f']]

if len(unknown_control_flags)>0:
unknown_control_flags_str = ','.join(unknown_control_flags)
Expand All @@ -738,6 +742,9 @@ def x(self, i, out = None):
# Force print help
control['h'] = True

if control.pop('f', ''):
i['f'] = True

# Check repro
use_log = str(control_flags.pop('log', '')).strip().lower()
log_file = control_flags.pop('logfile', '')
Expand Down

0 comments on commit 3bc1bb9

Please sign in to comment.