diff --git a/notebooks/async-api/async-api.ipynb b/notebooks/async-api/async-api.ipynb index 596ff0dae97..28a7f8f9ffe 100644 --- a/notebooks/async-api/async-api.ipynb +++ b/notebooks/async-api/async-api.ipynb @@ -56,7 +56,7 @@ "outputs": [], "source": [ "%pip install -q \"openvino>=2023.1.0\"\n", - "%pip install -q opencv-python \"matplotlib>=3.4\"" + "%pip install -q opencv-python tqdm \"matplotlib>=3.4\"" ] }, { @@ -116,15 +116,23 @@ } ], "source": [ + "from pathlib import Path\n", + "\n", "# directory where model will be downloaded\n", "base_model_dir = \"model\"\n", "\n", "# model name as named in Open Model Zoo\n", "model_name = \"person-detection-0202\"\n", "precision = \"FP16\"\n", - "model_path = f\"model/intel/{model_name}/{precision}/{model_name}.xml\"\n", - "download_command = f\"omz_downloader \" f\"--name {model_name} \" f\"--precision {precision} \" f\"--output_dir {base_model_dir} \" f\"--cache_dir {base_model_dir}\"\n", - "! $download_command" + "model_path = Path(\"model\") / f\"{model_name}.xml\"\n", + "\n", + "base_model_url = \"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2023.0/models_bin/1\"\n", + "\n", + "if not Path(model_path).exists():\n", + " utils.download_file(f\"{base_model_url}/{model_name}/{precision}/{model_name}.xml\", filename=model_path.name, directory=model_path.parent)\n", + " utils.download_file(\n", + " f\"{base_model_url}/{model_name}/{precision}/{model_name}.bin\", filename=model_path.name.replace(\".xml\", \".bin\"), directory=model_path.parent\n", + " )" ] }, { @@ -270,7 +278,10 @@ "metadata": {}, "outputs": [], "source": [ - "video_path = \"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/video/CEO%20Pat%20Gelsinger%20on%20Leading%20Intel.mp4\"" + "video_url = \"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/video/CEO%20Pat%20Gelsinger%20on%20Leading%20Intel.mp4\"\n", + "video_path = Path(\"data/test_video.mp4\")\n", + "if not video_path.exists():\n", + " utils.download_file(video_url, video_path.name, video_path.parent)" ] }, { diff --git a/notebooks/omniparser/omniparser.ipynb b/notebooks/omniparser/omniparser.ipynb index f4198dc9888..ab5183aba41 100644 --- a/notebooks/omniparser/omniparser.ipynb +++ b/notebooks/omniparser/omniparser.ipynb @@ -61,8 +61,13 @@ "metadata": {}, "outputs": [], "source": [ - "%pip install -q \"torch>=2.1\" easyocr torchvision accelerate \"supervision==0.18.0\" accelerate timm \"einops==0.8.0\" \"ultralytics==8.1.24\" pillow opencv-python \"gradio>=4.19\" --extra-index-url https://download.pytorch.org/whl/cpu\n", - "%pip install -q \"openvino>=2024.4.0\"" + "import platform\n", + "\n", + "%pip install -q \"torch>=2.1\" easyocr torchvision accelerate \"supervision==0.18.0\" \"transformers>=4.45\" timm \"einops==0.8.0\" \"ultralytics==8.1.24\" pillow opencv-python \"gradio>=4.19\" --extra-index-url https://download.pytorch.org/whl/cpu\n", + "%pip install -q \"openvino>=2024.4.0\"\n", + "\n", + "if platform.system() == \"Darwin\":\n", + " %pip install -q \"numpy<2.0\"" ] }, { @@ -77,16 +82,21 @@ "\n", "notebook_utils_path = Path(\"notebook_utils.py\")\n", "florence_helper_path = Path(\"ov_florence2_helper.py\")\n", + "omniparser_helper_path = Path(\"ov_omniparser_helper.py\")\n", "\n", "if not notebook_utils_path.exists():\n", " r = requests.get(\n", " url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n", " )\n", - " notebook_utils_path.open(\"w\").write(r.text)\n", + " notebook_utils_path.open(\"w\", encoding=\"utf-8\").write(r.text)\n", "\n", "if not florence_helper_path.exists():\n", " r = requests.get(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/florence2/ov_florence2_helper.py\")\n", - " florence_helper_path.open(\"w\").write(r.text)" + " florence_helper_path.open(\"w\", encoding=\"utf-8\").write(r.text)\n", + "\n", + "if not omniparser_helper_path.exists():\n", + " r = requests.get(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/omniparser/ov_omniparser_helper.py\")\n", + " omniparser_helper_path.open(\"w\", encoding=\"utf-8\").write(r.text)" ] }, { diff --git a/notebooks/stable-diffusion-v3/stable-diffusion-v3-torch-fx.ipynb b/notebooks/stable-diffusion-v3/stable-diffusion-v3-torch-fx.ipynb index a02509a2211..5d804ba5d84 100644 --- a/notebooks/stable-diffusion-v3/stable-diffusion-v3-torch-fx.ipynb +++ b/notebooks/stable-diffusion-v3/stable-diffusion-v3-torch-fx.ipynb @@ -88,7 +88,7 @@ "source": [ "%pip install -q \"gradio>=4.19\" \"torch>=2.5\" \"torchvision>=0.20\" \"numpy<2.0\" \"transformers\" \"datasets>=2.14.6\" \"opencv-python\" \"pillow\" \"peft>=0.7.0\" \"diffusers>=0.31.0\" --extra-index-url https://download.pytorch.org/whl/cpu\n", "%pip install -qU \"openvino>=2024.3.0\"\n", - "%pip install -q \"nncf>=2.14.0\"" + "%pip install -q \"nncf>=2.14.0\" \"typing_extensions>=4.11\"" ] }, {