Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Dev #49

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
83a316b
support find cache
anandhu-eng Jan 25, 2025
e4a05f5
initial commit for testing mlc core actions
anandhu-eng Jan 25, 2025
a08f555
fix branch
anandhu-eng Jan 25, 2025
0982081
install mlcflow from source of pr
anandhu-eng Jan 25, 2025
1074131
fix repo key error
anandhu-eng Jan 25, 2025
dff7953
use action to clone source repo
anandhu-eng Jan 25, 2025
85ca2a3
added more extensive checking
anandhu-eng Jan 25, 2025
45a4314
silence the prompts - quiet
anandhu-eng Jan 25, 2025
b784d5f
expanded validate function
anandhu-eng Jan 25, 2025
0cc856a
test commit
anandhu-eng Jan 25, 2025
25c2ca2
fix repo path
anandhu-eng Jan 25, 2025
9d57d0e
test commit
anandhu-eng Jan 25, 2025
19d95b0
test commit
anandhu-eng Jan 25, 2025
7ef0073
test commit
anandhu-eng Jan 25, 2025
6be43bf
Merge branch 'dev' into dev
arjunsuresh Jan 26, 2025
e0e3b35
Cleanup logging, rm action
arjunsuresh Jan 27, 2025
e5ed569
Made --tags= optional for mlcr
arjunsuresh Jan 27, 2025
a9faa6a
Merge branch 'mlcommons:dev' into dev
arjunsuresh Jan 27, 2025
5799f4d
Merge branch 'dev' into dev
arjunsuresh Jan 27, 2025
9c8a42a
Use global logger
arjunsuresh Jan 28, 2025
2db2d0f
Merge pull request #43 from GATEOverflow/dev
arjunsuresh Jan 28, 2025
fe859c5
Fixed logger
arjunsuresh Jan 28, 2025
31210d2
Support CacheAction inside ScriptAutomation
arjunsuresh Jan 30, 2025
55a4f15
Update README.md
arjunsuresh Jan 30, 2025
14226ba
Merge branch 'mlcommons:dev' into dev
arjunsuresh Jan 30, 2025
1877b0e
Merge pull request #44 from GATEOverflow/dev
arjunsuresh Jan 30, 2025
6e57523
Merge branch 'dev' into dev
arjunsuresh Jan 30, 2025
9fbac92
Update test-mlc-core-actions.yaml
arjunsuresh Jan 30, 2025
af3422d
Update test-mlc-core-actions.yaml
arjunsuresh Jan 30, 2025
60c5f99
Update main.py
arjunsuresh Jan 30, 2025
e79bee5
Added process_console_output function
arjunsuresh Jan 30, 2025
bc80c4a
Update test-mlc-core-actions.yaml
arjunsuresh Jan 30, 2025
ab58184
Update CONTRIBUTORS.md
arjunsuresh Jan 30, 2025
e1e5ca2
Merge branch 'mlcommons:dev' into dev
arjunsuresh Jan 30, 2025
e0b8d87
Merge pull request #45 from GATEOverflow/dev
arjunsuresh Jan 30, 2025
5b9cfe8
Merge branch 'dev' into dev
arjunsuresh Jan 30, 2025
84cbf99
Cleanup
arjunsuresh Jan 30, 2025
c44e5ae
List all target and corresponding actions
anandhu-eng Jan 31, 2025
243efee
add find action
anandhu-eng Jan 31, 2025
735280a
Merge pull request #46 from anandhu-eng/doc
arjunsuresh Jan 31, 2025
07b946f
Merge pull request #39 from anandhu-eng/dev
arjunsuresh Jan 31, 2025
c9cfeb5
Merge branch 'mlcommons:dev' into dev
arjunsuresh Jan 31, 2025
5bd4647
Support show action for cache, printd with begin spaces
arjunsuresh Jan 31, 2025
139ac7e
Merge pull request #47 from GATEOverflow/dev
arjunsuresh Jan 31, 2025
7afa9fb
Update architectural diagram
arjunsuresh Feb 2, 2025
06890c9
Update README.md
arjunsuresh Feb 2, 2025
c5e4913
Update README.md
arjunsuresh Feb 2, 2025
8dd3706
Update README.md
arjunsuresh Feb 2, 2025
1300326
Merge branch 'dev' into dev
arjunsuresh Feb 2, 2025
19a761d
Merge pull request #48 from GATEOverflow/dev
arjunsuresh Feb 2, 2025
8940a70
Update README.md
arjunsuresh Feb 2, 2025
826c964
Merge branch 'main' into dev
arjunsuresh Feb 2, 2025
8631a42
Update test-mlc-core-actions.yaml
arjunsuresh Feb 2, 2025
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
136 changes: 136 additions & 0 deletions .github/workflows/test-mlc-core-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: MLC core actions test

