Skip to content

Commit

Permalink
2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Aug 27, 2024
1 parent b90aff1 commit f8070a5
Show file tree
Hide file tree
Showing 51 changed files with 563 additions and 432 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"\n",
"quantized_model_present = QUANTIZED_TRANSFORMER_OV_PATH.exists()\n",
"\n",
"use_quantized_model = widgets.Checkbox(\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,9 @@
}
],
"source": [
"to_quantize = widgets.Checkbox(\n",
" value=True,\n",
" description=\"Quantization\",\n",
" disabled=False,\n",
")\n",
"from notebook_utils import quantization_widget\n",
"\n",
"to_quantize = quantization_widget()\n",
"to_quantize"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@
"from notebook_utils import quantization_widget\n",
"\n",
"skip_for_device = \"GPU\" in device.value\n",
"to_quantize = quantization_widget(skip_for_device)\n",
"to_quantize = quantization_widget(not skip_for_device)\n",
"\n",
"to_quantize"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@
"from notebook_utils import quantization_widget\n",
"\n",
"skip_for_device = \"GPU\" in device.value\n",
"to_quantize = quantization_widget(skip_for_device)\n",
"to_quantize = quantization_widget(not skip_for_device)\n",
"to_quantize"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@
"source": [
"from pathlib import Path\n",
"\n",
"import requests\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"MODEL_DIR = Path(\"model\")\n",
"IMAGE_ENCODER_PATH = MODEL_DIR / \"image_encoder.xml\"\n",
"INPUT_EMBEDDING_PATH = MODEL_DIR / \"input_embeddings.xml\"\n",
Expand Down Expand Up @@ -610,11 +617,9 @@
}
],
"source": [
"to_quantize = widgets.Checkbox(\n",
" value=True,\n",
" description=\"Quantization\",\n",
" disabled=False,\n",
")\n",
"from notebook_utils import quantization_widget\n",
"\n",
"to_quantize = quantization_widget()\n",
"\n",
"to_quantize"
]
Expand Down Expand Up @@ -1227,18 +1232,9 @@
}
],
"source": [
"core = ov.Core()\n",
"from notebook_utils import device_widget\n",
"\n",
"support_devices = core.available_devices\n",
"if \"NPU\" in support_devices:\n",
" support_devices.remove(\"NPU\")\n",
"\n",
"device = widgets.Dropdown(\n",
" options=support_devices + [\"AUTO\"],\n",
" value=\"CPU\",\n",
" description=\"Device:\",\n",
" disabled=False,\n",
")\n",
"device = device_widget(exclude=[\"NPU\"])\n",
"\n",
"device"
]
Expand Down
31 changes: 9 additions & 22 deletions notebooks/llm-agent-react/llm-agent-rag-llamaindex.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
"import requests\n",
"import io\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"text_example_en_path = Path(\"text_example_en.pdf\")\n",
"text_example_en = \"https://github.com/user-attachments/files/16171326/xeon6-e-cores-network-and-edge-brief.pdf\"\n",
"\n",
Expand Down Expand Up @@ -191,8 +196,7 @@
"execution_count": 5,
"id": "86fdc4ba-74c4-4869-898e-131f47827e8f",
"metadata": {
"test_replace": {
}
"test_replace": {}
},
"outputs": [
{
Expand Down Expand Up @@ -522,19 +526,9 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"import openvino as ov\n",
"\n",
"core = ov.Core()\n",
"from notebook_utils import device_widget\n",
"\n",
"support_devices = core.available_devices\n",
"\n",
"llm_device = widgets.Dropdown(\n",
" options=support_devices + [\"AUTO\"],\n",
" value=\"CPU\",\n",
" description=\"Device:\",\n",
" disabled=False,\n",
")\n",
"llm_device = device_widget(\"CPU\", exclude=[\"NPU\"])\n",
"\n",
"llm_device"
]
Expand Down Expand Up @@ -644,14 +638,7 @@
}
],
"source": [
"support_devices = core.available_devices\n",
"\n",
"embedding_device = widgets.Dropdown(\n",
" options=support_devices + [\"AUTO\"],\n",
" value=\"CPU\",\n",
" description=\"Device:\",\n",
" disabled=False,\n",
")\n",
"embedding_device = device_widget()\n",
"\n",
"embedding_device"
]
Expand Down
21 changes: 7 additions & 14 deletions notebooks/llm-agent-react/llm-agent-react-langchain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -331,23 +331,16 @@
}
],
"source": [
"import openvino as ov\n",
"import ipywidgets as widgets\n",
"import requests\n",
"\n",
"core = ov.Core()\n",
"\n",
"support_devices = core.available_devices\n",
"if \"NPU\" in support_devices:\n",
" support_devices.remove(\"NPU\")\n",
"\n",
"device = widgets.Dropdown(\n",
" options=support_devices + [\"AUTO\"],\n",
" value=\"CPU\",\n",
" description=\"Device:\",\n",
" disabled=False,\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import device_widget\n",
"\n",
"device"
"device = device_widget(\"CPU\", exclude=[\"NPU\"])"
]
},
{
Expand Down
32 changes: 21 additions & 11 deletions notebooks/llm-chatbot/llm-chatbot.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "50e1d1d5-3bdd-4224-9f93-bf5d9a83f424",
"metadata": {},
Expand Down Expand Up @@ -48,6 +49,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "5df233b0-0369-4fff-9952-7957a90394a5",
"metadata": {},
Expand Down Expand Up @@ -124,6 +126,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "81983176-e571-4652-ba21-4bd608c35146",
"metadata": {},
Expand Down Expand Up @@ -350,6 +353,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "62af3e8a-915a-49b4-8007-803777ba9eaf",
"metadata": {},
Expand All @@ -369,6 +373,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "13694bf8-ee7b-4186-a3e0-a8705be9733c",
"metadata": {},
Expand Down Expand Up @@ -474,6 +479,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a862a388",
"metadata": {},
Expand Down Expand Up @@ -523,6 +529,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "130a037a-7d98-4152-81ea-92ffb01da5a2",
"metadata": {},
Expand Down Expand Up @@ -677,6 +684,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "671a17d4",
"metadata": {
Expand Down Expand Up @@ -719,6 +727,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "6d62f9f4-5434-4550-b372-c86b5a5089d5",
"metadata": {},
Expand Down Expand Up @@ -754,25 +763,22 @@
}
],
"source": [
"import openvino as ov\n",
"import requests\n",
"\n",
"core = ov.Core()\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"support_devices = core.available_devices\n",
"if \"NPU\" in support_devices:\n",
" support_devices.remove(\"NPU\")\n",
"from notebook_utils import device_widget\n",
"\n",
"device = widgets.Dropdown(\n",
" options=support_devices + [\"AUTO\"],\n",
" value=\"CPU\",\n",
" description=\"Device:\",\n",
" disabled=False,\n",
")\n",
"device = device_widget(\"CPU\", exclude=[\"NPU\"])\n",
"\n",
"device"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c53001e7-615f-4eb5-b831-4e2b2ff32826",
"metadata": {
Expand Down Expand Up @@ -830,6 +836,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f7f63327-f0f5-4e2d-bfc2-0f764f8c19a8",
"metadata": {},
Expand Down Expand Up @@ -939,6 +946,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "24d622d0-be46-47c0-a762-88cb50ab15a9",
"metadata": {},
Expand All @@ -955,6 +963,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "725544ea-05ec-40d7-bbbc-1dc87cf57d04",
"metadata": {},
Expand Down Expand Up @@ -1383,6 +1392,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d69ca0a2",
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,16 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"\n",
"core = ov.Core()\n",
"import requests\n",
"\n",
"device = widgets.Dropdown(\n",
" options=core.available_devices + [\"AUTO\"],\n",
" value=\"AUTO\",\n",
" description=\"Device:\",\n",
" disabled=False,\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import device_widget\n",
"\n",
"device = device_widget()\n",
"\n",
"device"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,16 @@
"source": [
"core = ov.Core()\n",
"\n",
"device = widgets.Dropdown(\n",
" options=core.available_devices + [\"AUTO\"],\n",
" value=\"AUTO\",\n",
" description=\"Device:\",\n",
" disabled=False,\n",
"import requests\n",
"\n",
"r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import device_widget\n",
"\n",
"device = device_widget(\"CPU\", exclude=[\"NPU\"])\n",
"\n",
"device"
]
Expand Down Expand Up @@ -971,9 +975,6 @@
"start_time": "2023-10-12T15:55:36.148877700Z"
},
"collapsed": false,
"test_replace": {
"value=False": "value=True"
}
},
"outputs": [
{
Expand All @@ -993,14 +994,12 @@
}
],
"source": [
"from notebook_utils import quantization_widget\n",
"\n",
"compiled_quantized_lid_model = None\n",
"quantized_asr_model_xml_path_template = None\n",
"\n",
"to_quantize = widgets.Checkbox(\n",
" value=False,\n",
" description=\"Quantization\",\n",
" disabled=False,\n",
")\n",
"to_quantize = quantization_widget()\n",
"\n",
"to_quantize"
]
Expand Down
Loading

0 comments on commit f8070a5

Please sign in to comment.