mlcommons / mlcommons/inference

Codebase Refactor: Localize wildcard imports

Open
#2,520 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
650
Avg merge
1d 22h
Merged PRs (30d)
6

Description

In general, it's best practice to reduce wildcard imports wherever possible so that it's clear where methods/functions are coming from.

Using ruff's F405 rule, we can see that the following files contain wildcard imports where there are names that are undefined without considering wildcard imports. By specifying what comes from where, we can easily figure out what's important:

retired_benchmarks/translation/gnmt/tensorflow/loadgen_gnmt.py
retired_benchmarks/vision/medical_imaging/3d-unet-brats19/Task043_BraTS_2019.py
tools/submission/submission_checker/checks/accuracy_check.py
tools/submission/submission_checker/checks/compliance_check.py
tools/submission/submission_checker/checks/measurements_checks.py
tools/submission/submission_checker/checks/performance_check.py
tools/submission/submission_checker/checks/power_check.py
tools/submission/submission_checker/checks/system_check.py
tools/submission/submission_checker/loader.py
tools/submission/submission_checker/results.py
tools/submission/submission_checker/utils.py
vision/classification_and_detection/python/backend_ncnn.py
vision/medical_imaging/3d-unet-kits19/base_SUT.py
vision/medical_imaging/3d-unet-kits19/inference_utils.py
vision/medical_imaging/3d-unet-kits19/preprocess.py
vision/medical_imaging/3d-unet-kits19/unet_pytorch_to_onnx.py

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running Ruff's F405 check against the listed files, then inspect each wildcard import and the names it provides. The affected entry points include the submission checker modules under tools/submission/submission_checker/, the retired benchmark files, and the vision benchmark files. Done means the imports are localized in all listed files and F405 no longer reports these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.