on:
pull_request:
branches: [ "main", "dev" ]
paths:
- '.github/workflows/test-mlc-core-actions.yml'
- '**'
- '!**.md'

jobs:
test_mlc_core_actions:

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

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Configure git longpaths (Windows)
if: matrix.os == 'windows-latest'
run: |
git config --system core.longpaths true

- name: Install mlcflow from the pull request's source repository and branch
run: |
python -m pip install --upgrade pip
python -m pip install --ignore-installed --verbose pip setuptools
python -m pip install .

- name: Test 1 - pull repo - Pull a forked MLOps repository
run: |
GH_MLC_REPO_PATH_FORK="${HOME}/MLC/repos/anandhu-eng@mlperf-automations"
GH_MLC_REPO_JSON_PATH="${HOME}/MLC/repos/repos.json"
mlc pull repo anandhu-eng@mlperf-automations --checkout=dev
if [ ! -d "${GH_MLC_REPO_PATH_FORK}" ]; then
echo "Repository folder $GH_MLC_REPO_PATH_FORK not found. Exiting with failure."
exit 1
fi
if [ ! -f "$GH_MLC_REPO_JSON_PATH" ]; then
echo "File $GH_MLC_REPO_JSON_PATH does not exist. Exiting with failure."
exit 1
fi
if ! grep -q "$GH_MLC_REPO_PATH_FORK" "$GH_MLC_REPO_JSON_PATH"; then
echo "Path $GH_MLC_REPO_PATH_FORK not found in $GH_MLC_REPO_JSON_PATH. Exiting with failure."
exit 1
fi
CURRENT_BRANCH=$(git -C "$GH_MLC_REPO_PATH_FORK" rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "dev" ]; then
echo "Expected branch 'dev', but found '$CURRENT_BRANCH'. Exiting with failure."
exit 1
fi


- name: Test 2 - pull repo - Test conflicting repo scenario
run: |
GH_MLC_REPO_PATH="${HOME}/MLC/repos/mlcommons@mlperf-automations"
GH_MLC_REPO_JSON_PATH="${HOME}/MLC/repos/repos.json"
mlc pull repo mlcommons@mlperf-automations --checkout=dev
if [ ! -d "$GH_MLC_REPO_PATH" ]; then
echo "Repository folder $GH_MLC_REPO_PATH not found. Exiting with failure."
exit 1
fi
if [ ! -f "$GH_MLC_REPO_JSON_PATH" ]; then
echo "File $GH_MLC_REPO_JSON_PATH does not exist. Exiting with failure."
exit 1
fi
if ! grep -q "$GH_MLC_REPO_PATH" "$GH_MLC_REPO_JSON_PATH"; then
echo "Path $GH_MLC_REPO_PATH not found in $GH_MLC_REPO_JSON_PATH. Exiting with failure."
exit 1
fi
if ! grep -q "$GH_MLC_REPO_PATH_FORK" "$GH_MLC_REPO_JSON_PATH"; then
echo "Path $GH_MLC_REPO_PATH_FORK also found in $GH_MLC_REPO_JSON_PATH. This should have been replaced. Exiting with failure."
exit 1
fi
CURRENT_BRANCH=$(git -C "$GH_MLC_REPO_PATH" rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "dev" ]; then
echo "Expected branch 'dev', but found '$CURRENT_BRANCH'. Exiting with failure."
exit 1
fi

- name: Test 3 - list repo - List the existing repositories
run: |
mlc list repo

- name: Test 4 - rm repo - Remove the forked mlperf-automation repo
run: |
GH_MLC_REPO_PATH_FORK="${HOME}/MLC/repos/anandhu-eng@mlperf-automations"
mlc rm repo anandhu-eng@mlperf-automations
if [ -d "$GH_MLC_REPO_PATH_FORK" ]; then
echo "Repository folder $GH_MLC_REPO_PATH found. It should ideally be deleted. Exiting with failure."
exit 1
fi

