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
2 changes: 2 additions & 0 deletions .github/workflows/mlperf-inference-resnet50.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
implementation: cpp
- on: windows-latest
implementation: cpp
- on: windows-latest
python-version: 3.13
runs-on: "${{ matrix.on }}"
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-mlc-core-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,5 @@ jobs:
python -m pip install .
- name: MLC ${{matrix.action}} script
run: |
mlcp mlcommons@mlperf-automations
mlcp mlcommons@mlperf-automations --branch=dev
${{matrix.action}} detect,cpu
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.14
1.1.15
14 changes: 9 additions & 5 deletions mlc/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ def add(self, meta, folder_type, path, repo):
unique_id = meta['uid']
alias = meta['alias']
tags = meta['tags']
self.indices[folder_type].append({

index = self.get_index(folder_type, unique_id)

if index == -1:
self.indices[folder_type].append({
"uid": unique_id,
"tags": tags,
"alias": alias,
"path": path,
"repo": repo
})
self._save_indices()
self._save_indices()

def get_index(self, folder_type, uid):
for index in range(len(self.indices[folder_type])):
Expand Down Expand Up @@ -200,10 +204,10 @@ def build_index(self):
repo_path = repo.path #os.path.join(self.repos_path, repo)
if not os.path.isdir(repo_path):
continue
logger.debug(f"------------Checking repository: {repo_path}---------------")
#logger.debug(f"------------Checking repository: {repo_path}---------------")
# Filter for relevant directories in the repo
for folder_type in ["script", "cache", "experiment"]:
logger.debug(f"Checking folder type: {folder_type}")
#logger.debug(f"Checking folder type: {folder_type}")
folder_path = os.path.join(repo_path, folder_type)
if not os.path.isdir(folder_path):
continue
Expand All @@ -213,7 +217,7 @@ def build_index(self):
# logger.debug(f"Checking automation directory: {automation_dir}")
automation_path = os.path.join(folder_path, automation_dir)
if not os.path.isdir(automation_path):
logger.debug(f"Skipping non-directory automation path: {automation_path}")
#logger.debug(f"Skipping non-directory automation path: {automation_path}")
continue

yaml_path = os.path.join(automation_path, "meta.yaml")
Expand Down
4 changes: 2 additions & 2 deletions mlc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ def build_parser(pre_args):
def configure_logging(args):
if hasattr(args, 'extra') and args.extra:
args.extra[:] = [log_flag_aliases.get(a, a) for a in args.extra]

for flag, level in log_levels.items():
if flag in args.extra:
if not logger.isEnabledFor(level):
logger.setLevel(level)
logger.setLevel(level)
args.extra.remove(flag)


Expand Down
63 changes: 33 additions & 30 deletions mlc/repo_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ def add(self, run_args):

repo_path = os.path.join(self.repos_path, repo_folder_name)

r = self.find(run_args)

if r['return'] == 0 and len(r['list']) > 0:
return {'return': 1, "error": f"""Repo already exists at {r['list'][0]}"""}

for repo in self.repos:
if repo.path == i_repo_path:
return {'return': 1, "error": f"""Repo already exists at {repo.path}"""}
Expand All @@ -95,7 +100,6 @@ def add(self, run_args):
os.makedirs(repo_path)
else:
repo_path = os.path.abspath(i_repo_path)
logger.info(f"""New repo path: {repo_path}""")

#check if it has MLC meta
meta_file = os.path.join(repo_path, "meta.yaml")
Expand All @@ -107,7 +111,8 @@ def add(self, run_args):
utils.save_yaml(meta_file, meta)
else:
meta = utils.read_yaml(meta_file)
self.register_repo(repo_path, meta)

self.register_repo(repo_path, meta, run_args.get('ignore_on_conflict'))

return {'return': 0}

Expand All @@ -116,13 +121,32 @@ def conflicting_repo(self, repo_meta):
if repo_object.meta.get('uid', '') == '':
return {"return": 1, "error": f"UID is not present in file 'meta.yaml' in the repo path {repo_object.path}"}
if repo_meta["uid"] == repo_object.meta.get('uid', ''):
if repo_meta['path'] == repo_object.path:
if repo_meta.get('path', '') == repo_object.path:
return {"return": 1, "error": f"Same repo is already registered"}
else:
return {"return": 1, "error": f"Conflicting with repo in the path {repo_object.path}", "conflicting_path": repo_object.path}
return {"return": 0}

def register_repo(self, repo_path, repo_meta):
def register_repo(self, repo_path, repo_meta, ignore_on_conflict=False):

# Check UID conflicts
is_conflict = self.conflicting_repo(repo_meta)
if is_conflict['return'] > 0:
if "UID not present" in is_conflict['error']:
logger.warning(f"UID not found in meta.yaml at {repo_path}. Repo can not be registered in MLC repos. Skipping...")
return {"return": 0}
elif "already registered" in is_conflict["error"]: #at same path
#logger.warning(is_conflict["error"])
logger.debug("No changes made to repos.json.")
return {"return": 0}
else:
logger.warning(f"The repo to be registered has conflict with the repo already in the path: {is_conflict['conflicting_path']}")
if ignore_on_conflict:
logger.warning(f"Ignoring register as ignore_on_conflict is set")
return {"return": 0, 'conflict': True}

self.unregister_repo(is_conflict['conflicting_path'])
logger.warning(f"{is_conflict['conflicting_path']} is unregistered.")

if repo_meta.get('deps'):
for dep in repo_meta['deps']:
Expand Down Expand Up @@ -345,39 +369,18 @@ def pull_repo(self, repo_url, branch=None, checkout = None, tag = None, pat = No
# check the meta file to obtain uids
meta_file_path = os.path.join(repo_path, 'meta.yaml')
if not os.path.exists(meta_file_path):
logger.warning(f"meta.yaml not found in {repo_path}. Repo pulled but not register in mlc repos. Skipping...")
logger.warning(f"meta.yaml not found in {repo_path}. Repo pulled but not registered in MLC repos. Skipping...")
return {"return": 0}

with open(meta_file_path, 'r') as meta_file:
meta_data = yaml.safe_load(meta_file)
meta_data["path"] = repo_path

# Check UID conflicts
is_conflict = self.conflicting_repo(meta_data)
if is_conflict['return'] > 0:
if "UID not present" in is_conflict['error']:
logger.warning(f"UID not found in meta.yaml at {repo_path}. Repo pulled but can not register in mlc repos. Skipping...")
return {"return": 0}
elif "already registered" in is_conflict["error"]:
#logger.warning(is_conflict["error"])
logger.debug("No changes made to repos.json.")
return {"return": 0}
else:
if ignore_on_conflict:
logger.debug("Repo alias existing. Ignoring the repo pull")
return {"return": 0}

logger.warning(f"The repo to be cloned has conflict with the repo already in the path: {is_conflict['conflicting_path']}")
self.unregister_repo(is_conflict['conflicting_path'])
self.register_repo(repo_path, meta_data)
logger.warning(f"{repo_path} is registered in repos.json and {is_conflict['conflicting_path']} is unregistered.")
return {"return": 0}
else:
r = self.register_repo(repo_path, meta_data)
if r['return'] > 0:
return r
r = self.register_repo(repo_path, meta_data, ignore_on_conflict)
if r['return'] > 0:
return r

return {"return": 0}
return {"return": 0}

except subprocess.CalledProcessError as e:
return {'return': 1, 'error': f"Git command failed: {e}"}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mlcflow"
version = "1.1.14"
version = "1.1.15"

description = "An automation interface tailored for CPU/GPU benchmarking"
authors = [
Expand Down
Loading