diff --git a/main.ipynb b/main.ipynb index 65a586d..1b18941 100644 --- a/main.ipynb +++ b/main.ipynb @@ -59,138 +59,414 @@ "outputId": "960151d8-f350-449e-9d92-eb4e6337de91" }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Invalid requirement: '#': Expected package name at the start of dependency specifier\n", + " #\n", + " ^\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "Requirement already satisfied: transformers in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (4.27.2)\n", - "Requirement already satisfied: filelock in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (3.15.1)\n", - "Requirement already satisfied: huggingface-hub<1.0,>=0.11.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (0.23.3)\n", - "Requirement already satisfied: numpy>=1.17 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (1.26.4)\n", - "Requirement already satisfied: packaging>=20.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (24.0)\n", - "Requirement already satisfied: pyyaml>=5.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (6.0.1)\n", - "Requirement already satisfied: regex!=2019.12.17 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (2024.5.15)\n", - "Requirement already satisfied: requests in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (2.32.3)\n", - "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (0.13.3)\n", - "Requirement already satisfied: tqdm>=4.27 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from transformers) (4.66.4)\n", - "Requirement already satisfied: fsspec>=2023.5.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.11.0->transformers) (2024.5.0)\n", - "Requirement already satisfied: typing-extensions>=3.7.4.3 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.11.0->transformers) (4.11.0)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->transformers) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->transformers) (3.7)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->transformers) (2.2.1)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->transformers) (2024.2.2)\n", - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", "Collecting sentencepiece\n", - " Downloading sentencepiece-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl.metadata (7.7 kB)\n", - "Downloading sentencepiece-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl (1.2 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m8.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m0:01\u001b[0m\n", - "\u001b[?25hInstalling collected packages: sentencepiece\n", - "Successfully installed sentencepiece-0.2.0\n", - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", + " Downloading sentencepiece-0.2.1-cp313-cp313-win_amd64.whl.metadata (10 kB)\n", + "Downloading sentencepiece-0.2.1-cp313-cp313-win_amd64.whl (1.1 MB)\n", + " ---------------------------------------- 0.0/1.1 MB ? eta -:--:--\n", + " --------- ------------------------------ 0.3/1.1 MB ? eta -:--:--\n", + " ---------------------------------------- 1.1/1.1 MB 3.4 MB/s eta 0:00:00\n", + "Installing collected packages: sentencepiece\n", + "Successfully installed sentencepiece-0.2.1\n", "Collecting wikipedia\n", - " Using cached wikipedia-1.4.0-py3-none-any.whl\n", - "Requirement already satisfied: beautifulsoup4 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from wikipedia) (4.12.3)\n", - "Requirement already satisfied: requests<3.0.0,>=2.0.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from wikipedia) (2.32.3)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (3.7)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (2.2.1)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (2024.2.2)\n", - "Requirement already satisfied: soupsieve>1.2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from beautifulsoup4->wikipedia) (2.5)\n", + " Downloading wikipedia-1.4.0.tar.gz (27 kB)\n", + " Preparing metadata (setup.py): started\n", + " Preparing metadata (setup.py): finished with status 'done'\n", + "Requirement already satisfied: beautifulsoup4 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from wikipedia) (4.12.3)\n", + "Requirement already satisfied: requests<3.0.0,>=2.0.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from wikipedia) (2.32.3)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (2.3.0)\n", + "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (2026.1.4)\n", + "Requirement already satisfied: soupsieve>1.2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from beautifulsoup4->wikipedia) (2.5)\n", + "Building wheels for collected packages: wikipedia\n", + " Building wheel for wikipedia (setup.py): started\n", + " Building wheel for wikipedia (setup.py): finished with status 'done'\n", + " Created wheel for wikipedia: filename=wikipedia-1.4.0-py3-none-any.whl size=11704 sha256=9b626e686da55497f3f484f018b433b18d3641ceec22cd0f9737da43853be3f8\n", + " Stored in directory: c:\\users\\con2m\\appdata\\local\\pip\\cache\\wheels\\79\\1d\\c8\\b64e19423cc5a2a339450ea5d145e7c8eb3d4aa2b150cde33b\n", + "Successfully built wikipedia\n", "Installing collected packages: wikipedia\n", - "Successfully installed wikipedia-1.4.0\n", + "Successfully installed wikipedia-1.4.0\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " DEPRECATION: Building 'wikipedia' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'wikipedia'. Discussion can be found at https://github.com/pypa/pip/issues/6334\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting accelerate\n", + " Downloading accelerate-1.13.0-py3-none-any.whl.metadata (19 kB)\n", + "Requirement already satisfied: numpy>=1.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from accelerate) (2.1.3)\n", + "Requirement already satisfied: packaging>=20.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from accelerate) (24.2)\n", + "Requirement already satisfied: psutil in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from accelerate) (5.9.0)\n", + "Requirement already satisfied: pyyaml in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from accelerate) (6.0.2)\n", + "Requirement already satisfied: torch>=2.0.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from accelerate) (2.11.0)\n", + "Requirement already satisfied: huggingface_hub>=0.21.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from accelerate) (1.7.2)\n", + "Requirement already satisfied: safetensors>=0.4.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from accelerate) (0.7.0)\n", + "Requirement already satisfied: filelock>=3.10.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface_hub>=0.21.0->accelerate) (3.17.0)\n", + "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface_hub>=0.21.0->accelerate) (2025.3.2)\n", + "Requirement already satisfied: hf-xet<2.0.0,>=1.4.2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface_hub>=0.21.0->accelerate) (1.4.2)\n", + "Requirement already satisfied: httpx<1,>=0.23.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface_hub>=0.21.0->accelerate) (0.28.1)\n", + "Requirement already satisfied: tqdm>=4.42.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface_hub>=0.21.0->accelerate) (4.67.1)\n", + "Requirement already satisfied: typer in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface_hub>=0.21.0->accelerate) (0.9.0)\n", + "Requirement already satisfied: typing-extensions>=4.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface_hub>=0.21.0->accelerate) (4.12.2)\n", + "Requirement already satisfied: anyio in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface_hub>=0.21.0->accelerate) (4.7.0)\n", + "Requirement already satisfied: certifi in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface_hub>=0.21.0->accelerate) (2026.1.4)\n", + "Requirement already satisfied: httpcore==1.* in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface_hub>=0.21.0->accelerate) (1.0.9)\n", + "Requirement already satisfied: idna in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface_hub>=0.21.0->accelerate) (3.7)\n", + "Requirement already satisfied: h11>=0.16 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->huggingface_hub>=0.21.0->accelerate) (0.16.0)\n", + "Requirement already satisfied: setuptools<82 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=2.0.0->accelerate) (72.1.0)\n", + "Requirement already satisfied: sympy>=1.13.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=2.0.0->accelerate) (1.13.3)\n", + "Requirement already satisfied: networkx>=2.5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=2.0.0->accelerate) (3.4.2)\n", + "Requirement already satisfied: jinja2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=2.0.0->accelerate) (3.1.6)\n", + "Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sympy>=1.13.3->torch>=2.0.0->accelerate) (1.3.0)\n", + "Requirement already satisfied: colorama in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tqdm>=4.42.1->huggingface_hub>=0.21.0->accelerate) (0.4.6)\n", + "Requirement already satisfied: sniffio>=1.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from anyio->httpx<1,>=0.23.0->huggingface_hub>=0.21.0->accelerate) (1.3.0)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from jinja2->torch>=2.0.0->accelerate) (3.0.2)\n", + "Requirement already satisfied: click<9.0.0,>=7.1.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from typer->huggingface_hub>=0.21.0->accelerate) (8.1.8)\n", + "Downloading accelerate-1.13.0-py3-none-any.whl (383 kB)\n", + "Installing collected packages: accelerate\n", + "Successfully installed accelerate-1.13.0\n", + "Collecting tf-keras\n", + " Downloading tf_keras-2.21.0-py3-none-any.whl.metadata (1.8 kB)\n", + "Collecting tensorflow<2.22,>=2.21 (from tf-keras)\n", + " Downloading tensorflow-2.21.0-cp313-cp313-win_amd64.whl.metadata (4.5 kB)\n", + "Requirement already satisfied: absl-py>=1.0.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (2.4.0)\n", + "Requirement already satisfied: astunparse>=1.6.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (1.6.3)\n", + "Requirement already satisfied: flatbuffers>=25.9.23 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (25.12.19)\n", + "Requirement already satisfied: gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (0.7.0)\n", + "Requirement already satisfied: google_pasta>=0.1.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (0.2.0)\n", + "Requirement already satisfied: libclang>=13.0.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (18.1.1)\n", + "Requirement already satisfied: opt_einsum>=2.3.2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (3.4.0)\n", + "Requirement already satisfied: packaging in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (24.2)\n", + "Collecting protobuf<8.0.0,>=6.31.1 (from tensorflow<2.22,>=2.21->tf-keras)\n", + " Downloading protobuf-7.34.1-cp310-abi3-win_amd64.whl.metadata (595 bytes)\n", + "Requirement already satisfied: requests<3,>=2.21.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (2.32.3)\n", + "Requirement already satisfied: setuptools in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (72.1.0)\n", + "Requirement already satisfied: six>=1.12.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (1.17.0)\n", + "Requirement already satisfied: termcolor>=1.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (3.3.0)\n", + "Requirement already satisfied: typing_extensions>=3.6.6 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (4.12.2)\n", + "Requirement already satisfied: wrapt>=1.11.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (1.17.0)\n", + "Requirement already satisfied: grpcio<2.0,>=1.24.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (1.78.0)\n", + "Requirement already satisfied: keras>=3.12.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (3.13.2)\n", + "Requirement already satisfied: numpy>=1.26.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (2.1.3)\n", + "Requirement already satisfied: h5py<3.15.0,>=3.11.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (3.12.1)\n", + "Requirement already satisfied: ml_dtypes<1.0.0,>=0.5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tensorflow<2.22,>=2.21->tf-keras) (0.5.4)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3,>=2.21.0->tensorflow<2.22,>=2.21->tf-keras) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3,>=2.21.0->tensorflow<2.22,>=2.21->tf-keras) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3,>=2.21.0->tensorflow<2.22,>=2.21->tf-keras) (2.3.0)\n", + "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests<3,>=2.21.0->tensorflow<2.22,>=2.21->tf-keras) (2026.1.4)\n", + "Requirement already satisfied: wheel<1.0,>=0.23.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from astunparse>=1.6.0->tensorflow<2.22,>=2.21->tf-keras) (0.45.1)\n", + "Requirement already satisfied: rich in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from keras>=3.12.0->tensorflow<2.22,>=2.21->tf-keras) (13.9.4)\n", + "Requirement already satisfied: namex in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from keras>=3.12.0->tensorflow<2.22,>=2.21->tf-keras) (0.1.0)\n", + "Requirement already satisfied: optree in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from keras>=3.12.0->tensorflow<2.22,>=2.21->tf-keras) (0.18.0)\n", + "Requirement already satisfied: markdown-it-py>=2.2.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from rich->keras>=3.12.0->tensorflow<2.22,>=2.21->tf-keras) (2.2.0)\n", + "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from rich->keras>=3.12.0->tensorflow<2.22,>=2.21->tf-keras) (2.19.1)\n", + "Requirement already satisfied: mdurl~=0.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from markdown-it-py>=2.2.0->rich->keras>=3.12.0->tensorflow<2.22,>=2.21->tf-keras) (0.1.0)\n", + "Downloading tf_keras-2.21.0-py3-none-any.whl (1.7 MB)\n", + " ---------------------------------------- 0.0/1.7 MB ? eta -:--:--\n", + " ---------------------------------------- 1.7/1.7 MB 36.9 MB/s eta 0:00:00\n", + "Downloading tensorflow-2.21.0-cp313-cp313-win_amd64.whl (351.2 MB)\n", + " ---------------------------------------- 0.0/351.2 MB ? eta -:--:--\n", + " - -------------------------------------- 14.2/351.2 MB 65.2 MB/s eta 0:00:06\n", + " --- ------------------------------------ 27.8/351.2 MB 66.0 MB/s eta 0:00:05\n", + " ---- ----------------------------------- 43.8/351.2 MB 70.2 MB/s eta 0:00:05\n", + " ------ --------------------------------- 59.2/351.2 MB 70.9 MB/s eta 0:00:05\n", + " -------- ------------------------------- 74.7/351.2 MB 71.8 MB/s eta 0:00:04\n", + " --------- ------------------------------ 87.3/351.2 MB 70.7 MB/s eta 0:00:04\n", + " ----------- --------------------------- 102.5/351.2 MB 69.6 MB/s eta 0:00:04\n", + " ------------- ------------------------- 117.4/351.2 MB 70.0 MB/s eta 0:00:04\n", + " -------------- ------------------------ 134.2/351.2 MB 71.0 MB/s eta 0:00:04\n", + " ---------------- ---------------------- 149.4/351.2 MB 71.3 MB/s eta 0:00:03\n", + " ------------------ -------------------- 164.4/351.2 MB 71.5 MB/s eta 0:00:03\n", + " ------------------- ------------------- 178.0/351.2 MB 71.2 MB/s eta 0:00:03\n", + " --------------------- ----------------- 192.9/351.2 MB 71.0 MB/s eta 0:00:03\n", + " ----------------------- --------------- 210.0/351.2 MB 71.5 MB/s eta 0:00:02\n", + " ------------------------- ------------- 225.7/351.2 MB 71.7 MB/s eta 0:00:02\n", + " -------------------------- ------------ 241.7/351.2 MB 72.1 MB/s eta 0:00:02\n", + " ---------------------------- ---------- 257.7/351.2 MB 72.2 MB/s eta 0:00:02\n", + " ------------------------------ -------- 275.3/351.2 MB 73.2 MB/s eta 0:00:02\n", + " ------------------------------- ------- 288.1/351.2 MB 72.8 MB/s eta 0:00:01\n", + " --------------------------------- ----- 303.8/351.2 MB 72.7 MB/s eta 0:00:01\n", + " ----------------------------------- --- 319.0/351.2 MB 72.8 MB/s eta 0:00:01\n", + " ------------------------------------- - 336.3/351.2 MB 73.0 MB/s eta 0:00:01\n", + " -------------------------------------- 351.0/351.2 MB 74.2 MB/s eta 0:00:01\n", + " -------------------------------------- 351.0/351.2 MB 74.2 MB/s eta 0:00:01\n", + " -------------------------------------- 351.0/351.2 MB 74.2 MB/s eta 0:00:01\n", + " --------------------------------------- 351.2/351.2 MB 64.2 MB/s eta 0:00:00\n", + "Downloading protobuf-7.34.1-cp310-abi3-win_amd64.whl (437 kB)\n", + "Installing collected packages: protobuf, tensorflow, tf-keras\n", "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Requirement already satisfied: accelerate in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (0.31.0)\n", - "Requirement already satisfied: numpy>=1.17 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from accelerate) (1.26.4)\n", - "Requirement already satisfied: packaging>=20.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from accelerate) (24.0)\n", - "Requirement already satisfied: psutil in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from accelerate) (5.9.8)\n", - "Requirement already satisfied: pyyaml in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from accelerate) (6.0.1)\n", - "Requirement already satisfied: torch>=1.10.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from accelerate) (2.2.2)\n", - "Requirement already satisfied: huggingface-hub in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from accelerate) (0.23.3)\n", - "Requirement already satisfied: safetensors>=0.3.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from accelerate) (0.4.3)\n", - "Requirement already satisfied: filelock in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch>=1.10.0->accelerate) (3.15.1)\n", - "Requirement already satisfied: typing-extensions>=4.8.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch>=1.10.0->accelerate) (4.11.0)\n", - "Requirement already satisfied: sympy in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch>=1.10.0->accelerate) (1.12.1)\n", - "Requirement already satisfied: networkx in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch>=1.10.0->accelerate) (3.3)\n", - "Requirement already satisfied: jinja2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch>=1.10.0->accelerate) (3.1.3)\n", - "Requirement already satisfied: fsspec in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch>=1.10.0->accelerate) (2024.5.0)\n", - "Requirement already satisfied: requests in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from huggingface-hub->accelerate) (2.32.3)\n", - "Requirement already satisfied: tqdm>=4.42.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from huggingface-hub->accelerate) (4.66.4)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from jinja2->torch>=1.10.0->accelerate) (2.1.5)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->huggingface-hub->accelerate) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->huggingface-hub->accelerate) (3.7)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->huggingface-hub->accelerate) (2.2.1)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests->huggingface-hub->accelerate) (2024.2.2)\n", - "Requirement already satisfied: mpmath<1.4.0,>=1.1.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from sympy->torch>=1.10.0->accelerate) (1.3.0)\n", + " Attempting uninstall: protobuf\n", "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Collecting tf-keras\n", - " Downloading tf_keras-2.17.0-py3-none-any.whl.metadata (1.6 kB)\n", - "INFO: pip is looking at multiple versions of tf-keras to determine which version is compatible with other requirements. This could take a while.\n", - " Downloading tf_keras-2.16.0-py3-none-any.whl.metadata (1.6 kB)\n", - "Requirement already satisfied: tensorflow<2.17,>=2.16 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tf-keras) (2.16.1)\n", - "Requirement already satisfied: absl-py>=1.0.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (2.1.0)\n", - "Requirement already satisfied: astunparse>=1.6.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (1.6.3)\n", - "Requirement already satisfied: flatbuffers>=23.5.26 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (24.3.25)\n", - "Requirement already satisfied: gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (0.5.4)\n", - "Requirement already satisfied: google-pasta>=0.1.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (0.2.0)\n", - "Requirement already satisfied: h5py>=3.10.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (3.11.0)\n", - "Requirement already satisfied: libclang>=13.0.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (18.1.1)\n", - "Requirement already satisfied: ml-dtypes~=0.3.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (0.3.2)\n", - "Requirement already satisfied: opt-einsum>=2.3.2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (3.3.0)\n", - "Requirement already satisfied: packaging in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (24.0)\n", - "Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (4.25.4)\n", - "Requirement already satisfied: requests<3,>=2.21.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (2.32.3)\n", - "Requirement already satisfied: setuptools in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (68.2.2)\n", - "Requirement already satisfied: six>=1.12.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (1.16.0)\n", - "Requirement already satisfied: termcolor>=1.1.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (2.4.0)\n", - "Requirement already satisfied: typing-extensions>=3.6.6 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (4.11.0)\n", - "Requirement already satisfied: wrapt>=1.11.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (1.16.0)\n", - "Requirement already satisfied: grpcio<2.0,>=1.24.3 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (1.64.1)\n", - "Requirement already satisfied: tensorboard<2.17,>=2.16 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (2.16.2)\n", - "Requirement already satisfied: keras>=3.0.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (3.3.3)\n", - "Requirement already satisfied: tensorflow-io-gcs-filesystem>=0.23.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (0.37.0)\n", - "Requirement already satisfied: numpy<2.0.0,>=1.23.5 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorflow<2.17,>=2.16->tf-keras) (1.26.4)\n", - "Requirement already satisfied: wheel<1.0,>=0.23.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from astunparse>=1.6.0->tensorflow<2.17,>=2.16->tf-keras) (0.43.0)\n", - "Requirement already satisfied: rich in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from keras>=3.0.0->tensorflow<2.17,>=2.16->tf-keras) (13.7.1)\n", - "Requirement already satisfied: namex in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from keras>=3.0.0->tensorflow<2.17,>=2.16->tf-keras) (0.0.8)\n", - "Requirement already satisfied: optree in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from keras>=3.0.0->tensorflow<2.17,>=2.16->tf-keras) (0.11.0)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow<2.17,>=2.16->tf-keras) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow<2.17,>=2.16->tf-keras) (3.7)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow<2.17,>=2.16->tf-keras) (2.2.1)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow<2.17,>=2.16->tf-keras) (2024.2.2)\n", - "Requirement already satisfied: markdown>=2.6.8 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorboard<2.17,>=2.16->tensorflow<2.17,>=2.16->tf-keras) (3.6)\n", - "Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorboard<2.17,>=2.16->tensorflow<2.17,>=2.16->tf-keras) (0.7.2)\n", - "Requirement already satisfied: werkzeug>=1.0.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from tensorboard<2.17,>=2.16->tensorflow<2.17,>=2.16->tf-keras) (3.0.3)\n", - "Requirement already satisfied: MarkupSafe>=2.1.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from werkzeug>=1.0.1->tensorboard<2.17,>=2.16->tensorflow<2.17,>=2.16->tf-keras) (2.1.5)\n", - "Requirement already satisfied: markdown-it-py>=2.2.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from rich->keras>=3.0.0->tensorflow<2.17,>=2.16->tf-keras) (3.0.0)\n", - "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from rich->keras>=3.0.0->tensorflow<2.17,>=2.16->tf-keras) (2.17.2)\n", - "Requirement already satisfied: mdurl~=0.1 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from markdown-it-py>=2.2.0->rich->keras>=3.0.0->tensorflow<2.17,>=2.16->tf-keras) (0.1.2)\n", - "Downloading tf_keras-2.16.0-py3-none-any.whl (1.7 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m12.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m0:01\u001b[0m\n", - "\u001b[?25hInstalling collected packages: tf-keras\n", - "Successfully installed tf-keras-2.16.0\n", + " Found existing installation: protobuf 5.29.3\n", + "\n", + " Uninstalling protobuf-5.29.3:\n", + "\n", + " Successfully uninstalled protobuf-5.29.3\n", "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Requirement already satisfied: torch in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (2.2.2)\n", - "Requirement already satisfied: filelock in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch) (3.15.1)\n", - "Requirement already satisfied: typing-extensions>=4.8.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch) (4.11.0)\n", - "Requirement already satisfied: sympy in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch) (1.12.1)\n", - "Requirement already satisfied: networkx in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch) (3.3)\n", - "Requirement already satisfied: jinja2 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch) (3.1.3)\n", - "Requirement already satisfied: fsspec in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from torch) (2024.5.0)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from jinja2->torch) (2.1.5)\n", - "Requirement already satisfied: mpmath<1.4.0,>=1.1.0 in /Users/joaorochaemelo/code/IH/venv_ironhack/lib/python3.11/site-packages (from sympy->torch) (1.3.0)\n", + " ---------------------------------------- 0/3 [protobuf]\n", + " Attempting uninstall: tensorflow\n", + " ---------------------------------------- 0/3 [protobuf]\n", + " Found existing installation: tensorflow 2.20.0\n", + " ---------------------------------------- 0/3 [protobuf]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " Uninstalling tensorflow-2.20.0:\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " Successfully uninstalled tensorflow-2.20.0\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " ------------- -------------------------- 1/3 [tensorflow]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " -------------------------- ------------- 2/3 [tf-keras]\n", + " ---------------------------------------- 3/3 [tf-keras]\n", "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" + "Successfully installed protobuf-7.34.1 tensorflow-2.21.0 tf-keras-2.21.0\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: 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", + "streamlit 1.45.1 requires protobuf<7,>=3.20, but you have protobuf 7.34.1 which is incompatible.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: torch in c:\\users\\con2m\\anaconda3\\lib\\site-packages (2.11.0)\n", + "Requirement already satisfied: filelock in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch) (3.17.0)\n", + "Requirement already satisfied: typing-extensions>=4.10.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch) (4.12.2)\n", + "Requirement already satisfied: setuptools<82 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch) (72.1.0)\n", + "Requirement already satisfied: sympy>=1.13.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch) (1.13.3)\n", + "Requirement already satisfied: networkx>=2.5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch) (3.4.2)\n", + "Requirement already satisfied: jinja2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch) (3.1.6)\n", + "Requirement already satisfied: fsspec>=0.8.5 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch) (2025.3.2)\n", + "Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sympy>=1.13.3->torch) (1.3.0)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from jinja2->torch) (3.0.2)\n" ] } ], @@ -338,12 +614,125 @@ }, "outputs": [ { - "name": "stdout", + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "eadf63a77bde4df5a208cdc6ea5095b0", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "config.json: 0%| | 0.00/705 [00:00 2\u001b[0m pipeline_translate \u001b[38;5;241m=\u001b[39m pipeline(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtranslation\u001b[39m\u001b[38;5;124m\"\u001b[39m, model\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfacebook/m2m100_418M\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\transformers\\pipelines\\__init__.py:742\u001b[0m, in \u001b[0;36mpipeline\u001b[1;34m(task, model, config, tokenizer, feature_extractor, image_processor, processor, revision, use_fast, token, device, device_map, dtype, trust_remote_code, model_kwargs, pipeline_class, **kwargs)\u001b[0m\n\u001b[0;32m 735\u001b[0m pipeline_class \u001b[38;5;241m=\u001b[39m get_class_from_dynamic_module(\n\u001b[0;32m 736\u001b[0m class_ref,\n\u001b[0;32m 737\u001b[0m model,\n\u001b[0;32m 738\u001b[0m code_revision\u001b[38;5;241m=\u001b[39mcode_revision,\n\u001b[0;32m 739\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mhub_kwargs,\n\u001b[0;32m 740\u001b[0m )\n\u001b[0;32m 741\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 742\u001b[0m normalized_task, targeted_task, task_options \u001b[38;5;241m=\u001b[39m check_task(task)\n\u001b[0;32m 743\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m pipeline_class \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 744\u001b[0m pipeline_class \u001b[38;5;241m=\u001b[39m targeted_task[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mimpl\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\transformers\\pipelines\\__init__.py:355\u001b[0m, in \u001b[0;36mcheck_task\u001b[1;34m(task)\u001b[0m\n\u001b[0;32m 319\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mcheck_task\u001b[39m(task: \u001b[38;5;28mstr\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mtuple\u001b[39m[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mdict\u001b[39m, Any]:\n\u001b[0;32m 320\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 321\u001b[0m \u001b[38;5;124;03m Checks an incoming task string, to validate it's correct and return the default Pipeline and Model classes, and\u001b[39;00m\n\u001b[0;32m 322\u001b[0m \u001b[38;5;124;03m default models if they exist.\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 353\u001b[0m \n\u001b[0;32m 354\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 355\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m PIPELINE_REGISTRY\u001b[38;5;241m.\u001b[39mcheck_task(task)\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\transformers\\pipelines\\base.py:1341\u001b[0m, in \u001b[0;36mPipelineRegistry.check_task\u001b[1;34m(self, task)\u001b[0m\n\u001b[0;32m 1338\u001b[0m targeted_task \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msupported_tasks[task]\n\u001b[0;32m 1339\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m task, targeted_task, \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m-> 1341\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnknown task \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtask\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m, available tasks are \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_supported_tasks()\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n", + "\u001b[1;31mKeyError\u001b[0m: \"Unknown task translation, available tasks are ['any-to-any', 'audio-classification', 'automatic-speech-recognition', 'depth-estimation', 'document-question-answering', 'feature-extraction', 'fill-mask', 'image-classification', 'image-feature-extraction', 'image-segmentation', 'image-text-to-text', 'keypoint-matching', 'mask-generation', 'ner', 'object-detection', 'sentiment-analysis', 'table-question-answering', 'text-classification', 'text-generation', 'text-to-audio', 'text-to-speech', 'token-classification', 'video-classification', 'zero-shot-audio-classification', 'zero-shot-classification', 'zero-shot-image-classification', 'zero-shot-object-detection']\"" + ] + } + ], "source": [ "# translation pipeline docs: https://huggingface.co/transformers/main_classes/pipelines.html#transformers.TranslationPipeline\n", "pipeline_translate = pipeline(\"translation\", model=\"facebook/m2m100_418M\")" @@ -558,7 +985,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -592,7 +1019,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -637,7 +1064,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -782,7 +1209,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -792,14 +1219,19 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Original text:\n", - "Donald John Trump (born June 14, 1946) is an American politician, media personality, and businessman who served as the 45th president of the United States from 2017 to 2021. Trump received a Bachelor of Science in economics from the University of Pennsylvania in 1968. His father named him president of his real estate business in 1971. Trump renamed it the Trump Organization and reoriented the company toward building and renovating skyscrapers, hotels, casinos, and golf courses. After a series of business failures in the late 1990s, he launched successful side ventures, mostly licensing the Trump name. From 2004 to 2015, he co-produced and hosted the reality television series The Apprentice. He and his businesses have been plaintiffs or defendants in more than 4,000 legal actions, including six business bankruptcies. Trump won the 2016 presidential election as the Republican Party nominee against Democratic Party candidate Hillary Clinton while losing the popular vote. A special counsel investigation established that Russia had interfered in the election to favor Trump. During the campaign, his political positions were described as populist, protectionist, isolationist, and nationalist. His election and policies sparked numerous protests. He was the only U.S. president without prior military or government experience. Trump promoted conspiracy theories and made many false and misleading statements during his campaigns and presidency, to a degree unprecedented in American politics. Many of his comments and actions have been characterized as racially charged, racist, and misogynistic. As president, Trump ordered a travel ban on citizens from several Muslim-majority countries, diverted military funding toward building a wall on the U.S.–Mexico border, and implemented a family separation policy. He rolled back more than 100 environmental policies and regulations. He signed the Tax Cuts and Jobs Act of 2017, which cut taxes and eliminated the individual health insurance mandate penalty of the Affordable Care Act. He appointed Neil Gorsuch, Brett Kavanaugh, and Amy Coney Barrett to the U.S. Supreme Court. He reacted slowly to the COVID-19 pandemic, ignored or contradicted many recommendations from health officials, used political pressure to interfere with testing efforts, and spread misinformation about unproven treatments. Trump initiated a trade war with China and withdrew the U.S. from the proposed Trans-Pacific Partnership trade agreement, the Paris Agreement on climate change, and the Iran nuclear deal. He met with North Korean leader Kim Jong Un three times but made no progress on denuclearization. Trump is the only U.S. president to have been impeached twice, in 2019 for abuse of power and obstruction of Congress after he pressured Ukraine to investigate Joe Biden, and in 2021 for incitement of insurrection. The Senate acquitted him in both cases. Trump lost the 2020 presidential election to Biden but refused to concede, falsely claiming widespread electoral fraud and attempting to overturn the results. On January 6, 2021, he urged his supporters to march to the U.S. Capitol, which many of them attacked. Scholars and historians rank Trump as one of the worst presidents in American history. Since leaving office, Trump has continued to dominate the Republican Party and is their candidate again in the 2024 presidential election. In May 2024, a jury in New York found Trump guilty on 34 felony counts of falsifying business records related to a hush money payment to Stormy Daniels in an attempt to influence the 2016 election, making him the first former U.S. president to be convicted of a crime. He has been indicted in three other jurisdictions on 54 other felony counts related to his mishandling of classified documents and efforts to overturn the 2020 presidential election. In civil proceedings, Trump was found liable for sexual abuse and defamation in 2023, defamation in 2024, and financial fraud in 2024.\n", - "\n", - "Summarized text:\n", - " Donald John Trump is the 45th president of the United States . He won the 2016 presidential election as the Republican Party nominee against Hillary Clinton\n" + "ename": "PageError", + "evalue": "Page id \"donalds trump\" does not match any pages. Try another id!", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mPageError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[7], line 5\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mwikipedia\u001b[39;00m\n\u001b[0;32m 3\u001b[0m wikipedia\u001b[38;5;241m.\u001b[39mset_lang(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124men\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 5\u001b[0m text_long \u001b[38;5;241m=\u001b[39m wikipedia\u001b[38;5;241m.\u001b[39msummary(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDonald Trump\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOriginal text:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;132;01m{\u001b[39;00mtext_long\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 8\u001b[0m \u001b[38;5;66;03m# translate the text from wikipedia\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\util.py:28\u001b[0m, in \u001b[0;36mcache.__call__\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 26\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_cache[key]\n\u001b[0;32m 27\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 28\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_cache[key] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfn(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 30\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ret\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:231\u001b[0m, in \u001b[0;36msummary\u001b[1;34m(title, sentences, chars, auto_suggest, redirect)\u001b[0m\n\u001b[0;32m 216\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[0;32m 217\u001b[0m \u001b[38;5;124;03mPlain text summary of the page.\u001b[39;00m\n\u001b[0;32m 218\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 226\u001b[0m \u001b[38;5;124;03m* redirect - allow redirection without raising RedirectError\u001b[39;00m\n\u001b[0;32m 227\u001b[0m \u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[0;32m 229\u001b[0m \u001b[38;5;66;03m# use auto_suggest and redirect to get the correct article\u001b[39;00m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;66;03m# also, use page's error checking to raise DisambiguationError if necessary\u001b[39;00m\n\u001b[1;32m--> 231\u001b[0m page_info \u001b[38;5;241m=\u001b[39m page(title, auto_suggest\u001b[38;5;241m=\u001b[39mauto_suggest, redirect\u001b[38;5;241m=\u001b[39mredirect)\n\u001b[0;32m 232\u001b[0m title \u001b[38;5;241m=\u001b[39m page_info\u001b[38;5;241m.\u001b[39mtitle\n\u001b[0;32m 233\u001b[0m pageid \u001b[38;5;241m=\u001b[39m page_info\u001b[38;5;241m.\u001b[39mpageid\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:276\u001b[0m, in \u001b[0;36mpage\u001b[1;34m(title, pageid, auto_suggest, redirect, preload)\u001b[0m\n\u001b[0;32m 273\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m:\n\u001b[0;32m 274\u001b[0m \u001b[38;5;66;03m# if there is no suggestion or search results, the page doesn't exist\u001b[39;00m\n\u001b[0;32m 275\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m PageError(title)\n\u001b[1;32m--> 276\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m WikipediaPage(title, redirect\u001b[38;5;241m=\u001b[39mredirect, preload\u001b[38;5;241m=\u001b[39mpreload)\n\u001b[0;32m 277\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m pageid \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 278\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m WikipediaPage(pageid\u001b[38;5;241m=\u001b[39mpageid, preload\u001b[38;5;241m=\u001b[39mpreload)\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:299\u001b[0m, in \u001b[0;36mWikipediaPage.__init__\u001b[1;34m(self, title, pageid, redirect, preload, original_title)\u001b[0m\n\u001b[0;32m 296\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 297\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mEither a title or a pageid must be specified\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m--> 299\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__load(redirect\u001b[38;5;241m=\u001b[39mredirect, preload\u001b[38;5;241m=\u001b[39mpreload)\n\u001b[0;32m 301\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m preload:\n\u001b[0;32m 302\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m prop \u001b[38;5;129;01min\u001b[39;00m (\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msummary\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mimages\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mreferences\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlinks\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msections\u001b[39m\u001b[38;5;124m'\u001b[39m):\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:345\u001b[0m, in \u001b[0;36mWikipediaPage.__load\u001b[1;34m(self, redirect, preload)\u001b[0m\n\u001b[0;32m 343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmissing\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m page:\n\u001b[0;32m 344\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtitle\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[1;32m--> 345\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m PageError(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtitle)\n\u001b[0;32m 346\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 347\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m PageError(pageid\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpageid)\n", + "\u001b[1;31mPageError\u001b[0m: Page id \"donalds trump\" does not match any pages. Try another id!" ] } ], @@ -831,7 +1263,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -901,21 +1333,30 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "98e9441255594befa1933b66bc414f43", + "model_id": "cfa94b6b64b84acf9b0099a369ad88e3", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "config.json: 0%| | 0.00/1.26k [00:00\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
entity_groupscorewordstartend
0PER0.989843donald john trump017
1MISC0.991848american4553
2LOC0.992675united states141154
3PER0.989312trump174179
4ORG0.697325university of pennsylvania233259
5PER0.969404trump337342
6ORG0.712140trump organization358376
7PER0.913634trump597602
8MISC0.953361the apprentice684698
9PER0.992383trump828833
10MISC0.873182republican876886
11MISC0.978373democratic909919
12PER0.994271hillary clinton936951
13LOC0.997165russia10321038
14PER0.982982trump10791084
15LOC0.849478u. s.12741278
16PER0.986752trump13381343
17MISC0.994762american14851493
18PER0.980122trump16221627
19MISC0.987600muslim16741680
20LOC0.977429u. s.17571761
21LOC0.997740mexico17621768
22MISC0.891977tax cuts and jobs act of19041928
23MISC0.960363affordable care act20212040
24PER0.996589neil gorsuch20552067
25PER0.997994brett kavanaugh20692084
26PER0.997711amy coney barrett20902107
27LOC0.901173u. s.21152119
28ORG0.821682supreme court21202133
29MISC0.937786covid - 1921602168
30PER0.980800trump23592364
31LOC0.996960china23922397
32LOC0.991840u. s24152418
33MISC0.908778trans - pacific partnership24382463
34MISC0.889306paris agreement24852500
35MISC0.697912climate change25042518
36LOC0.906911iran25282532
37MISC0.987541north korean25592571
38PER0.993055kim jong un25792590
39PER0.989296trump26452650
40LOC0.874581u. s.26632667
\n", - "" - ], - "text/plain": [ - " entity_group score word start end\n", - "0 PER 0.989843 donald john trump 0 17\n", - "1 MISC 0.991848 american 45 53\n", - "2 LOC 0.992675 united states 141 154\n", - "3 PER 0.989312 trump 174 179\n", - "4 ORG 0.697325 university of pennsylvania 233 259\n", - "5 PER 0.969404 trump 337 342\n", - "6 ORG 0.712140 trump organization 358 376\n", - "7 PER 0.913634 trump 597 602\n", - "8 MISC 0.953361 the apprentice 684 698\n", - "9 PER 0.992383 trump 828 833\n", - "10 MISC 0.873182 republican 876 886\n", - "11 MISC 0.978373 democratic 909 919\n", - "12 PER 0.994271 hillary clinton 936 951\n", - "13 LOC 0.997165 russia 1032 1038\n", - "14 PER 0.982982 trump 1079 1084\n", - "15 LOC 0.849478 u. s. 1274 1278\n", - "16 PER 0.986752 trump 1338 1343\n", - "17 MISC 0.994762 american 1485 1493\n", - "18 PER 0.980122 trump 1622 1627\n", - "19 MISC 0.987600 muslim 1674 1680\n", - "20 LOC 0.977429 u. s. 1757 1761\n", - "21 LOC 0.997740 mexico 1762 1768\n", - "22 MISC 0.891977 tax cuts and jobs act of 1904 1928\n", - "23 MISC 0.960363 affordable care act 2021 2040\n", - "24 PER 0.996589 neil gorsuch 2055 2067\n", - "25 PER 0.997994 brett kavanaugh 2069 2084\n", - "26 PER 0.997711 amy coney barrett 2090 2107\n", - "27 LOC 0.901173 u. s. 2115 2119\n", - "28 ORG 0.821682 supreme court 2120 2133\n", - "29 MISC 0.937786 covid - 19 2160 2168\n", - "30 PER 0.980800 trump 2359 2364\n", - "31 LOC 0.996960 china 2392 2397\n", - "32 LOC 0.991840 u. s 2415 2418\n", - "33 MISC 0.908778 trans - pacific partnership 2438 2463\n", - "34 MISC 0.889306 paris agreement 2485 2500\n", - "35 MISC 0.697912 climate change 2504 2518\n", - "36 LOC 0.906911 iran 2528 2532\n", - "37 MISC 0.987541 north korean 2559 2571\n", - "38 PER 0.993055 kim jong un 2579 2590\n", - "39 PER 0.989296 trump 2645 2650\n", - "40 LOC 0.874581 u. s. 2663 2667" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" + "ename": "PageError", + "evalue": "Page id \"donalds trump\" does not match any pages. Try another id!", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mPageError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[9], line 4\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mwikipedia\u001b[39;00m\n\u001b[0;32m 2\u001b[0m wikipedia\u001b[38;5;241m.\u001b[39mset_lang(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124men\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 4\u001b[0m text_long \u001b[38;5;241m=\u001b[39m wikipedia\u001b[38;5;241m.\u001b[39msummary(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDonald Trump\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 6\u001b[0m output \u001b[38;5;241m=\u001b[39m pipeline_ner(text_long)\n\u001b[0;32m 8\u001b[0m pd\u001b[38;5;241m.\u001b[39mDataFrame(output)\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\util.py:28\u001b[0m, in \u001b[0;36mcache.__call__\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 26\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_cache[key]\n\u001b[0;32m 27\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 28\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_cache[key] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfn(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 30\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ret\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:231\u001b[0m, in \u001b[0;36msummary\u001b[1;34m(title, sentences, chars, auto_suggest, redirect)\u001b[0m\n\u001b[0;32m 216\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[0;32m 217\u001b[0m \u001b[38;5;124;03mPlain text summary of the page.\u001b[39;00m\n\u001b[0;32m 218\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 226\u001b[0m \u001b[38;5;124;03m* redirect - allow redirection without raising RedirectError\u001b[39;00m\n\u001b[0;32m 227\u001b[0m \u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[0;32m 229\u001b[0m \u001b[38;5;66;03m# use auto_suggest and redirect to get the correct article\u001b[39;00m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;66;03m# also, use page's error checking to raise DisambiguationError if necessary\u001b[39;00m\n\u001b[1;32m--> 231\u001b[0m page_info \u001b[38;5;241m=\u001b[39m page(title, auto_suggest\u001b[38;5;241m=\u001b[39mauto_suggest, redirect\u001b[38;5;241m=\u001b[39mredirect)\n\u001b[0;32m 232\u001b[0m title \u001b[38;5;241m=\u001b[39m page_info\u001b[38;5;241m.\u001b[39mtitle\n\u001b[0;32m 233\u001b[0m pageid \u001b[38;5;241m=\u001b[39m page_info\u001b[38;5;241m.\u001b[39mpageid\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:276\u001b[0m, in \u001b[0;36mpage\u001b[1;34m(title, pageid, auto_suggest, redirect, preload)\u001b[0m\n\u001b[0;32m 273\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m:\n\u001b[0;32m 274\u001b[0m \u001b[38;5;66;03m# if there is no suggestion or search results, the page doesn't exist\u001b[39;00m\n\u001b[0;32m 275\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m PageError(title)\n\u001b[1;32m--> 276\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m WikipediaPage(title, redirect\u001b[38;5;241m=\u001b[39mredirect, preload\u001b[38;5;241m=\u001b[39mpreload)\n\u001b[0;32m 277\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m pageid \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 278\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m WikipediaPage(pageid\u001b[38;5;241m=\u001b[39mpageid, preload\u001b[38;5;241m=\u001b[39mpreload)\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:299\u001b[0m, in \u001b[0;36mWikipediaPage.__init__\u001b[1;34m(self, title, pageid, redirect, preload, original_title)\u001b[0m\n\u001b[0;32m 296\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 297\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mEither a title or a pageid must be specified\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m--> 299\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__load(redirect\u001b[38;5;241m=\u001b[39mredirect, preload\u001b[38;5;241m=\u001b[39mpreload)\n\u001b[0;32m 301\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m preload:\n\u001b[0;32m 302\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m prop \u001b[38;5;129;01min\u001b[39;00m (\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msummary\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mimages\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mreferences\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlinks\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msections\u001b[39m\u001b[38;5;124m'\u001b[39m):\n", + "File \u001b[1;32mc:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\wikipedia\\wikipedia.py:345\u001b[0m, in \u001b[0;36mWikipediaPage.__load\u001b[1;34m(self, redirect, preload)\u001b[0m\n\u001b[0;32m 343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmissing\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m page:\n\u001b[0;32m 344\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtitle\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[1;32m--> 345\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m PageError(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtitle)\n\u001b[0;32m 346\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 347\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m PageError(pageid\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpageid)\n", + "\u001b[1;31mPageError\u001b[0m: Page id \"donalds trump\" does not match any pages. Try another id!" + ] } ], "source": [ @@ -1460,7 +1526,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -1541,21 +1607,30 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "a2f5788e5bcd426e96d8d80cfda33741", + "model_id": "5886de50b00a4ae3b27f6f128ddf68e8", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "config.json: 0%| | 0.00/1.07k [00:00\n", " 0\n", " payment issues\n", - " 0.991133\n", + " 0.991305\n", " \n", " \n", " 1\n", " bug report\n", - " 0.076115\n", + " 0.076943\n", " \n", " \n", " 2\n", " travel advice\n", - " 0.018696\n", + " 0.018752\n", " \n", " \n", "\n", @@ -1707,12 +1809,12 @@ ], "text/plain": [ " class probability\n", - "0 payment issues 0.991133\n", - "1 bug report 0.076115\n", - "2 travel advice 0.018696" + "0 payment issues 0.991305\n", + "1 bug report 0.076943\n", + "2 travel advice 0.018752" ] }, - "execution_count": 14, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -1754,11 +1856,607 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting transformers==4.41.2\n", + " Downloading transformers-4.41.2-py3-none-any.whl.metadata (43 kB)\n", + "Requirement already satisfied: filelock in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (3.17.0)\n", + "Collecting huggingface-hub<1.0,>=0.23.0 (from transformers==4.41.2)\n", + " Downloading huggingface_hub-0.36.2-py3-none-any.whl.metadata (15 kB)\n", + "Requirement already satisfied: numpy>=1.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (2.1.3)\n", + "Requirement already satisfied: packaging>=20.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (24.2)\n", + "Requirement already satisfied: pyyaml>=5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (6.0.2)\n", + "Requirement already satisfied: regex!=2019.12.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (2026.4.4)\n", + "Requirement already satisfied: requests in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (2.32.3)\n", + "Collecting tokenizers<0.20,>=0.19 (from transformers==4.41.2)\n", + " Downloading tokenizers-0.19.1.tar.gz (321 kB)\n", + " Installing build dependencies: started\n", + " Installing build dependencies: finished with status 'done'\n", + " Getting requirements to build wheel: started\n", + " Getting requirements to build wheel: finished with status 'done'\n", + " Installing backend dependencies: started\n", + " Installing backend dependencies: finished with status 'done'\n", + " Preparing metadata (pyproject.toml): started\n", + " Preparing metadata (pyproject.toml): finished with status 'done'\n", + "Requirement already satisfied: safetensors>=0.4.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (0.7.0)\n", + "Requirement already satisfied: tqdm>=4.27 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers==4.41.2) (4.67.1)\n", + "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.23.0->transformers==4.41.2) (2025.3.2)\n", + "Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.23.0->transformers==4.41.2) (4.12.2)\n", + "Requirement already satisfied: colorama in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tqdm>=4.27->transformers==4.41.2) (0.4.6)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers==4.41.2) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers==4.41.2) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers==4.41.2) (2.3.0)\n", + "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers==4.41.2) (2026.1.4)\n", + "Downloading transformers-4.41.2-py3-none-any.whl (9.1 MB)\n", + " ---------------------------------------- 0.0/9.1 MB ? eta -:--:--\n", + " ---------------------------------------- 9.1/9.1 MB 56.4 MB/s eta 0:00:00\n", + "Downloading huggingface_hub-0.36.2-py3-none-any.whl (566 kB)\n", + " ---------------------------------------- 0.0/566.4 kB ? eta -:--:--\n", + " --------------------------------------- 566.4/566.4 kB 32.0 MB/s eta 0:00:00\n", + "Building wheels for collected packages: tokenizers\n", + " Building wheel for tokenizers (pyproject.toml): started\n", + " Building wheel for tokenizers (pyproject.toml): finished with status 'error'\n", + "Failed to build tokenizers\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " error: subprocess-exited-with-error\n", + " \n", + " × Building wheel for tokenizers (pyproject.toml) did not run successfully.\n", + " │ exit code: 1\n", + " ╰─> [63 lines of output]\n", + " Rust not found, installing into a temporary directory\n", + " Python reports SOABI: cp313-win_amd64\n", + " Computed rustc target triple: x86_64-pc-windows-msvc\n", + " Installation directory: C:\\Users\\con2m\\AppData\\Local\\puccinialin\\puccinialin\\Cache\n", + " Rustup already downloaded\n", + " Installing rust to C:\\Users\\con2m\\AppData\\Local\\puccinialin\\puccinialin\\Cache\\rustup\n", + " warn: It looks like you have an existing rustup settings file at:\n", + " warn: C:\\Users\\con2m\\.rustup\\settings.toml\n", + " warn: Rustup will install the default toolchain as specified in the settings file,\n", + " warn: instead of the one inferred from the default host triple.\n", + " warn: installing msvc toolchain without its prerequisites\n", + " info: profile set to minimal\n", + " info: default host triple is x86_64-pc-windows-msvc\n", + " warn: Updating existing toolchain, profile choice will be ignored\n", + " info: syncing channel updates for stable-x86_64-pc-windows-msvc\n", + " info: default toolchain set to stable-x86_64-pc-windows-msvc\n", + " Checking if cargo is installed\n", + " cargo 1.94.1 (29ea6fb6a 2026-03-24)\n", + " Running `maturin pep517 build-wheel -i C:\\Users\\con2m\\anaconda3\\python.exe --compatibility off`\n", + " ⚠️ Warning: `project.version` field is required in pyproject.toml unless it is present in the `project.dynamic` list\n", + " 🍹 Building a mixed python/rust project\n", + " 🔗 Found pyo3 bindings\n", + " 🐍 Found CPython 3.13 at C:\\Users\\con2m\\anaconda3\\python.exe\n", + " 📡 Using build options features, bindings from pyproject.toml\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m proc-macro2 v1.0.81\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m unicode-ident v1.0.12\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m autocfg v1.2.0\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m target-lexicon v0.12.14\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m windows_x86_64_msvc v0.52.5\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m once_cell v1.19.0\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m cfg-if v1.0.0\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m libc v0.2.153\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m cc v1.0.94\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m memchr v2.7.2\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m crossbeam-utils v0.8.19\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m windows_x86_64_msvc v0.48.5\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m fnv v1.0.7\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m ident_case v1.0.1\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m strsim v0.10.0\n", + " \u001b[1m\u001b[92m Compiling\u001b[0m smallvec v1.13.2\n", + " \u001b[1m\u001b[91merror\u001b[0m\u001b[1m\u001b[97m: linker `link.exe` not found\u001b[0m\n", + " \u001b[1m\u001b[96m|\u001b[0m\n", + " \u001b[1m\u001b[96m= \u001b[0m\u001b[1m\u001b[97mnote\u001b[0m: program not found\n", + " \n", + " \u001b[1m\u001b[92mnote\u001b[0m\u001b[1m\u001b[97m: the msvc targets depend on the msvc linker but `link.exe` was not found\u001b[0m\n", + " \n", + " \u001b[1m\u001b[92mnote\u001b[0m\u001b[1m\u001b[97m: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.\u001b[0m\n", + " \n", + " \u001b[1m\u001b[92mnote\u001b[0m\u001b[1m\u001b[97m: VS Code is a different product, and is not sufficient.\u001b[0m\n", + " \n", + " \u001b[1m\u001b[92m Compiling\u001b[0m portable-atomic v1.6.0\n", + " \u001b[1m\u001b[91merror\u001b[0m: could not compile `windows_x86_64_msvc` (build script) due to 1 previous error\n", + " \u001b[1m\u001b[93mwarning\u001b[0m: build failed, waiting for other jobs to finish...\n", + " \u001b[1m\u001b[91merror\u001b[0m: could not compile `proc-macro2` (build script) due to 1 previous error\n", + " \u001b[1m\u001b[91merror\u001b[0m: could not compile `windows_x86_64_msvc` (build script) due to 1 previous error\n", + " \u001b[1m\u001b[91merror\u001b[0m: could not compile `crossbeam-utils` (build script) due to 1 previous error\n", + " \u001b[1m\u001b[91merror\u001b[0m: could not compile `libc` (build script) due to 1 previous error\n", + " \u001b[1m\u001b[91merror\u001b[0m: could not compile `target-lexicon` (build script) due to 1 previous error\n", + " \u001b[1m\u001b[91merror\u001b[0m: could not compile `portable-atomic` (build script) due to 1 previous error\n", + " 💥 maturin failed\n", + " Caused by: Failed to build a native library through cargo\n", + " Caused by: Cargo build finished with \"exit code: 101\": `\"cargo\" \"rustc\" \"--profile\" \"release\" \"--features\" \"pyo3/extension-module\" \"--message-format\" \"json-render-diagnostics\" \"--manifest-path\" \"C:\\\\Users\\\\con2m\\\\AppData\\\\Local\\\\Temp\\\\pip-install-fa29nsf2\\\\tokenizers_de07199e0c1d4ad18c6dfa48ff0d3c16\\\\bindings\\\\python\\\\Cargo.toml\" \"--lib\"`\n", + " Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'C:\\\\Users\\\\con2m\\\\anaconda3\\\\python.exe', '--compatibility', 'off'] returned non-zero exit status 1\n", + " [end of output]\n", + " \n", + " note: This error originates from a subprocess, and is likely not a problem with pip.\n", + " ERROR: Failed building wheel for tokenizers\n", + "ERROR: Failed to build installable wheels for some pyproject.toml based projects (tokenizers)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: sentence-transformers in c:\\users\\con2m\\anaconda3\\lib\\site-packages (5.3.0)\n", + "Collecting sentence-transformers\n", + " Downloading sentence_transformers-5.4.0-py3-none-any.whl.metadata (17 kB)\n", + "Requirement already satisfied: transformers<6.0.0,>=4.41.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (5.5.3)\n", + "Requirement already satisfied: huggingface-hub>=0.23.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (1.7.2)\n", + "Requirement already satisfied: torch>=1.11.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (2.11.0)\n", + "Requirement already satisfied: numpy>=1.20.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (2.1.3)\n", + "Requirement already satisfied: scikit-learn>=0.22.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (1.6.1)\n", + "Requirement already satisfied: scipy>=1.0.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (1.15.3)\n", + "Requirement already satisfied: typing_extensions>=4.5.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (4.12.2)\n", + "Requirement already satisfied: tqdm>=4.0.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers) (4.67.1)\n", + "Requirement already satisfied: packaging>=20.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<6.0.0,>=4.41.0->sentence-transformers) (24.2)\n", + "Requirement already satisfied: pyyaml>=5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<6.0.0,>=4.41.0->sentence-transformers) (6.0.2)\n", + "Requirement already satisfied: regex>=2025.10.22 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<6.0.0,>=4.41.0->sentence-transformers) (2026.4.4)\n", + "Requirement already satisfied: tokenizers<=0.23.0,>=0.22.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<6.0.0,>=4.41.0->sentence-transformers) (0.22.2)\n", + "Requirement already satisfied: typer in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<6.0.0,>=4.41.0->sentence-transformers) (0.9.0)\n", + "Requirement already satisfied: safetensors>=0.4.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<6.0.0,>=4.41.0->sentence-transformers) (0.7.0)\n", + "Requirement already satisfied: filelock>=3.10.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub>=0.23.0->sentence-transformers) (3.17.0)\n", + "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub>=0.23.0->sentence-transformers) (2025.3.2)\n", + "Requirement already satisfied: hf-xet<2.0.0,>=1.4.2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub>=0.23.0->sentence-transformers) (1.4.2)\n", + "Requirement already satisfied: httpx<1,>=0.23.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub>=0.23.0->sentence-transformers) (0.28.1)\n", + "Requirement already satisfied: anyio in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface-hub>=0.23.0->sentence-transformers) (4.7.0)\n", + "Requirement already satisfied: certifi in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface-hub>=0.23.0->sentence-transformers) (2026.1.4)\n", + "Requirement already satisfied: httpcore==1.* in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface-hub>=0.23.0->sentence-transformers) (1.0.9)\n", + "Requirement already satisfied: idna in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpx<1,>=0.23.0->huggingface-hub>=0.23.0->sentence-transformers) (3.7)\n", + "Requirement already satisfied: h11>=0.16 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->huggingface-hub>=0.23.0->sentence-transformers) (0.16.0)\n", + "Requirement already satisfied: joblib>=1.2.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from scikit-learn>=0.22.0->sentence-transformers) (1.4.2)\n", + "Requirement already satisfied: threadpoolctl>=3.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from scikit-learn>=0.22.0->sentence-transformers) (3.5.0)\n", + "Requirement already satisfied: setuptools<82 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers) (72.1.0)\n", + "Requirement already satisfied: sympy>=1.13.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers) (1.13.3)\n", + "Requirement already satisfied: networkx>=2.5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers) (3.4.2)\n", + "Requirement already satisfied: jinja2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers) (3.1.6)\n", + "Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sympy>=1.13.3->torch>=1.11.0->sentence-transformers) (1.3.0)\n", + "Requirement already satisfied: colorama in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tqdm>=4.0.0->sentence-transformers) (0.4.6)\n", + "Requirement already satisfied: sniffio>=1.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from anyio->httpx<1,>=0.23.0->huggingface-hub>=0.23.0->sentence-transformers) (1.3.0)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from jinja2->torch>=1.11.0->sentence-transformers) (3.0.2)\n", + "Requirement already satisfied: click<9.0.0,>=7.1.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from typer->transformers<6.0.0,>=4.41.0->sentence-transformers) (8.1.8)\n", + "Downloading sentence_transformers-5.4.0-py3-none-any.whl (570 kB)\n", + " ---------------------------------------- 0.0/570.8 kB ? eta -:--:--\n", + " --------------------------------------- 570.8/570.8 kB 18.9 MB/s eta 0:00:00\n", + "Installing collected packages: sentence-transformers\n", + " Attempting uninstall: sentence-transformers\n", + " Found existing installation: sentence-transformers 5.3.0\n", + " Uninstalling sentence-transformers-5.3.0:\n", + " Successfully uninstalled sentence-transformers-5.3.0\n", + "Successfully installed sentence-transformers-5.4.0\n" + ] + } + ], + "source": [ + "!pip install transformers==4.41.2\n", + "!pip install sentence-transformers --upgrade\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting sentence-transformers==3.0.1\n", + " Downloading sentence_transformers-3.0.1-py3-none-any.whl.metadata (10 kB)\n", + "Collecting transformers<5.0.0,>=4.34.0 (from sentence-transformers==3.0.1)\n", + " Downloading transformers-4.57.6-py3-none-any.whl.metadata (43 kB)\n", + "Requirement already satisfied: tqdm in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers==3.0.1) (4.67.1)\n", + "Requirement already satisfied: torch>=1.11.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers==3.0.1) (2.11.0)\n", + "Requirement already satisfied: numpy in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers==3.0.1) (2.1.3)\n", + "Requirement already satisfied: scikit-learn in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers==3.0.1) (1.6.1)\n", + "Requirement already satisfied: scipy in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers==3.0.1) (1.15.3)\n", + "Requirement already satisfied: huggingface-hub>=0.15.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers==3.0.1) (1.7.2)\n", + "Requirement already satisfied: Pillow in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sentence-transformers==3.0.1) (11.1.0)\n", + "Requirement already satisfied: filelock in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (3.17.0)\n", + "Collecting huggingface-hub>=0.15.1 (from sentence-transformers==3.0.1)\n", + " Using cached huggingface_hub-0.36.2-py3-none-any.whl.metadata (15 kB)\n", + "Requirement already satisfied: packaging>=20.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (24.2)\n", + "Requirement already satisfied: pyyaml>=5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (6.0.2)\n", + "Requirement already satisfied: regex!=2019.12.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (2026.4.4)\n", + "Requirement already satisfied: requests in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (2.32.3)\n", + "Requirement already satisfied: tokenizers<=0.23.0,>=0.22.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (0.22.2)\n", + "Requirement already satisfied: safetensors>=0.4.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (0.7.0)\n", + "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub>=0.15.1->sentence-transformers==3.0.1) (2025.3.2)\n", + "Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from huggingface-hub>=0.15.1->sentence-transformers==3.0.1) (4.12.2)\n", + "Requirement already satisfied: setuptools<82 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers==3.0.1) (72.1.0)\n", + "Requirement already satisfied: sympy>=1.13.3 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers==3.0.1) (1.13.3)\n", + "Requirement already satisfied: networkx>=2.5.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers==3.0.1) (3.4.2)\n", + "Requirement already satisfied: jinja2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from torch>=1.11.0->sentence-transformers==3.0.1) (3.1.6)\n", + "Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from sympy>=1.13.3->torch>=1.11.0->sentence-transformers==3.0.1) (1.3.0)\n", + "Requirement already satisfied: colorama in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from tqdm->sentence-transformers==3.0.1) (0.4.6)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from jinja2->torch>=1.11.0->sentence-transformers==3.0.1) (3.0.2)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (2.3.0)\n", + "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from requests->transformers<5.0.0,>=4.34.0->sentence-transformers==3.0.1) (2026.1.4)\n", + "Requirement already satisfied: joblib>=1.2.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from scikit-learn->sentence-transformers==3.0.1) (1.4.2)\n", + "Requirement already satisfied: threadpoolctl>=3.1.0 in c:\\users\\con2m\\anaconda3\\lib\\site-packages (from scikit-learn->sentence-transformers==3.0.1) (3.5.0)\n", + "Downloading sentence_transformers-3.0.1-py3-none-any.whl (227 kB)\n", + "Downloading transformers-4.57.6-py3-none-any.whl (12.0 MB)\n", + " ---------------------------------------- 0.0/12.0 MB ? eta -:--:--\n", + " ------------------------------------ --- 11.0/12.0 MB 52.6 MB/s eta 0:00:01\n", + " ---------------------------------------- 12.0/12.0 MB 48.9 MB/s eta 0:00:00\n", + "Using cached huggingface_hub-0.36.2-py3-none-any.whl (566 kB)\n", + "Installing collected packages: huggingface-hub, transformers, sentence-transformers\n", + "\n", + " Attempting uninstall: huggingface-hub\n", + "\n", + " Found existing installation: huggingface_hub 1.7.2\n", + "\n", + " Uninstalling huggingface_hub-1.7.2:\n", + "\n", + " Successfully uninstalled huggingface_hub-1.7.2\n", + "\n", + " ---------------------------------------- 0/3 [huggingface-hub]\n", + " ---------------------------------------- 0/3 [huggingface-hub]\n", + " ---------------------------------------- 0/3 [huggingface-hub]\n", + " ---------------------------------------- 0/3 [huggingface-hub]\n", + " Attempting uninstall: transformers\n", + " ---------------------------------------- 0/3 [huggingface-hub]\n", + " Found existing installation: transformers 5.5.3\n", + " ---------------------------------------- 0/3 [huggingface-hub]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " Uninstalling transformers-5.5.3:\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " Successfully uninstalled transformers-5.5.3\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " Attempting uninstall: sentence-transformers\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " Found existing installation: sentence-transformers 5.4.0\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " Uninstalling sentence-transformers-5.4.0:\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " Successfully uninstalled sentence-transformers-5.4.0\n", + " ------------- -------------------------- 1/3 [transformers]\n", + " -------------------------- ------------- 2/3 [sentence-transformers]\n", + " -------------------------- ------------- 2/3 [sentence-transformers]\n", + " -------------------------- ------------- 2/3 [sentence-transformers]\n", + " ---------------------------------------- 3/3 [sentence-transformers]\n", + "\n", + "Successfully installed huggingface-hub-0.36.2 sentence-transformers-3.0.1 transformers-4.57.6\n" + ] + } + ], + "source": [ + "!pip install -U sentence-transformers==3.0.1\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "WARNING:tensorflow:From c:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\tf_keras\\src\\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.\n", + "\n" + ] + } + ], + "source": [ + "from sentence_transformers import SentenceTransformer, util\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(0.6960972547531128, 'Artemis II is a ten-day lunar flyby mission that launched on April 1, 2026. With a crew of four astronauts, it is the first crewed flight of the NASA-led Artemis program and the first crewed flight beyond low Earth orbit since Apollo 17 in 1972. Artemis II is the second flight of the Space Launch System (SLS) and the first crewed flight of the Orion spacecraft, named Integrity by the crew.')\n" + ] + } + ], + "source": [ + "from sentence_transformers import SentenceTransformer, util\n", + "from bs4 import BeautifulSoup\n", + "import requests\n", + "\n", + "# Load the embedding model\n", + "model = SentenceTransformer(\"sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2\")\n", + "\n", + "# Download the Artemis II Wikipedia page\n", + "url = \"https://en.wikipedia.org/wiki/Artemis_2\"\n", + "headers = {\"User-Agent\": \"Mozilla/5.0\"}\n", + "html = requests.get(url, headers=headers).text\n", + "\n", + "\n", + "# Extract clean paragraphs\n", + "soup = BeautifulSoup(html, \"html.parser\")\n", + "paragraphs = [\n", + " p.get_text().strip()\n", + " for p in soup.find_all(\"p\")\n", + " if len(p.get_text().strip()) > 50\n", + "]\n", + "\n", + "# Encode all paragraphs (indexing)\n", + "paragraph_embeddings = model.encode(paragraphs, convert_to_tensor=True)\n", + "\n", + "def semantic_search(query, top_k=3):\n", + " q_emb = model.encode(query, convert_to_tensor=True)\n", + " scores = util.cos_sim(q_emb, paragraph_embeddings)[0]\n", + " top = scores.topk(top_k)\n", + " return [(float(score), paragraphs[idx]) for score, idx in zip(top.values, top.indices)]\n", + "\n", + "# Example query\n", + "results = semantic_search(\"What is Artemis II?\", top_k=1)\n", + "print(results[0])\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.6960972547531128 Artemis II is a ten-day lunar flyby mission that launched on April 1, 2026. With a crew of four astronauts, it is the first crewed flight of the NASA-led Artemis program and the first crewed flight beyond low Earth orbit since Apollo 17 in 1972. Artemis II is the second flight of the Space Launch System (SLS) and the first crewed flight of the Orion spacecraft, named Integrity by the crew. \n", + "---\n", + "0.6287407875061035 Artemis II is testing and demonstrating optical communications to and from Earth using the Orion Artemis II Optical Communications System (O2O), which uses laser beams. Such an optical system can be smaller and lighter than conventional radio and can use less power, while increasing the rate of transmission.[111] The O2O hardware is integrated into the Orion spacecraft and included an optical module (a 4-inch [100 mm] telescope and two gimbals), a modem and control electronics.[111] O2O will communicate with ground stations in California and New Mexico.[111] The test device is sending data to Earth with an uplink rate of up to 260 megabits per second.[112] \n", + "---\n", + "0.5816238522529602 The Artemis II mission patch has been interpreted as drawing inspiration from the Apollo 8 patch, which featured a vertically oriented infinity symbol alluding to the number 8 and representing the spacecraft's lunar orbit. Similarly, the Artemis II design incorporates a stylized trajectory resembling a half-period curve that subtly evokes the number \"2\" and corresponds to the first leg of the mission from Earth to the Moon. The depiction of Earth from beyond the Moon's far side, using a perspective similar to that of Earthrise photographed by William Anders during Apollo 8, is descriptive of the mission's distance from Earth. Together, these shared design elements show the parallels between the two missions and support Artemis II's role as the first crewed lunar mission since the Apollo program.[132] \n", + "---\n" + ] + } + ], + "source": [ + "results = semantic_search(\"What is Artemis II?\", top_k=3)\n", + "for score, text in results:\n", + " print(score, text, \"\\n---\")\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "52e2c87ce44c4ba18e0356df664216f7", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "config.json: 0.00B [00:00, ?B/s]" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "c:\\Users\\con2m\\anaconda3\\Lib\\site-packages\\huggingface_hub\\file_download.py:143: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\con2m\\.cache\\huggingface\\hub\\models--facebook--bart-large-cnn. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n", + "To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n", + " warnings.warn(message)\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "f8cd465afa0d48a88c2d635d7947b4a8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "model.safetensors: 0%| | 0.00/1.63G [00:00