From 55f0b8846fa1985251fedcaac614e91e5998d813 Mon Sep 17 00:00:00 2001 From: Edward Donner Date: Sat, 23 Nov 2024 09:13:39 -0500 Subject: [PATCH] Refined troubleshooting and setup --- SETUP-PC.md | 6 ++-- SETUP-mac.md | 2 +- extras/trading/prototype_trader.ipynb | 2 ++ week1/troubleshooting.ipynb | 48 ++++++++++++++++++++++----- 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/SETUP-PC.md b/SETUP-PC.md index 446283b..31ec6f2 100644 --- a/SETUP-PC.md +++ b/SETUP-PC.md @@ -48,7 +48,7 @@ This creates a new directory `llm_engineering` within your Projects folder and d ### Part 2: Install Anaconda environment -There is an alternative to Part 2 if this gives you problems. +If this Part 2 gives you any problems, there is an alternative Part 2B below that can be used instead. 1. **Install Anaconda:** @@ -158,11 +158,11 @@ This file won't appear in Jupyter Lab because jupyter hides files starting with ### Part 5 - Showtime!! -- Open **Anaconda Prompt** (search for it in the Start menu) +- Open **Anaconda Prompt** (search for it in the Start menu) if you used Anaconda, otherwise open a Powershell if you used the alternative approach in Part 2B - Navigate to the "project root directory" by entering something like `cd C:\Users\YourUsername\Documents\Projects\llm_engineering` using the actual path to your llm_engineering project root directory. Do a `dir` and check you can see subdirectories for each week of the course. -- Activate your environment with `conda activate llms` (or `llms\Scripts\activate` if you used the alternative approach in Part 2B) +- Activate your environment with `conda activate llms` if you used Anaconda or `llms\Scripts\activate` if you used the alternative approach in Part 2B - You should see (llms) in your prompt which is your sign that all is well. And now, type: `jupyter lab` and Jupyter Lab should open up, ready for you to get started. Open the `week1` folder and double click on `day1.ipynb`. diff --git a/SETUP-mac.md b/SETUP-mac.md index a323426..f7ea8c6 100644 --- a/SETUP-mac.md +++ b/SETUP-mac.md @@ -43,7 +43,7 @@ This creates a new directory `llm_engineering` within your Projects folder and d ### Part 2: Install Anaconda environment -There is an alternative to Part 2 if this gives you problems. +If this Part 2 gives you any problems, there is an alternative Part 2B below that can be used instead. 1. **Install Anaconda:** diff --git a/extras/trading/prototype_trader.ipynb b/extras/trading/prototype_trader.ipynb index 19cad6c..8ec9d06 100644 --- a/extras/trading/prototype_trader.ipynb +++ b/extras/trading/prototype_trader.ipynb @@ -15,6 +15,8 @@ "\n", "I generated test data using frontier models, in the other files in this directory. Use this to train an open source code model.\n", "\n", + "In this notebook we generate the dataset; then we move over to Google Colab for the fine-tuning.\n", + "\n", "\n", " \n", "
\n", diff --git a/week1/troubleshooting.ipynb b/week1/troubleshooting.ipynb index d68f9fb..1b1e45f 100644 --- a/week1/troubleshooting.ipynb +++ b/week1/troubleshooting.ipynb @@ -21,22 +21,50 @@ "source": [ "# Step 1\n", "\n", - "Try running the next cell (click in the cell under this one and hit shift+return).\n", + "Try running the next 2 cells (click in the cell under this one and hit shift+return, then shift+return again).\n", "\n", "If this gives an error, then you're likely not running in an \"activated\" environment. Please check back in Part 5 of the SETUP guide for [PC](../SETUP-PC.md) or [Mac](../SETUP-mac.md) for setting up the Anaconda (or virtualenv) environment and activating it, before running `jupyter lab`.\n", "\n", "If you look in the Anaconda prompt (PC) or the Terminal (Mac), you should see `(llms)` in your prompt where you launch `jupyter lab` - that's your clue that the llms environment is activated.\n", "\n", "If you are in an activated environment, the next thing to try is to restart everything:\n", - "1. Close down all Jupyter windows, like this\n", + "1. Close down all Jupyter windows, like this one\n", "2. Exit all command prompts / Terminals / Anaconda\n", - "3. Repeat Part 5 from the SETUP instructions to begin a new activated environment and launch jupyter lab\n", - "4. Kernel menu >> Restart Kernel and Clear Outputs of All Cells\n", - "5. Come back to this notebook and try the cell below again.\n", + "3. Repeat Part 5 from the SETUP instructions to begin a new activated environment and launch `jupyter lab` from the `llm_engineering` directory \n", + "4. Come back to this notebook, and do Kernel menu >> Restart Kernel and Clear Outputs of All Cells\n", + "5. Try the cell below again.\n", "\n", "If **that** doesn't work, then please contact me! I'll respond quickly, and we'll figure it out. Please run the diagnostics (last cell in this notebook) so I can debug. If you used Anaconda, it might be that for some reason your environment is corrupted, in which case the simplest fix is to use the virtualenv approach instead (Part 2B in the setup guides)." ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "7c8c0bb3-0e94-466e-8d1a-4dfbaa014cbe", + "metadata": {}, + "outputs": [], + "source": [ + "# Some quick checks that your Conda environment or VirtualEnv is as expected\n", + "# The Environment Name should be: llms\n", + "\n", + "import os\n", + "\n", + "conda_prefix = os.environ.get('CONDA_PREFIX')\n", + "if conda_prefix:\n", + " print(\"Anaconda environment is active:\")\n", + " print(f\"Environment Path: {conda_prefix}\")\n", + " print(f\"Environment Name: {os.path.basename(conda_prefix)}\")\n", + "\n", + "virtual_env = os.environ.get('VIRTUAL_ENV')\n", + "if virtual_env:\n", + " print(\"Virtualenv is active:\")\n", + " print(f\"Environment Path: {virtual_env}\")\n", + " print(f\"Environment Name: {os.path.basename(virtual_env)}\")\n", + "\n", + "if not conda_prefix and not virtual_env:\n", + " print(\"Neither Anaconda nor Virtualenv seems to be active. Did you start jupyter lab in an Activated environment? See Setup Part 5.\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -44,7 +72,7 @@ "metadata": {}, "outputs": [], "source": [ - "# This should run with no output - no import errors.\n", + "# And now, this should run with no output - no import errors.\n", "# Import errors might indicate that you started jupyter lab without your environment activated? See SETUP part 5.\n", "# Or you might need to restart your Kernel and Jupyter Lab.\n", "# Or it's possible that something is wrong with Anaconda, in which case we may have to use virtualenv instead.\n", @@ -65,7 +93,9 @@ "\n", "Note that the `.env` file won't show up in your Jupyter Lab file browser, because Jupyter hides files that start with a dot for your security; they're considered hidden files. If you need to change the name, you'll need to use a command terminal or File Explorer (PC) / Finder Window (Mac). Ask ChatGPT if that's giving you problems, or email me!\n", "\n", - "If you're having challenges creating the `.env` file, we can also do it with code! See the cell after the next one." + "If you're having challenges creating the `.env` file, we can also do it with code! See the cell after the next one.\n", + "\n", + "It's important to launch `jupyter lab` from the project root directory, `llm_engineering`. If you didn't do that, this cell might give you problems." ] }, { @@ -282,8 +312,8 @@ "\n", "## Please run this next cell to gather some important data\n", "\n", - "Please run the next cell; it should take a minute or so to run (mostly the network test).\n", - "Rhen email me the output of the last cell to ed@edwarddonner.com. \n", + "Please run the next cell; it should take a minute or so to run. Most of the time is checking your network bandwidth.\n", + "Then email me the output of the last cell to ed@edwarddonner.com. \n", "Alternatively: this will create a file called report.txt - just attach the file to your email." ] },