- name: Test 5 - find cache - Cache not present
run: |
mlc find cache --tags=detect,os 2>&1 | tee test5.log
if ! grep -q "No cache entry found for the specified tags:" test5.log; then
exit 1
fi

- name: Test 6 - run script - Output being used for testing mlc cache
run: |
mlc run script --tags=get,imagenet-aux --quiet
mlc run script --tags=get,imagenet-aux,_from.dropbox --quiet

- name: Test 7 - find cache - More than one cache present
run: |
mlc search cache --tags=get,imagenet-aux 2>&1 | tee test7.log
if grep -q "No cache entry found for the specified tags:" test7.log; then
exit 1
fi

- name: Test 8 - show cache - More than one cache present
run: |
mlc show cache --tags=get,imagenet-aux 2>&1 | tee test7.log

- name: Test 9 - rm cache - More than one cache present
run: |
mlc rm cache --tags=get,imagenet-aux 2>&1 --all | tee test7.log

- name: Test 10 - cp script - Copy mlc script
run: |
mlc cp script detect-os my-os-detect

12 changes: 4 additions & 8 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ Once your contribution exceeds 50 lines of code (in total), we will:

## Current Contributors

- **[Arjun Suresh]** - *Initial Development*
- **[Anandhu Sooraj]** - *Initial Development*
- **[Shaik Masthan]** - *Initial Development*
- **[Sahil Avaran]** - *Initial Development*, added logging
- **[Ayushi Chaudhari]** - *Initial Development*
- **[Contributor 1]** - Added core features for CLI workflow.
- **[Contributor 2]** - Refactored caching system and enhanced performance.
- **[Contributor 3]** - Improved documentation and code structure.
- **[Arjun Suresh]** - *Initial Development Discussions, {Script,Cache} Action implementations*
- **[Anandhu Sooraj]** - *Initial Development Discussions, RepoAction implmentation, Github Tests*
- **[Shaik Masthan]** - *Initial Development Discussions*
- **[Sahil Avaran]** - *Initial Development Discussions*, added logging
- **[Your Name Here]** - This could be you! 🎉

---
Expand Down
119 changes: 81 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
**MLCFlow: Simplifying MLPerf Automations**

