Skip to content

Commit

Permalink
Welcome to new version of Olive (microsoft#127)
Browse files Browse the repository at this point in the history
* clean repo

* olive code first commit

* add security.md
  • Loading branch information
jambayk authored Mar 24, 2023
1 parent 4f60e35 commit ff14ee7
Show file tree
Hide file tree
Showing 417 changed files with 18,089 additions and 34,387 deletions.
73 changes: 73 additions & 0 deletions .azure_pipelines/build-doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
trigger:
batch: true
branches:
include:
- main

stages:
- stage: Build_Docs
jobs:
- job: BuildDocs
displayName: Build Docs
pool: $(OLIVE_POOL_UBUNTU2004)

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
displayName: Use Python 3.8

- script: make install-olive PIPELINE=True INSTALL_EXTRAS=[cpu]
displayName: Install Olive

- template: job_templates/run-olive-script.yaml
parameters:
displayName: Make Docs
script: |
cd docs
python -m pip install -r requirements.txt
make html
windows: False

- task: PublishPipelineArtifact@1
inputs:
path: $(Build.SourcesDirectory)/docs/build/html
artifactName: olive_doc_src
artifactType: pipeline
displayName: Publish Docs to Pipeline Artifact

- stage: Publish_Docs
dependsOn: [Build_Docs]
jobs:
- job: PublishDocs
displayName: Publish Docs
pool: $(OLIVE_POOL_UBUNTU2004)

steps:
- checkout: self
clean: true
persistCredentials: true

# checkout gh-pages branch and delete all files
- script: |
git config --global user.email "[email protected]"
git config --global user.name "olivedevteam"
git pull origin gh-pages
git checkout gh-pages
git rm -rf .
displayName: Checkout gh-pages branch
# copy the docs to the root of the repo
- task: DownloadPipelineArtifact@2
inputs:
source: current
artifact: olive_doc_src
path: $(Build.SourcesDirectory)
displayName: Download Docs from Pipeline Artifact

# commit and push the docs
- script: |
git add -A
git commit -m "Update docs from $(Build.SourceVersion)"
git push origin gh-pages
displayName: Commit and Push Docs
28 changes: 28 additions & 0 deletions .azure_pipelines/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
trigger:
- main
pr:
- main

pool:
name: $(OLIVE_POOL_UBUNTU2004)

jobs:
- job: Pylint
strategy:
matrix:
Python37:
python.version: "3.7"
Python38:
python.version: "3.8"

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "$(python.version)"
displayName: "Use Python $(python.version)"

- script: |
python -m pip install pre-commit
pre-commit install
pre-commit run --all-files
displayName: "Formatting checks"
111 changes: 111 additions & 0 deletions .azure_pipelines/job_templates/olive-build-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Olive Build and Test Pipeline template on Azure DevOps

parameters:
name: ''
pool: ''

jobs:
- job: ${{parameters.name}}_Test_Olive
timeoutInMinutes: 300
pool:
name: ${{ parameters.pool}}
variables:
WINDOWS: ${{ parameters.windows}}
runCodesignValidationInjection: false

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
displayName: Use Python 3.8

- script: make install-olive PIPELINE=True INSTALL_EXTRAS=[cpu]
displayName: Install Olive

- task: AzureCLI@1
inputs:
azureSubscription: $(OLIVE_RG_SERVICE_CONNECTION)
scriptLocation: 'inlineScript'
inlineScript: make test PIPELINE=True
displayName: Test Olive
env:
OLIVEWHEELS_STORAGE_CONNECTION_STRING: $(olive-wheels-storage-connection-string)
WORKSPACE_SUBSCRIPTION_ID: $(workspace-subscription-id)
WORKSPACE_RESOURCE_GROUP: $(workspace-resource-group)
WORKSPACE_NAME: $(workspace-name)

- task: ComponentGovernanceComponentDetection@0
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'
displayName: Component Detection

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*TestOlive*.xml'
testRunTitle: '$(Build.BuildNumber)[$(Agent.JobName)]'
displayName: Upload pipeline run test results

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'

- script: make clean WINDOWS=$(WINDOWS)
condition: always()
displayName: Clean remaining artifacts


- job: ${{parameters.name}}_Test_Examples
timeoutInMinutes: 300
pool:
name: ${{ parameters.pool}}
strategy:
matrix:
${{ each exampleName in parameters.exampleName }}:
'${{ exampleName }}':
EXAMPLE: ${{ exampleName }}
variables:
WINDOWS: ${{ parameters.windows }}
runCodesignValidationInjection: false

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
displayName: Use Python 3.8

- script: make install-olive PIPELINE=True INSTALL_EXTRAS=[cpu]
displayName: Install Olive

- task: AzureCLI@1
inputs:
azureSubscription: $(OLIVE_RG_SERVICE_CONNECTION)
scriptLocation: 'inlineScript'
inlineScript: make test-examples PIPELINE=True WINDOWS=$(WINDOWS) EXAMPLE=$(EXAMPLE)
displayName: Test Examples
env:
OLIVEWHEELS_STORAGE_CONNECTION_STRING: $(olive-wheels-storage-connection-string)
WORKSPACE_SUBSCRIPTION_ID: $(workspace-subscription-id)
WORKSPACE_RESOURCE_GROUP: $(workspace-resource-group)
WORKSPACE_NAME: $(workspace-name)

- task: ComponentGovernanceComponentDetection@0
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'
displayName: Component Detection

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*TestOlive*.xml'
testRunTitle: '$(Build.BuildNumber)[$(Agent.JobName)]'
displayName: Upload pipeline run test results

- script: make clean WINDOWS=$(WINDOWS)
condition: always()
displayName: Clean remaining artifacts
30 changes: 30 additions & 0 deletions .azure_pipelines/job_templates/run-olive-script.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Runs a python script in a virtual environment

parameters:
- name: displayName
default: ''
- name: script
default: ''
- name: venv
default: 'olive-venv'
- name: windows
default: ''

steps:
- ${{ if eq(parameters.windows, 'False') }}:
- script: |
source ${{ parameters.venv }}/bin/activate
${{ parameters.script }}
env:
DEVICESASG_CODE_READ_PAT: $(devicesasg-code-read)
OLIVEWHEELS_STORAGE_CONNECTION_STRING: $(olive-wheels-storage-connection-string)
displayName: ${{ parameters.displayName }}
- ${{ if eq(parameters.windows, 'True') }}:
- script: |
call ${{ parameters.venv }}\\Scripts\\activate.bat
call ${{ parameters.script }}
env:
DEVICESASG_CODE_READ_PAT: $(devicesasg-code-read)
OLIVEWHEELS_STORAGE_CONNECTION_STRING: $(olive-wheels-storage-connection-string)
displayName: ${{ parameters.displayName }}
36 changes: 36 additions & 0 deletions .azure_pipelines/olive-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
trigger:
branches:
include:
- main
paths:
exclude:
- docs/*
- examples/**/README.md
- README.md
- CONTRIBUTING.md
- LICENSE
pr:
branches:
include:
- main
paths:
exclude:
- docs/*
- examples/**/README.md
- README.md
- CONTRIBUTING.md
- LICENSE

jobs:
- template: job_templates/olive-build-template.yaml
parameters:
name: Linux_CI
pool: $(OLIVE_POOL_UBUNTU2004)
windows: False
exampleName: ["cifar10_openvino_intel_hw", "bert_ptq_cpu", "resnet_ptq_cpu"]
- template: job_templates/olive-build-template.yaml
parameters:
name: Windows_CI
pool: $(OLIVE_POOL_WIN2019)
windows: True
exampleName: ["cifar10_openvino_intel_hw", "bert_ptq_cpu", "resnet_ptq_cpu"]
19 changes: 19 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[run]
omit =
olive/logging.py
olive/passes/pytorch/pytorch_lightning_utils.py
olive/passes/pytorch/qat_utils.py
olive/systems/azureml/aml_evaluation_runner.py
olive/systems/azureml/aml_pass_runner.py
olive/systems/docker/eval.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if __name__ == .__main__.:
class .*\bConfig\):
@(abc\.)?abstractmethod
@(abc\.)?staticmethod
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 120
per-file-ignores = __init__.py:F401
82 changes: 0 additions & 82 deletions .github/workflows/OLive-Tests.yml

This file was deleted.

Loading

0 comments on commit ff14ee7

Please sign in to comment.