Skip to content

Commit

Permalink
update notebooks failed on windows (#2019)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored May 15, 2024
1 parent 0f247aa commit df9fd4e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 38 deletions.
27 changes: 17 additions & 10 deletions .ci/patch_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,36 @@ def has_additional_deps(str_part):
if "openvino" in line:
updated_line_content = []
empty = True
package_found = False
for part in line.split(" "):
if "openvino-dev" in part:
package_found = True
continue
if "openvino-nightly" in part:
package_found = True
continue
if "openvino-tokenizers" in part:
package_found = True
continue
if "openvino>" in part or "openvino=" in part or "openvino" == part:
package_found = True
continue
if empty:
empty = not has_additional_deps(part)
updated_line_content.append(part)

updated_lines.append("# " + line)
if not empty:
updated_line = " ".join(updated_line_content)
if line.startswith(" "):
for token in line:
if token != " ":
break
# keep indention
updated_line = " " + updated_line
updated_lines.append(updated_line)
if package_found:
if not empty:
updated_line = " ".join(updated_line_content)
if line.startswith(" "):
for token in line:
if token != " ":
break
# keep indention
updated_line = " " + updated_line
updated_lines.append(updated_line + "# " + line)
else:
updated_lines.append(line)
else:
updated_lines.append(line)
cell["source"] = "\n".join(updated_lines)
Expand Down
40 changes: 12 additions & 28 deletions notebooks/grounded-segment-anything/grounded-segment-anything.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -27,7 +26,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -41,12 +39,10 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -q timm --extra-index-url https://download.pytorch.org/whl/cpu # is needed for torch\n",
"%pip install -q \"openvino>=2024.0\" \"torch>=2.1\" opencv-python supervision transformers yapf pycocotools addict \"gradio>=4.19\" tqdm"
"%pip install -q \"openvino>=2024.0\" \"torch>=2.1\" opencv-python supervision transformers yapf pycocotools addict \"gradio>=4.19\" tqdm timm --extra-index-url https://download.pytorch.org/whl/cpu"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -139,7 +135,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -202,7 +197,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -288,7 +282,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -342,7 +335,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -381,7 +373,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -398,7 +389,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -531,7 +521,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -552,7 +541,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -586,15 +574,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Great! All clouds and horses are detected. Feel free to play around and specify other objects you wish to detect."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -603,7 +589,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -633,7 +618,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -727,7 +711,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -736,7 +719,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -832,7 +814,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -857,7 +838,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -894,15 +874,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Great! All detected horses and clouds are segmented as well."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -911,7 +889,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1014,7 +991,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1062,7 +1038,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1098,7 +1073,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.8.10"
},
"openvino_notebooks": {
"imageUrl": "https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/a382458f-7a46-451c-ad42-605f406a213e",
Expand All @@ -1111,12 +1086,21 @@
"Live Demos"
],
"libraries": [],
"other": ["Segment Anything"],
"other": [
"Segment Anything"
],
"tasks": [
"Object Detection",
"Image Segmentation"
]
}
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"%pip install -q \"tensorflow-macos>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine == 'arm64'\"\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine != 'arm64'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform != 'darwin'\"\n",
"%pip install -q \"tensorflow-datasets>=4.9.0,<4.9.3; latform_system=='Windows'\"\n",
"%pip install -q \"tensorflow-datasets>=4.9.0\""
]
},
Expand Down

0 comments on commit df9fd4e

Please sign in to comment.