Skip to content

Commit

Permalink
offline experience fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Feb 3, 2025
1 parent 9f4fefd commit e678798
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,7 @@
"\n",
"comp_text_encoder = core.compile_model(TEXT_ENCODER_OV, device.value)\n",
"comp_text_decoder_with_past = core.compile_model(TEXT_DECODER_OV, device.value)\n",
"comp_vision_model = core.compile_model(VISION_MODEL_OV, device.value)\n",
"fp_text_decoder.forward = partial(text_decoder_forward, ov_text_decoder_with_past=comp_text_decoder_with_past)\n",
"fp16_model = OVBlipModel(model.config, model.decoder_start_token_id, comp_vision_model, comp_text_encoder, fp_text_decoder)"
]
Expand Down
16 changes: 8 additions & 8 deletions notebooks/depth-anything/depth-anything.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@
" r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py\",\n",
" )\n",
" open(\"cmd_helper.py\", \"w\").write(r.text)\n",
"\n",
"if not Path(\"notebook_utils.py\").exists():\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)"
" open(\"cmd_helper.py\", \"w\").write(r.text)"
]
},
{
Expand Down Expand Up @@ -109,7 +103,13 @@
"if platform.system() == \"Darwin\":\n",
" %pip install -q \"numpy<2.0.0\"\n",
"if platform.python_version_tuple()[1] in [\"8\", \"9\"]:\n",
" %pip install -q \"gradio-imageslider<=0.0.17\" \"typing-extensions>=4.9.0\""
" %pip install -q \"gradio-imageslider<=0.0.17\" \"typing-extensions>=4.9.0\"\n",
"\n",
"if not Path(\"notebook_utils.py\").exists():\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)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,12 +1080,13 @@
"source": [
"import io\n",
"import requests\n",
"from diffusers.utils import load_image\n",
"\n",
"default_image_path = Path(\"default_image.png\")\n",
"default_url = \"https://user-images.githubusercontent.com/29454499/223343459-4ac944f0-502e-4acf-9813-8e9f0abc8a16.jpg\"\n",
"\n",
"if not default_image_path.exists():\n",
" img = PIL.Image.open(io.BytesIO(requests.get(default_url, stream=True).raw))\n",
" img = load_image(default_url)\n",
" img.save(default_image_path)\n",
"\n",
"default_image = PIL.Image.open(default_image_path)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
" )\n",
"\n",
" open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"from notebook_utils import load_image, device_widget\n",
"from notebook_utils import download_file, device_widget\n",
"\n",
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
"from notebook_utils import collect_telemetry\n",
Expand Down Expand Up @@ -290,14 +290,14 @@
}
],
"source": [
"# The `image_file` variable can point to a URL or a local image.\n",
"image_url = \"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/intel_rnb.jpg\"\n",
"\n",
"image_path = Path(\"intel_rnb.jpg\")\n",
"\n",
"if not image_path.exists():\n",
" image = load_image(image_url)\n",
" cv2.imwrite(str(image_path), image)\n",
" download_file(\n",
" url=\"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/intel_rnb.jpg\",\n",
" filename=image_path.name,\n",
" directory=image_path.parent,\n",
" )\n",
"else:\n",
" image = cv2.imread(str(image_path))\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@
"# Fetch `notebook_utils` module\n",
"import requests\n",
"\n",
"if Path(\"notebook_utils.py\").exists():\n",
"if not Path(\"notebook_utils.py\").exists():\n",
" r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
" )\n",
"\n",
" open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import download_file, VideoPlayer, device_widget\n",
"\n",
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"# Fetch `notebook_utils` module\n",
"import requests\n",
"\n",
"if not Path(\"notebook_utils.py\").exists()\n",
"if not Path(\"notebook_utils.py\").exists():\n",
" r = requests.get(\n",
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
" )\n",
Expand Down

0 comments on commit e678798

Please sign in to comment.