From a9572a9557a725aec282a5d078b8254d5404d9df Mon Sep 17 00:00:00 2001 From: Elijah Rwothoromo Date: Tue, 5 Aug 2025 21:33:35 +0300 Subject: [PATCH] Undo changes in default files --- week1/Guide to Jupyter.ipynb | 155 ++++++---------------------- week1/troubleshooting.ipynb | 189 +++-------------------------------- week1/week1 EXERCISE.ipynb | 1 + 3 files changed, 44 insertions(+), 301 deletions(-) diff --git a/week1/Guide to Jupyter.ipynb b/week1/Guide to Jupyter.ipynb index 0de6a9f..ebcc9f0 100644 --- a/week1/Guide to Jupyter.ipynb +++ b/week1/Guide to Jupyter.ipynb @@ -32,21 +32,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "33d37cd8-55c9-4e03-868c-34aa9cab2c80", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "4" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Click anywhere in this cell and press Shift + Return\n", "\n", @@ -65,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "585eb9c1-85ee-4c27-8dc2-b4d8d022eda0", "metadata": {}, "outputs": [], @@ -77,21 +66,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "07792faa-761d-46cb-b9b7-2bbf70bb1628", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'bananas'" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# The result of the last statement is shown after you run it\n", "\n", @@ -100,18 +78,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "a067d2b1-53d5-4aeb-8a3c-574d39ff654a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "My favorite fruit is bananas\n" - ] - } - ], + "outputs": [], "source": [ "# Use the variable\n", "\n", @@ -120,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "4c5a4e60-b7f4-4953-9e80-6d84ba4664ad", "metadata": {}, "outputs": [], @@ -146,18 +116,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "8e5ec81d-7c5b-4025-bd2e-468d67b581b6", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "My favorite fruit is anything but bananas\n" - ] - } - ], + "outputs": [], "source": [ "# Then run this cell twice, and see if you understand what's going on\n", "\n", @@ -182,18 +144,10 @@ }, { "cell_type": "code", - "execution_count": 7, - "id": "ce258424-40c3-49a7-9462-e6fa25014b03", + "execution_count": null, + "id": "84b1e410-5eda-4e2c-97ce-4eebcff816c5", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "My favorite fruit is apples\n" - ] - } - ], + "outputs": [], "source": [ "print(f\"My favorite fruit is {favorite_fruit}\")" ] @@ -211,12 +165,10 @@ { "cell_type": "code", "execution_count": null, - "id": "84b1e410-5eda-4e2c-97ce-4eebcff816c5", + "id": "ce258424-40c3-49a7-9462-e6fa25014b03", "metadata": {}, "outputs": [], - "source": [ - "print(f\"My favorite fruit is {favorite_fruit} - ok\")" - ] + "source": [] }, { "cell_type": "markdown", @@ -269,25 +221,10 @@ "Click in the cell and press the Bin icon if you want to remove it." ] }, - { - "cell_type": "markdown", - "id": "b3b2d1ff-5d2c-47a9-9c1b-90a0cfb89dd9", - "metadata": {}, - "source": [ - "# This is a heading\n", - "## This is a sub-head\n", - "### And a sub-sub-head\n", - "\n", - "I like Jupyter Lab because it's\n", - "- Easy\n", - "- Flexible\n", - "- Satisfying" - ] - }, { "cell_type": "code", "execution_count": null, - "id": "a365b651-3a34-40ed-8def-df1e6a484b43", + "id": "e1586320-c90f-4f22-8b39-df6865484950", "metadata": {}, "outputs": [], "source": [] @@ -308,21 +245,10 @@ }, { "cell_type": "code", - "execution_count": 1, - "id": "b1b303d9-ce47-4cee-85e9-6416abca7d21", + "execution_count": null, + "id": "82042fc5-a907-4381-a4b8-eb9386df19cd", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Guide to Jupyter.ipynb day2 EXERCISE.ipynb troubleshooting.ipynb\n", - "Intermediate Python.ipynb day5.ipynb week1 EXERCISE.ipynb\n", - "\u001b[34mcommunity-contributions\u001b[m\u001b[m diagnostics.py\n", - "day1.ipynb \u001b[34msolutions\u001b[m\u001b[m\n" - ] - } - ], + "outputs": [], "source": [ "# list the current directory\n", "\n", @@ -332,13 +258,13 @@ { "cell_type": "code", "execution_count": null, - "id": "18685382-3768-4e00-817b-cc69dd1fb531", + "id": "4fc3e3da-8a55-40cc-9706-48bf12a0e20e", "metadata": {}, "outputs": [], "source": [ - "# ping a website\n", + "# ping cnn.com - press the stop button in the toolbar when you're bored\n", "\n", - "!ping google.com" + "!ping cnn.com" ] }, { @@ -369,7 +295,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "2646a4e5-3c23-4aee-a34d-d623815187d2", "metadata": {}, "outputs": [], @@ -387,18 +313,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "6e96be3d-fa82-42a3-a8aa-b81dd20563a5", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "100%|███████████████████████████████████████| 1000/1000 [00:11<00:00, 86.00it/s]\n" - ] - } - ], + "outputs": [], "source": [ "# And now, with a nice little progress bar:\n", "\n", @@ -413,27 +331,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "63c788dd-4618-4bb4-a5ce-204411a38ade", "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "# This is a big heading!\n", - "\n", - "- And this is a bullet-point\n", - "- So is this\n", - "- Me, too!" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# On a different topic, here's a useful way to print output in markdown\n", "\n", @@ -471,7 +372,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/week1/troubleshooting.ipynb b/week1/troubleshooting.ipynb index d8cdf8f..23eca6f 100644 --- a/week1/troubleshooting.ipynb +++ b/week1/troubleshooting.ipynb @@ -40,18 +40,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "d296f9b6-8de4-44db-b5f5-9b653dfd3d81", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connected to the internet and can reach Google\n" - ] - } - ], + "outputs": [], "source": [ "import urllib.request\n", "\n", @@ -109,20 +101,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "7c8c0bb3-0e94-466e-8d1a-4dfbaa014cbe", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Virtualenv is active:\n", - "Environment Path: /Users/elijahsmac/Desktop/code/llm/llm_engineering/llms\n", - "Environment Name: llms\n" - ] - } - ], + "outputs": [], "source": [ "# Some quick checks that your Conda environment or VirtualEnv is as expected\n", "# The Environment Name should be: llms\n", @@ -182,22 +164,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "6c78b7d9-1eea-412d-8751-3de20c0f6e2f", "metadata": {}, - "outputs": [ - { - "ename": "ModuleNotFoundError", - "evalue": "No module named 'openai'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[8], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# This import should work if your environment is active and dependencies are installed!\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mopenai\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m OpenAI\n", - "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'openai'" - ] - } - ], + "outputs": [], "source": [ "# This import should work if your environment is active and dependencies are installed!\n", "\n", @@ -231,19 +201,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "caa4837e-b970-4f89-aa9a-8aa793c754fd", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - ".env file found.\n", - "SUCCESS! OPENAI_API_KEY found and it has the right prefix\n" - ] - } - ], + "outputs": [], "source": [ "from pathlib import Path\n", "\n", @@ -293,18 +254,10 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ab9ea6ef-49ee-4899-a1c7-75a8bd9ac36b", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "There is already a .env file - if you want me to create a new one, change the variable overwrite_if_already_exists to True above\n" - ] - } - ], + "outputs": [], "source": [ "# Only run this code in this cell if you want to have a .env file created for you!\n", "\n", @@ -418,22 +371,10 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "cccb58e7-6626-4033-9dc1-e7e3ff742f6b", "metadata": {}, - "outputs": [ - { - "ename": "ModuleNotFoundError", - "evalue": "No module named 'openai'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mopenai\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m OpenAI\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mdotenv\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m load_dotenv\n\u001b[1;32m 3\u001b[0m load_dotenv(override\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n", - "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'openai'" - ] - } - ], + "outputs": [], "source": [ "from openai import OpenAI\n", "from dotenv import load_dotenv\n", @@ -522,110 +463,10 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "248204f0-7bad-482a-b715-fb06a3553916", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Starting diagnostics at 2025-08-02 23:16:47\n", - "\n", - "===== System Information =====\n", - "Operating System: Darwin\n", - "MacOS Version: 10.16\n", - "Architecture: ('64bit', 'Mach-O')\n", - "Machine: x86_64\n", - "Processor: i386\n", - "Total RAM: 16.00 GB\n", - "Available RAM: 6.04 GB\n", - "Free Disk Space: 315.94 GB\n", - "\n", - "===== File System Information =====\n", - "Current Directory: /Users/elijahsmac/Desktop/code/llm/llm_engineering/week1\n", - "Write permission: OK\n", - "\n", - "Files in Current Directory:\n", - " - .ipynb_checkpoints\n", - " - Guide to Jupyter.ipynb\n", - " - Intermediate Python.ipynb\n", - " - __pycache__\n", - " - community-contributions\n", - " - day1.ipynb\n", - " - day2 EXERCISE.ipynb\n", - " - day5.ipynb\n", - " - diagnostics.py\n", - " - report.txt\n", - " - solutions\n", - " - troubleshooting.ipynb\n", - " - week1 EXERCISE.ipynb\n", - "\n", - "===== Git Repository Information =====\n", - "Git Repository Root: /Users/elijahsmac/Desktop/code/llm/llm_engineering\n", - "Current Commit: 3a042500d7db3c0e8cde89f836a60e6cd7ab9ba1\n", - "Remote Origin: git@github.com:ed-donner/llm_engineering.git\n", - "\n", - "===== Environment File Check =====\n", - ".env file exists at: /Users/elijahsmac/Desktop/code/llm/llm_engineering/.env\n", - "OPENAI_API_KEY found in .env file\n", - "\n", - "===== Anaconda Environment Check =====\n", - "No active Anaconda environment detected\n", - "\n", - "===== Virtualenv Check =====\n", - "Virtualenv is active:\n", - "Environment Path: /Users/elijahsmac/Desktop/code/llm/llm_engineering/llms\n", - "Environment Name: llms\n", - "\n", - "Python Environment:\n", - "Python Version: 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 11:09:21) [Clang 14.0.6 ]\n", - "Python Executable: /Users/elijahsmac/anaconda3/bin/python\n", - "\n", - "Required Package Versions:\n", - "ERROR: Required package 'openai' is not installed\n", - "python-dotenv: 1.1.0\n", - "requests: 2.32.3\n", - "ERROR: Required package 'gradio' is not installed\n", - "ERROR: Required package 'transformers' is not installed\n", - "\n", - "===== Network Connectivity Check =====\n", - "SSL Version: OpenSSL 3.0.16 11 Feb 2025\n", - "ERROR: Required packages are not installed. Please install them using 'pip install requests speedtest-cli'\n", - "\n", - "===== Environment Variables Check =====\n", - "\n", - "PYTHONPATH is not set.\n", - "\n", - "Python sys.path:\n", - " - /Users/elijahsmac/anaconda3/lib/python313.zip\n", - " - /Users/elijahsmac/anaconda3/lib/python3.13\n", - " - /Users/elijahsmac/anaconda3/lib/python3.13/lib-dynload\n", - " - \n", - " - /Users/elijahsmac/anaconda3/lib/python3.13/site-packages\n", - " - /Users/elijahsmac/anaconda3/lib/python3.13/site-packages/aeosa\n", - " - /Users/elijahsmac/anaconda3/lib/python3.13/site-packages/setuptools/_vendor\n", - "OPENAI_API_KEY is set after calling load_dotenv()\n", - "\n", - "===== Additional Diagnostics =====\n", - "Temp directory is writable: /var/folders/_1/d6xg9lvd4lb714ry78xpc10w0000gn/T\n", - "\n", - "===== Errors Found =====\n", - "The following critical issues were detected. Please address them before proceeding:\n", - "- Required package 'openai' is not installed\n", - "- Required package 'gradio' is not installed\n", - "- Required package 'transformers' is not installed\n", - "- Required packages are not installed. Please install them using 'pip install requests speedtest-cli'\n", - "\n", - "\n", - "Completed diagnostics at 2025-08-02 23:16:47\n", - "\n", - "\n", - "Please send these diagnostics to me at ed@edwarddonner.com\n", - "Either copy & paste the above output into an email, or attach the file report.txt that has been created in this directory.\n" - ] - } - ], + "outputs": [], "source": [ "# Run my diagnostics report to collect key information for debugging\n", "# Please email me the results. Either copy & paste the output, or attach the file report.txt\n", @@ -660,7 +501,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.7" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/week1/week1 EXERCISE.ipynb b/week1/week1 EXERCISE.ipynb index 2cbd323..7e80d75 100644 --- a/week1/week1 EXERCISE.ipynb +++ b/week1/week1 EXERCISE.ipynb @@ -19,6 +19,7 @@ "outputs": [], "source": [ "# imports\n", + "# Important Pull request ref: https://chatgpt.com/share/677a9cb5-c64c-8012-99e0-e06e88afd293\n", "\n", "import re, requests, ollama\n", "from bs4 import BeautifulSoup\n",