Skip to content

Commit 967b0cb

Browse files
helena-intelecharlaix
andauthoredMar 22, 2023
Add OpenVINO inference notebook and notebooks test (#230)
* Add OpenVINO inference notebook and notebooks test * Apply suggestions from code review Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com> --------- Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>
1 parent 96dd323 commit 967b0cb

File tree

4 files changed

+1172
-0
lines changed

4 files changed

+1172
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: OpenVINO - Notebooks Test
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '14 3 * * 1' # run weekly: every Monday at 3:14
7+
push:
8+
paths:
9+
- '.github/workflows/test_openvino_notebooks.yml'
10+
- 'notebooks/openvino/*'
11+
pull_request:
12+
paths:
13+
- '.github/workflows/test_openvino_notebooks.yml'
14+
- 'notebooks/openvino/*'
15+
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version: ["3.8", "3.10"]
27+
28+
runs-on: ubuntu-20.04
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
- name: Setup Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v2
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Install dependencies
38+
run: |
39+
# Install PyTorch CPU to prevent unnecessary downloading/installing of CUDA packages
40+
# ffmpeg, torchaudio and pillow are required for image classification and audio classification pipelines
41+
sudo apt-get install ffmpeg
42+
pip install torch torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
43+
pip install ".[tests, openvino]" nbval
44+
pip install -r notebooks/openvino/requirements.txt
45+
46+
- run: free -h
47+
- run: lscpu
48+
- run: pip freeze
49+
50+
- name: Test with Pytest
51+
run: |
52+
python -m pytest --nbval-lax notebooks/openvino/optimum_openvino_inference.ipynb notebooks/openvino/question_answering_quantization.ipynb
53+

‎notebooks/openvino/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# 🤗 Optimum OpenVINO Notebooks
2+
3+
This directory contains notebooks for the OpenVINO integration in 🤗 Optimum. To
4+
install the requirements for running all notebooks, do `pip install -r
5+
requirements.txt`. If you do not want to install the requirements to run all the
6+
notebooks, you can also install the requirements for a specific notebook. They
7+
are listed at the top of each notebook file.
8+
9+
The notebooks have been tested with Python 3.8 and 3.10 on Ubuntu Linux.
10+
11+
| Notebook | Description | | |
12+
|:----------|:-------------|:-------------|------:|
13+
| [How to run inference with the OpenVINO](https://github.com/huggingface/optimum-intel/blob/main/notebooks/openvino/optimum_openvino_inference.ipynb) | Explains how to export your model to OpenVINO and to run inference with OpenVINO Runtime on various tasks| [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/optimum-intel/blob/main/notebooks/openvino/optimum_openvino_inference.ipynb)| [![Open in AWS Studio](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/huggingface/optimum-intel/blob/main/notebooks/openvino/optimum_openvino_inference.ipynb)|
14+
| [How to quantize a question answering model with OpenVINO NNCF](https://github.com/huggingface/optimum-intel/blob/main/notebooks/openvino/question_answering_quantization.ipynb) | Show how to apply post-training quantization on a question answering model using [NNCF](https://github.com/openvinotoolkit/nncf) and to accelerate inference with OpenVINO| [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/optimum-intel/blob/main/notebooks/openvino/question_answering_quantization.ipynb)| [![Open in AWS Studio](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/huggingface/optimum-intel/blob/main/notebooks/openvino/question_answering_quantization.ipynb)|
15+

0 commit comments

Comments
 (0)