[![License](https://img.shields.io/badge/License-Apache%202.0-green)](LICENSE.md)
[![Downloads](https://static.pepy.tech/badge/mlcflow)](https://pepy.tech/project/mlcflow)

[![MLC core actions test](https://github.com/mlcommons/mlcflow/actions/workflows/test-mlc-core-actions.yaml/badge.svg)](https://github.com/mlcommons/mlcflow/actions/workflows/test-mlc-core-actions.yaml)
[![MLC script automation features test](https://github.com/mlcommons/mlperf-automations/actions/workflows/test-mlc-script-features.yml/badge.svg?cache-bust=1)](https://github.com/mlcommons/mlperf-automations/actions/workflows/test-mlc-script-features.yml)
[![MLPerf inference resnet50](https://github.com/mlcommons/mlcflow/actions/workflows/mlperf-inference-resnet50.yml/badge.svg)](https://github.com/mlcommons/mlcflow/actions/workflows/mlperf-inference-resnet50.yml)
[![MLPerf inference bert (deepsparse, tf, onnxruntime, pytorch)](https://github.com/mlcommons/mlcflow/actions/workflows/mlperf-inference-bert.yml/badge.svg)](https://github.com/mlcommons/mlcflow/actions/workflows/mlperf-inference-bert.yml)


MLCFlow is a versatile CLI and Python interface developed by MLCommons in collaboration with a dedicated team of volunteers (see [Contributors](CONTRIBUTORS.md)). It serves as a streamlined replacement for the [CMind](https://github.com/mlcommons/ck/tree/master/cm) tool, designed to drive the automation workflows of MLPerf benchmarks more efficiently.

The concept behind CMind originated from **Grigori Fursin**, while the **MLPerf Automations** project was created by **Grigori Fursin** and **Arjun Suresh**, whose collective contributions laid the foundation for modernizing MLPerf benchmarking tools.

### Key Features
Building upon the core idea of CMind—wrapping native scripts with Python wrappers and YAML metadata—MLCFlow focuses exclusively on key automation components: **Scripts**, along with its complementary modules: **Cache**, **Docker**, and **Experiments**. This targeted design simplifies both implementation and interface, enabling a more user-friendly experience.

### Status
MLCFlow is currently a **work in progress** and not yet ready for production use. If you are interested in contributing to its initial development, please email [[email protected]](mailto:[email protected]) to join the daily development meetings and see [Issues](https://github.com/mlcommons/mlcflow/issues) for seeing the development progress.

### Getting Started
For early contributors, please use the `mlc` branch of the [MLPerf Automations](https://github.com/mlcommons/mlperf-automations) repository while working with MLCFlow.
---

### Status
MLCFlow is now fully equipped for workflow development, with complete support for all previously used CM scripts in MLPerf inference automation. If you're interested in discussions, join the MLCommons Benchmark Infra [Discord channel](https://discord.gg/T9rHVwQFNX), and check out the latest progress in [Issues](https://github.com/mlcommons/mlcflow/issues).

---

Expand Down Expand Up @@ -42,38 +49,65 @@ mlc <action> <target> [options]
#### 3. **Cache**
- Handle cached data, including cleanup or inspection.

Each target has its own set of specific actions to tailor automation workflows.
Each target has its own set of specific actions to tailor automation workflows as specified below.



| Target | Action |
|--------|-----------------|
| script | run, search, rm, mv, cp, add, list, test, docker, show |
| cache | search, rm, list, show, find |
| repo | pull, search, rm, list, find |


## CM compatibility layer

MLC has a compatibility layer where by it supports MLCommons CM automations - Script, Cache and Experiment.
MLC started with a compatibility layer where by it supported MLCommons CM automations - Script, Cache and Experiment. Now, MLCFLow has just the Script Automation which is an extension of the Script Automation from CM but with a cleaner integration of Cache Automation and Docker and Test extensions. The old CM scripts are now updated with the latest MLCFlow scripts in the [MLPerf Automations](https://github.com/mlcommons/mlperf-automations/tree/main/script) repository.

## Architectural Diagram

```mermaid
classDiagram
class Action {
-repos_path : str
-cfg : dict
-repos : list
+execute(args)
+access(options)
+asearch(i)
+find_target_folder(target)
+load_repos_and_meta()
+load_repos()
+conflicting_repo(repo_meta)
+register_repo(repo_meta)
+unregister_repo(repo_path)
+add(i)
+rm(i)
+save_new_meta(i, item_id, item_name, target_name, item_path, repo)
+update(i)
+is_uid(name)
+cp(run_args)
+copy_item(source_path, destination_path)
+search(i)
}
class RepoAction {
+find(run_args)
+github_url_to_user_repo_format(url)
+pull(args)
+list(args)
+pull_repo(repo_url, branch, checkout)
+pull(run_args)
+list(run_args)
+rm(run_args)
}
class ScriptAction {
+run(args)
+search(i)
+rm(i)
+dynamic_import_module(script_path)
+call_script_module_function(function_name, run_args)
+docker(run_args)
+run(run_args)
+test(run_args)
+list(args)
}
class CacheAction {
+show(args)
+search(i)
+find(i)
+rm(i)
+show(run_args)
+list(args)
}
class ExperimentAction {
Expand All @@ -82,38 +116,47 @@ classDiagram
}
class CfgAction {
+load(args)
+unload(args)
}
class Index {
+add(meta, folder_type, path, repo)
+get_index(folder_type, uid)
+update(meta, folder_type, path, repo)
+rm(meta, folder_type, path)
+build_index()
}
class Item {
+meta
+path
+repo
+_load_meta()
}
class Repo {
-path : str
-meta : dict
+path
+meta
+_load_meta()
}
class Automation {
-cmind : Action
+execute(args)
}
class Index {
+find()
+action_object
+automation_type
+meta
+path
+_load_meta()
+search(i)
}

Action <|-- RepoAction
Action <|-- ScriptAction
Action <|-- CacheAction
Action <|-- ExperimentAction
Action <|-- CfgAction
Repo "1" *-- Action
Automation "1" *-- Action

class get_action {
+actions : dict
+get_action(target)
}

main --> get_action
get_action --> RepoAction
get_action --> ScriptAction
get_action --> CacheAction
get_action --> ExperimentAction
get_action --> CfgAction
RepoAction o-- Repo
ScriptAction o-- Automation
CacheAction o-- Index
ExperimentAction o-- Index
CfgAction o-- Index
Index o-- Repo
Index o-- Item
Item o-- Repo
Automation o-- Action
```

Loading
Loading