extend setup instructions (#120)
@ -15,7 +15,7 @@ There are several different ways you can install Python and set up your computin
|
|||||||
|
|
||||||
Download miniforge from the GitHub repository [here](https://github.com/conda-forge/miniforge).
|
Download miniforge from the GitHub repository [here](https://github.com/conda-forge/miniforge).
|
||||||
|
|
||||||
<img src="figures/download.png" alt="download" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/01_optional-python-setup-preferences/download.png" alt="download" width="600px">
|
||||||
|
|
||||||
Depending on your operating system, this should download either an `.sh` (macOS, Linux) or `.exe` file (Windows).
|
Depending on your operating system, this should download either an `.sh` (macOS, Linux) or `.exe` file (Windows).
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ sh ~/Desktop/Miniforge3-MacOSX-arm64.sh
|
|||||||
|
|
||||||
where `Desktop/` is the folder where the Miniforge installer was downloaded to. On your computer, you may have to replace it with `Downloads/`.
|
where `Desktop/` is the folder where the Miniforge installer was downloaded to. On your computer, you may have to replace it with `Downloads/`.
|
||||||
|
|
||||||
<img src="figures/miniforge-install.png" alt="miniforge-install" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/01_optional-python-setup-preferences/miniforge-install.png" alt="miniforge-install" width="600px">
|
||||||
|
|
||||||
Next, step through the download instructions, confirming with "Enter".
|
Next, step through the download instructions, confirming with "Enter".
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ After the installation was successfully completed, I recommend creating a new vi
|
|||||||
conda create -n LLMs python=3.10
|
conda create -n LLMs python=3.10
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="figures/new-env.png" alt="new-env" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/01_optional-python-setup-preferences/new-env.png" alt="new-env" width="600px">
|
||||||
|
|
||||||
> Many scientific computing libraries do not immediately support the newest version of Python. Therefore, when installing PyTorch, it's advisable to use a version of Python that is one or two releases older. For instance, if the latest version of Python is 3.13, using Python 3.10 or 3.11 is recommended.
|
> Many scientific computing libraries do not immediately support the newest version of Python. Therefore, when installing PyTorch, it's advisable to use a version of Python that is one or two releases older. For instance, if the latest version of Python is 3.13, using Python 3.10 or 3.11 is recommended.
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ Next, activate your new virtual environment (you have to do it every time you op
|
|||||||
conda activate LLMs
|
conda activate LLMs
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="figures/activate-env.png" alt="activate-env" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/01_optional-python-setup-preferences/activate-env.png" alt="activate-env" width="600px">
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
@ -83,13 +83,13 @@ To install new Python libraries, you can now use the `conda` package installer.
|
|||||||
conda install jupyterlab watermark
|
conda install jupyterlab watermark
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="figures/conda-install.png" alt="conda-install" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/01_optional-python-setup-preferences/conda-install.png" alt="conda-install" width="600px">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
You can also still use `pip` to install libraries. By default, `pip` should be linked to your new `LLms` conda environment:
|
You can also still use `pip` to install libraries. By default, `pip` should be linked to your new `LLms` conda environment:
|
||||||
|
|
||||||
<img src="figures/check-pip.png" alt="check-pip" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/01_optional-python-setup-preferences/check-pip.png" alt="check-pip" width="600px">
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
@ -106,7 +106,7 @@ However, since PyTorch is a comprehensive library featuring CPU- and GPU-compati
|
|||||||
|
|
||||||
It's also highly recommended to consult the installation guide menu on the official PyTorch website at [https://pytorch.org](https://pytorch.org).
|
It's also highly recommended to consult the installation guide menu on the official PyTorch website at [https://pytorch.org](https://pytorch.org).
|
||||||
|
|
||||||
<img src="figures/pytorch-installer.jpg" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/01_optional-python-setup-preferences/pytorch-installer.jpg" width="600px">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 180 KiB |
Before Width: | Height: | Size: 220 KiB |
Before Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 174 KiB |
Before Width: | Height: | Size: 258 KiB |
Before Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 94 KiB |
@ -17,19 +17,19 @@ Then, after completing the installation, please check if all the packages are in
|
|||||||
python python_environment_check.py
|
python python_environment_check.py
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="figures/check_1.jpg" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/02_installing-python-libraries/check_1.jpg" width="600px">
|
||||||
|
|
||||||
It's also recommended to check the versions in JupyterLab by running the `jupyter_environment_check.ipynb` in this directory, which should ideally give you the same results as above.
|
It's also recommended to check the versions in JupyterLab by running the `jupyter_environment_check.ipynb` in this directory, which should ideally give you the same results as above.
|
||||||
|
|
||||||
<img src="figures/check_2.jpg" width="500px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/02_installing-python-libraries/check_2.jpg" width="500px">
|
||||||
|
|
||||||
If you see the following issues, it's likely that your JupyterLab instance is connected to wrong conda environment:
|
If you see the following issues, it's likely that your JupyterLab instance is connected to wrong conda environment:
|
||||||
|
|
||||||
<img src="figures/jupyter-issues.jpg" width="450px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/02_installing-python-libraries/jupyter-issues.jpg" width="450px">
|
||||||
|
|
||||||
In this case, you may want to use `watermark` to check if you opened the JupyterLab instance in the right conda environment using the `--conda` flag:
|
In this case, you may want to use `watermark` to check if you opened the JupyterLab instance in the right conda environment using the `--conda` flag:
|
||||||
|
|
||||||
<img src="figures/watermark.jpg" width="350px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/02_installing-python-libraries/watermark.jpg" width="350px">
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@ -48,7 +48,7 @@ However, since PyTorch is a comprehensive library featuring CPU- and GPU-compati
|
|||||||
|
|
||||||
It's also highly recommended to consult the installation guide menu on the official PyTorch website at [https://pytorch.org](https://pytorch.org).
|
It's also highly recommended to consult the installation guide menu on the official PyTorch website at [https://pytorch.org](https://pytorch.org).
|
||||||
|
|
||||||
<img src="figures/pytorch-installer.jpg" width="600px">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/02_installing-python-libraries/pytorch-installer.jpg" width="600px">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 36 KiB |
@ -46,21 +46,41 @@ If you are using Visual Studio Code (VSCode) as your primary code editor, you ca
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Using Lightning Studio
|
||||||
|
|
||||||
|
For a smooth development experience in the cloud, I recommend the [Lightning AI Studio](https://lightning.ai/) platform, which allows users to set up a persistent environment and use both VSCode and Jupyter Lab on cloud CPUs and GPUs.
|
||||||
|
|
||||||
|
Once you start a new Studio, you can open the terminal and execute the following setup steps to clone the repository and install the dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/rasbt/LLMs-from-scratch.git
|
||||||
|
cd LLMs-from-scratch
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
(In contrast to Google Colab, these only need to be executed once since the Lightning AI Studion environments are persistent).
|
||||||
|
|
||||||
|
Then, navigate to the Python script or Jupyter Notebook you want to run. Optionally, you can also easily connect a GPU to accelerate the code's runtime, for example, when you are pretraining the LLM in chapter 5 or finetuning it in chapters 6 and 7.
|
||||||
|
|
||||||
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/README/studio.webp" alt="1" width="700">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Using Google Colab
|
## Using Google Colab
|
||||||
|
|
||||||
To use a Google Colab environment in the cloud, head over to [https://colab.research.google.com/](https://colab.research.google.com/) and open the respective chapter notebook from the GitHub menu or by dragging the notebook into the *Upload* field as shown in the figure below.
|
To use a Google Colab environment in the cloud, head over to [https://colab.research.google.com/](https://colab.research.google.com/) and open the respective chapter notebook from the GitHub menu or by dragging the notebook into the *Upload* field as shown in the figure below.
|
||||||
|
|
||||||
<img src="./figures/1.webp" alt="1" width="700">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/README/colab_1.webp" alt="1" width="700">
|
||||||
|
|
||||||
|
|
||||||
Also make sure you upload the relevant files (dataset files and .py files the notebook is importing from) to the Colab environment as well, as shown below.
|
Also make sure you upload the relevant files (dataset files and .py files the notebook is importing from) to the Colab environment as well, as shown below.
|
||||||
|
|
||||||
<img src="./figures/2.webp" alt="2" width="700">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/README/colab_2.webp" alt="2" width="700">
|
||||||
|
|
||||||
|
|
||||||
You can optionally run the code on a GPU by changing the *Runtime* as illustrated in the figure below.
|
You can optionally run the code on a GPU by changing the *Runtime* as illustrated in the figure below.
|
||||||
|
|
||||||
<img src="./figures/3.webp" alt="3" width="700">
|
<img src="https://sebastianraschka.com/images/LLMs-from-scratch-images/setup/README/colab_3.webp" alt="3" width="700">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 30 KiB |