Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalandi committed Sep 19, 2024
1 parent a598335 commit 331026f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 59 deletions.
3 changes: 2 additions & 1 deletion .ci/ignore_treon_docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ notebooks/stable-audio/stable-audio.ipynb
notebooks/internvl2/internvl2.ipynb
notebooks/qwen2-vl/qwen2-vl.ipynb
notebooks/qwen2-audio/qwen2-audio.ipynb
notebooks/stable-fast-3d/stable-fast-3d.ipynb
notebooks/stable-fast-3d/stable-fast-3d.ipynb
notebooks/segment-anything/segment-anything-2-video.ipynb
20 changes: 15 additions & 5 deletions .ci/patch_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ def disable_skip_ext(nb, notebook_path, test_device=""):
skip_for_device = None if test_device else False
for cell in nb["cells"]:
if test_device is not None and skip_for_device is None:
if 'skip_for_device = "{}" in device.value'.format(test_device.upper()) in cell["source"] and (
"to_quantize = widgets.Checkbox(value=not skip_for_device" in cell["source"]
or "to_quantize = quantization_widget(not skip_for_device" in cell["source"]
if (
'skip_for_device = "{}" in device.value'.format(test_device.upper()) in cell["source"]
and (
"to_quantize = widgets.Checkbox(value=not skip_for_device" in cell["source"]
or "to_quantize = quantization_widget(not skip_for_device" in cell["source"]
)
or ("to_quantize = quantization_widget(False" in cell["source"])
):
skip_for_device = True

Expand Down Expand Up @@ -152,7 +156,11 @@ def patch_notebooks(notebooks_dir, test_device="", skip_ov_install=False):
if test_device and (DEVICE_WIDGET in cell["source"] or DEVICE_WIDGET_NEW in cell["source"]):
device_found = True
if not DEVICE_WIDGET_NEW in cell["source"]:
cell["source"] = re.sub(r"value=.*,", f"value='{test_device.upper()}',", cell["source"])
cell["source"] = re.sub(
r"value=.*,",
f"value='{test_device.upper()}',",
cell["source"],
)
cell["source"] = re.sub(
r"options=",
f"options=['{test_device.upper()}'] + ",
Expand All @@ -161,7 +169,9 @@ def patch_notebooks(notebooks_dir, test_device="", skip_ov_install=False):
print(f"Replaced testing device to {test_device}")
else:
cell["source"] = re.sub(
r"device_widget\(.*\)", f"device_widget(default='{test_device.upper()}', added=['{test_device.upper()}'])", cell["source"]
r"device_widget\(.*\)",
f"device_widget(default='{test_device.upper()}', added=['{test_device.upper()}'])",
cell["source"],
)
replace_dict = cell.get("metadata", {}).get("test_replace")
if replace_dict is not None:
Expand Down
2 changes: 2 additions & 0 deletions .ci/skipped_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,12 @@
- '3.9'
- os:
- macos-12
- windows-2019
- notebook: notebooks/segment-anything/segment-anything-2-video.ipynb
skips:
- python:
- '3.8'
- '3.9'
- os:
- macos-12
- windows-2019
40 changes: 12 additions & 28 deletions notebooks/segment-anything/segment-anything-2-image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,14 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "133014d4-6766-48c5-94b6-9c78b9dfe309",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n",
"Requirement already satisfied: iopath>=0.1.10 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (0.1.10)\n",
"Requirement already satisfied: pillow>=9.4.0 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (10.4.0)\n",
"Requirement already satisfied: hydra-core>=1.3.2 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (1.3.2)\n",
"Requirement already satisfied: portalocker in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from iopath>=0.1.10) (2.10.1)\n",
"Requirement already satisfied: typing-extensions in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from iopath>=0.1.10) (4.12.2)\n",
"Requirement already satisfied: tqdm in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from iopath>=0.1.10) (4.66.5)\n",
"Requirement already satisfied: omegaconf<2.4,>=2.2 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from hydra-core>=1.3.2) (2.3.0)\n",
"Requirement already satisfied: packaging in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from hydra-core>=1.3.2) (24.1)\n",
"Requirement already satisfied: antlr4-python3-runtime==4.9.* in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from hydra-core>=1.3.2) (4.9.3)\n",
"Requirement already satisfied: PyYAML>=5.1.0 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from omegaconf<2.4,>=2.2->hydra-core>=1.3.2) (6.0.2)\n",
"Note: you may need to restart the kernel to use updated packages.\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"outputs": [],
"source": [
"import platform\n",
"\n",
"\n",
"%pip install -q \"gradio>=4.13\" \"openvino>=2024.3.0\" \"nncf>=2.12\" \"torch>=2.3.1\" \"torchvision>=0.18.1\" opencv-python tqdm numpy --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install \"iopath>=0.1.10\" \"pillow>=9.4.0\" \"hydra-core>=1.3.2\"\n",
"\n",
Expand All @@ -119,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "662e0f0d",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -160,14 +141,18 @@
],
"source": [
"import sys\n",
"import os\n",
"\n",
"sam2_dir = Path(\"segment-anything-2\")\n",
"\n",
"if not sam2_dir.exists():\n",
" !git clone https://github.com/facebookresearch/segment-anything-2.git\n",
" exit_code = os.system(\"git clone https://github.com/facebookresearch/segment-anything-2.git\")\n",
" if exit_code != 0:\n",
" raise Exception(\"Failed to clone the repository!\")\n",
"\n",
"# append to sys.path so that modules from the repo could be imported\n",
"sys.path.append(str(sam2_dir))\n",
"if str(sam2_dir.resolve()) not in sys.path:\n",
" # append to sys.path so that modules from the repo could be imported\n",
" sys.path.insert(0, str(sam2_dir.resolve()))\n",
"\n",
"%env SAM2_BUILD_CUDA=0"
]
Expand Down Expand Up @@ -1442,8 +1427,7 @@
"source": [
"from notebook_utils import quantization_widget\n",
"\n",
"skip_for_device = \"CPU\" in device.value\n",
"to_quantize = quantization_widget(not skip_for_device)\n",
"to_quantize = quantization_widget(False)\n",
"to_quantize"
]
},
Expand Down
35 changes: 10 additions & 25 deletions notebooks/segment-anything/segment-anything-2-video.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,33 +73,14 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "133014d4-6766-48c5-94b6-9c78b9dfe309",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n",
"Requirement already satisfied: iopath>=0.1.10 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (0.1.10)\n",
"Requirement already satisfied: pillow>=9.4.0 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (10.4.0)\n",
"Requirement already satisfied: hydra-core>=1.3.2 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (1.3.2)\n",
"Requirement already satisfied: tqdm in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from iopath>=0.1.10) (4.66.5)\n",
"Requirement already satisfied: portalocker in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from iopath>=0.1.10) (2.10.1)\n",
"Requirement already satisfied: typing-extensions in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from iopath>=0.1.10) (4.12.2)\n",
"Requirement already satisfied: packaging in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from hydra-core>=1.3.2) (24.1)\n",
"Requirement already satisfied: omegaconf<2.4,>=2.2 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from hydra-core>=1.3.2) (2.3.0)\n",
"Requirement already satisfied: antlr4-python3-runtime==4.9.* in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from hydra-core>=1.3.2) (4.9.3)\n",
"Requirement already satisfied: PyYAML>=5.1.0 in /home/labuser/work/notebook/sam2/lib/python3.10/site-packages (from omegaconf<2.4,>=2.2->hydra-core>=1.3.2) (6.0.2)\n",
"Note: you may need to restart the kernel to use updated packages.\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"outputs": [],
"source": [
"import platform\n",
"\n",
"\n",
"%pip install -q \"gradio>=4.13\" \"openvino>=2024.3.0\" \"nncf>=2.12\" \"torch>=2.3.1\" \"torchvision>=0.18.1\" opencv-python tqdm numpy --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install \"iopath>=0.1.10\" \"pillow>=9.4.0\" \"hydra-core>=1.3.2\"\n",
"\n",
Expand Down Expand Up @@ -152,14 +133,18 @@
],
"source": [
"import sys\n",
"import os\n",
"\n",
"sam2_dir = Path(\"segment-anything-2\")\n",
"\n",
"if not sam2_dir.exists():\n",
" !git clone https://github.com/facebookresearch/segment-anything-2.git\n",
" exit_code = os.system(\"git clone https://github.com/facebookresearch/segment-anything-2.git\")\n",
" if exit_code != 0:\n",
" raise Exception(\"Failed to clone the repository!\")\n",
"\n",
"# append to sys.path so that modules from the repo could be imported\n",
"sys.path.append(str(sam2_dir))\n",
"if str(sam2_dir.resolve()) not in sys.path:\n",
" # append to sys.path so that modules from the repo could be imported\n",
" sys.path.insert(0, str(sam2_dir.resolve()))\n",
"\n",
"%env SAM2_BUILD_CUDA=0"
]
Expand Down

0 comments on commit 331026f

Please sign in to comment.