Skip to content

Commit

Permalink
fix style in rag notebook (#2677)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Jan 21, 2025
1 parent e64828a commit aa0f43c
Showing 1 changed file with 3 additions and 61 deletions.
64 changes: 3 additions & 61 deletions notebooks/llm-rag-langchain/llm-rag-langchain-genai.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,62 +72,10 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "1f077b32-5d36-44b0-9041-407e996283a3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Looking in indexes: https://pypi.org/simple, https://storage.openvinotoolkit.org/simple/wheels/nightly\n",
"Requirement already satisfied: openvino>=2024.2.0 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (2025.0.0.dev20250115)\n",
"Requirement already satisfied: numpy<2.3.0,>=1.16.6 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino>=2024.2.0) (1.26.4)\n",
"Requirement already satisfied: openvino-telemetry>=2023.2.1 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino>=2024.2.0) (2024.1.0)\n",
"Requirement already satisfied: packaging in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino>=2024.2.0) (24.2)\n",
"Looking in indexes: https://pypi.org/simple, https://storage.openvinotoolkit.org/simple/wheels/nightly\n",
"Requirement already satisfied: openvino-tokenizers[transformers] in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (2025.0.0.0.dev20250115)\n",
"Requirement already satisfied: openvino~=2025.0.0.dev in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino-tokenizers[transformers]) (2025.0.0.dev20250115)\n",
"Requirement already satisfied: transformers>=4.36.0 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (4.46.3)\n",
"Requirement already satisfied: tiktoken in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino-tokenizers[transformers]) (0.8.0)\n",
"Requirement already satisfied: numpy<2.3.0,>=1.16.6 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino~=2025.0.0.dev->openvino-tokenizers[transformers]) (1.26.4)\n",
"Requirement already satisfied: openvino-telemetry>=2023.2.1 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino~=2025.0.0.dev->openvino-tokenizers[transformers]) (2024.1.0)\n",
"Requirement already satisfied: packaging in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino~=2025.0.0.dev->openvino-tokenizers[transformers]) (24.2)\n",
"Requirement already satisfied: filelock in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (3.16.1)\n",
"Requirement already satisfied: huggingface-hub<1.0,>=0.23.2 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (0.27.1)\n",
"Requirement already satisfied: pyyaml>=5.1 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (6.0.2)\n",
"Requirement already satisfied: regex!=2019.12.17 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (2024.11.6)\n",
"Requirement already satisfied: requests in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (2.32.3)\n",
"Requirement already satisfied: tokenizers<0.21,>=0.20 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (0.20.3)\n",
"Requirement already satisfied: safetensors>=0.4.1 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (0.4.5)\n",
"Requirement already satisfied: tqdm>=4.27 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (4.67.0)\n",
"Requirement already satisfied: sentencepiece!=0.1.92,>=0.1.91 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (0.2.0)\n",
"Requirement already satisfied: protobuf in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (5.28.3)\n",
"Requirement already satisfied: fsspec>=2023.5.0 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.23.2->transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (2024.9.0)\n",
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.23.2->transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (4.12.2)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from requests->transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (3.4.0)\n",
"Requirement already satisfied: idna<4,>=2.5 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from requests->transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (3.10)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from requests->transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (2.2.3)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from requests->transformers>=4.36.0->transformers[sentencepiece]>=4.36.0; extra == \"transformers\"->openvino-tokenizers[transformers]) (2024.8.30)\n",
"Looking in indexes: https://pypi.org/simple, https://storage.openvinotoolkit.org/simple/wheels/nightly\n",
"Requirement already satisfied: openvino_genai in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (2025.0.0.0.dev20250115)\n",
"Requirement already satisfied: openvino_tokenizers~=2025.0.0.0.dev in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino_genai) (2025.0.0.0.dev20250115)\n",
"Requirement already satisfied: openvino~=2025.0.0.dev in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino_tokenizers~=2025.0.0.0.dev->openvino_genai) (2025.0.0.dev20250115)\n",
"Requirement already satisfied: numpy<2.3.0,>=1.16.6 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino~=2025.0.0.dev->openvino_tokenizers~=2025.0.0.0.dev->openvino_genai) (1.26.4)\n",
"Requirement already satisfied: openvino-telemetry>=2023.2.1 in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino~=2025.0.0.dev->openvino_tokenizers~=2025.0.0.0.dev->openvino_genai) (2024.1.0)\n",
"Requirement already satisfied: packaging in /home2/ethan/intel/openvino_notebooks/openvino_venv/lib/python3.10/site-packages (from openvino~=2025.0.0.dev->openvino_tokenizers~=2025.0.0.0.dev->openvino_genai) (24.2)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"llama-index-embeddings-openvino 0.5.0 requires huggingface-hub<0.24.0,>=0.23.0, but you have huggingface-hub 0.27.1 which is incompatible.\u001b[0m\u001b[31m\n",
"\u001b[0m"
]
}
],
"outputs": [],
"source": [
"import os\n",
"import requests\n",
Expand Down Expand Up @@ -274,7 +222,6 @@
"outputs": [],
"source": [
"from pathlib import Path\n",
"import torch\n",
"import ipywidgets as widgets"
]
},
Expand Down Expand Up @@ -1273,6 +1220,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "6de9169f-3ed3-4027-97ef-5e3e0b2b8e20",
"metadata": {},
Expand Down Expand Up @@ -1324,9 +1272,6 @@
],
"source": [
"from ov_langchain_helper import OpenVINOLLM\n",
"import openvino.properties as props\n",
"import openvino.properties.hint as hints\n",
"import openvino.properties.streams as streams\n",
"\n",
"\n",
"if model_to_run.value == \"INT4\":\n",
Expand All @@ -1338,9 +1283,6 @@
"print(f\"Loading model from {model_dir}\")\n",
"\n",
"\n",
"# from transformers import AutoTokenizer\n",
"# tokenizer = AutoTokenizer.from_pretrained(str(model_dir))\n",
"\n",
"llm = OpenVINOLLM.from_model_path(\n",
" model_path=str(model_dir),\n",
" device=llm_device.value,\n",
Expand Down

0 comments on commit aa0f43c

Please sign in to comment.