Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenVINO notebooks #603

Merged
merged 1 commit into from
Mar 15, 2024
Merged
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/test_openvino_notebooks.yml
Original file line number Diff line number Diff line change
@@ -49,5 +49,7 @@ jobs:

- name: Test with Pytest
run: |
sed -i 's/NUM_TRAIN_ITEMS = 600/NUM_TRAIN_ITEMS = 10/' notebooks/openvino/question_answering_quantization.ipynb
sed -i 's/# %pip install/%pip install/' notebooks/openvino/optimum_openvino_inference.ipynb
python -m pytest --nbval-lax notebooks/openvino/optimum_openvino_inference.ipynb notebooks/openvino/question_answering_quantization.ipynb
428 changes: 221 additions & 207 deletions notebooks/openvino/optimum_openvino_inference.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions notebooks/openvino/question_answering_quantization.ipynb
Original file line number Diff line number Diff line change
@@ -846,9 +846,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"FP32 model size: 436.07 MB\n",
"INT8 model size: 182.41 MB\n",
"INT8 size decrease: 2.39x\n"
"FP32 model size: 436.50 MB\n",
"INT8 model size: 181.84 MB\n",
"INT8 size decrease: 2.4x\n"
]
}
],
@@ -858,15 +858,15 @@
" Return OpenVINO or PyTorch model size in Mb.\n",
" Arguments:\n",
" model_folder:\n",
" Directory containing a pytorch_model.bin for a PyTorch model, and an openvino_model.xml/.bin for an OpenVINO model.\n",
" Directory containing a model.safetensors for a PyTorch model, and an openvino_model.xml/.bin for an OpenVINO model.\n",
" framework:\n",
" Define whether the model is a PyTorch or an OpenVINO model.\n",
" \"\"\"\n",
" if framework.lower() == \"openvino\":\n",
" model_path = Path(model_folder) / \"openvino_model.xml\"\n",
" model_size = model_path.stat().st_size + model_path.with_suffix(\".bin\").stat().st_size\n",
" elif framework.lower() == \"pytorch\":\n",
" model_path = Path(model_folder) / \"pytorch_model.bin\"\n",
" model_path = Path(model_folder) / \"model.safetensors\"\n",
" model_size = model_path.stat().st_size\n",
" model_size /= 1000 * 1000\n",
" return model_size\n",