We're always looking for your help to improve the product (bug fixes, new features, documentation, etc).
Repository is organized by "model's name" as root folder, with each folder containing recipes specific to it. Each sub-folder within the root folder of the model might be organized by whatever criteria (based on devices, ExecutionProvider, maintainer, or something entirely different) best suits the recipes maintainer.
Each folder (and subsequent sub-folders), however, are required to have a file named info.yml that lists details about what that specific folder contains. This information file is not strictly structured expect that it be legal yaml file and contain a few required fields. An automation job scans these information file to collect and populate a table (viewable on repository's home page) for ease of navigation (and visibility) for users.
Each info.yml is unique to the folder it contains and, at the minimum, should contain the following information:
NOTE: All information is case-sensitive.
- arch [str]: Architecture of the model
- recipes [Recipe[]]: A list of recipes (file names) in the parent folder. For each entry,
- name [str] [Optional]: Use this field to disambiguate recipes for the same device & EP. Uses
model_nameas default. - file [str]: Filename of the recipe
- eps: [str | str[]]: One or list of supported EPs
- devices: [str | str[]]: One or list of supported devices
- name [str] [Optional]: Use this field to disambiguate recipes for the same device & EP. Uses
Beyond the required fields, the file can include any information relevant to the recipes maintainer.
Here's an example of info.yml file for a bert model.
arch: bert
recipes:
- name: intel-bert
file: qdq.json
devices: cpu
eps: CPUExecutionProvider
- name: intel-bert
file: trtrtx.json
devices: gpu
eps: NvTensorRTRTXExecutionProvider
- name: intel-bert (VitisAI)
file: vitis_ai.json
devices: cpu
eps: VitisAIExecutionProviderinfo.yml can also include configuration used by Foundry Toolkit specific models. For compatibility with existing tooling, all relevant information should remain rooted under the aitk node in the YAML.
aitk:
- modelInfo:
id: "huggingface/Intel/bert-base-uncased-mrpc"
version: 1
- workflows:
file: "bert_qdq_qnn.json"
file: "bert_qdq_amd.json"
file: "bert_ov.json"
file: "bert_trtrtx.json"CI for Olive recipes can be configured to run automatically by adding olive_ci.json file under the model directory. Each entry in the file is configured to run as an independent GitHub Actions job.
Each olive_ci.json is unique to the folder it contains and, at the minimum, should contain the following information for each root entry:
- name [str]: a unique identifier to locate specific job
- os [str]: options are ubuntu or windows
- device [str]: options are cpu or cuda.
- requirements_file [str]: relative file path to requirements file to use for this job. The job will use this file to setup the environment to run the commands.
- command [str]: a list of commands concatenated by either '&&' (on unix-like platforms) or separated by ';' (on windows platforms). This entry can also point to a shell or python script which can implement more complicated/advanced logic to run. When referring to a shell or python script, the path is relative to the location of the corresponding
olive_ci.jsonfile.
For an example, refer to the following olive_ci.json implementation.
In the test folder, run pip install -r requirements-test.txt to install test dependencies.
There should be unit tests that cover the core functionality of the product, expected edge cases, and expected errors. Code coverage from these tests should aim at maintaining over 80% coverage.
All changes should be covered by new or existing unit tests.
Test the behavior, instead of the implementation. To make what a test is testing clear, the test methods should be named following the pattern test_<method or function name>_<expected behavior>_[when_<condition>].
e.g. test_method_x_raises_error_when_dims_is_not_a_sequence
Ensure that the correct development packages are installed by pip install -r requirements-dev.txt.
This project uses lintrunner for linting. It provides a consistent linting experience locally and in CI. You can initialize with
lintrunner initThis will install lintrunner on your system and download all the necessary
dependencies to run linters locally.
If you want to see what lintrunner init will install, run
lintrunner init --dry-run.
To lint local changes:
lintrunnerTo format files and apply suggestions:
lintrunner -aTo lint all files:
lintrunner --all-filesTo show help text:
lintrunner -hTo read more about lintrunner, see wiki.
To update an existing linting rule or create a new one, modify .lintrunner.toml or create a
new adapter following examples in https://github.com/justinchuby/lintrunner-adapters.
Follow the Black formatter's coding style when possible. A maximum line length of 120 characters is allowed.
Please adhere to the PEP8 Style Guide. We use Google's python style guide as the style guide which is an extension to PEP8.
Auto-formatting is done with black and isort. The tools are configured in pyproject.toml. From the root of the repository, you can run
lintrunner f --all-filesto format Python files.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.