Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,36 @@
"text_decoder.forward = partial(text_decoder_forward, ov_text_decoder_with_past=ov_text_decoder_with_past)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7a3b4c12-d8e9-4f01-a2b3-c4d5e6f7a8b9",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"if not Path(\"./blip_model.py\").exists():\n",
" download_file(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/blip-visual-language-processing/blip_model.py\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "01ba0c67-cc02-4781-bb3a-472146362a7a",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from blip_model import OVBlipModel\n",
"\n",
"ov_model = OVBlipModel(model.config, model.decoder_start_token_id, ov_vision_model, ov_text_encoder, text_decoder)\n",
"out = ov_model.generate_answer(**inputs, max_length=20)"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -618,18 +648,14 @@
{
"cell_type": "code",
"execution_count": null,
"id": "01ba0c67-cc02-4781-bb3a-472146362a7a",
"metadata": {
"tags": []
},
"id": "fd5bfc87",
"metadata": {},
"outputs": [],
"source": [
"if not Path(\"./blip_model.py\").exists():\n",
" download_file(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/blip-visual-language-processing/blip_model.py\")\n",
"from blip_model import OVBlipModel\n",
"from functools import partial\n",
"from blip_model import text_decoder_forward\n",
"\n",
"ov_model = OVBlipModel(model.config, model.decoder_start_token_id, ov_vision_model, ov_text_encoder, text_decoder)\n",
"out = ov_model.generate_answer(**inputs, max_length=20)"
"text_decoder.forward = partial(text_decoder_forward, ov_text_decoder_with_past=ov_text_decoder_with_past)"
]
},
{
Expand Down