SETUP Mac
SETUP Mac
Before we begin
If you’re less familiar with using the Terminal, please review this excellent guide
for some details and exercises.
If you’re new to developing on your Mac, you may need to install XCode developer
tools. Here are instructions.
One “gotcha” to keep in mind: if you run anti-virus software, VPN or a Firewall,
it might interfere with installations or network access. Please temporarily disable
if you have problems.
1
If you don’t have a projects folder, you can create one:
mkdir ~/Documents/Projects
cd ~/Documents/Projects
3. Clone the repository:
Enter this in the terminal in the Projects folder:
git clone https://github.com/ed-donner/llm_engineering.git
This creates a new directory llm_engineering within your Projects folder and
downloads the code for the class. Do cd llm_engineering to go into it. This
llm_engineering directory is known as the “project root directory”.
2
• In the Terminal window, from within the llm_engineering folder, type:
jupyter lab
. . . and Jupyter Lab should open up in a browser. If you’ve not seen Jupyter
Lab before, I’ll explain it in a moment! Now close the jupyter lab browser tab,
and close the Terminal, and move on to Part 3.
3
For week 1, you’ll only need OpenAI, and you can add the others if you wish
later on.
1. Create an OpenAI account if you don’t have one by visiting:
https://platform.openai.com/
2. OpenAI asks for a minimum credit to use the API. For me in the US, it’s
$5. The API calls will spend against this $5. On this course, we’ll only
use a small portion of this. I do recommend you make the investment as
you’ll be able to put it to excellent use. But if you’d prefer not to pay for
the API, I give you an alternative in the course using Ollama.
You can add your credit balance to OpenAI at Settings > Billing:
https://platform.openai.com/settings/organization/billing/overview
I recommend you disable the automatic recharge!
3. Create your API key
The webpage where you set up your OpenAI key is at https://platform.openai.com/api-
keys - press the green ‘Create new secret key’ button and press ‘Create secret
key’. Keep a record of the API key somewhere private; you won’t be able to
retrieve it from the OpenAI screens in the future. It should start sk-proj-.
In week 2 we will also set up keys for Anthropic and Google, which you can do
here when we get there.
- Claude API at https://console.anthropic.com/ from Anthropic - Gemini API
at https://ai.google.dev/gemini-api from Google
Later in the course you’ll be using the fabulous HuggingFace platform; an account
is available for free at https://huggingface.co - you can create an API token from
the Avatar menu » Settings » Access Tokens.
And in Week 6/7 you’ll be using the terrific Weights & Biases at https://wandb.ai
to watch over your training batches. Accounts are also free, and you can set up
a token in a similar way.
4
4. Then type your API keys into nano, replacing xxxx with your API key
(starting sk-proj-).
OPENAI_API_KEY=xxxx
If you have other keys, you can add them too, or come back to this in future
weeks:
GOOGLE_API_KEY=xxxx
ANTHROPIC_API_KEY=xxxx
DEEPSEEK_API_KEY=xxxx
HF_TOKEN=xxxx
5. Save the file:
Control + O
Enter (to confirm save the file)
Control + X to exit the editor
6. Use this command to list files in your project root directory:
ls -a
And confirm that the .env file is there.
This file won’t appear in Jupyter Lab because jupyter hides files starting with
a dot. This file is listed in the .gitignore file, so it won’t get checked in and
your keys stay safe.
Part 5 - Showtime!!
• Open Terminal (Applications > Utilities > Terminal)
• Navigate to the “project root directory” using cd ~/Documents/Projects/llm_engineering
(replace this path with the actual path to the llm_engineering directory,
your locally cloned version of the repo). Do ls and check you can see
subdirectories for each week of the course.
• Activate your environment with conda activate llms (or source
llms/bin/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.
And you’re off to the races!
Note that any time you start jupyter lab in the future, you’ll need to follow
these Part 5 instructions to start it from within the llm_engineering directory
with the llms environment activated.
For those new to Jupyter Lab / Jupyter Notebook, it’s a delightful Data Science
environment where you can simply hit shift+return in any cell to run it; start
5
at the top and work your way down! I’ve included a notebook called ‘Guide to
Jupyter’ that shows you more features. When we move to Google Colab in Week
3, you’ll experience the same interface for Python runtimes in the cloud.
If you have any problems, I’ve included a notebook in week1 called troubleshoot-
ing.ipynb to figure it out.
Please do message me or email me at [email protected] if this doesn’t work
or if I can help with anything. I can’t wait to hear how you get on.