mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
GitHub markdown updates (#545)
* GitHub markdown updates * Apply suggestions from code review * Apply suggestions from code review
This commit is contained in:
committed by
GitHub
parent
bca82a9443
commit
f12b899d96
@@ -6,7 +6,8 @@ There are several ways to install Python and set up your computing environment.
|
||||
|
||||
<br>
|
||||
|
||||
> [!NOTE] If you are running any of the notebooks on Google Colab and want to install the dependencies, simply run the following code in a new cell at the top of the notebook and skip the rest of this tutorial:
|
||||
> **Note:**
|
||||
> If you are running any of the notebooks on Google Colab and want to install the dependencies, simply run the following code in a new cell at the top of the notebook and skip the rest of this tutorial:
|
||||
> `pip install uv && uv pip install --system -r https://raw.githubusercontent.com/rasbt/LLMs-from-scratch/refs/heads/main/requirements.txt`
|
||||
|
||||
The remaining sections below describe how you can manage your Python environment and packages on your local machine.
|
||||
@@ -24,7 +25,7 @@ In this tutorial, I am using a computer running macOS, but this workflow is simi
|
||||
This section guides you through the Python setup and package installation procedure using `uv` via its `uv pip` interface. The `uv pip` interface may feel more familiar to most Python users who have used pip before than the native `uv` commands.
|
||||
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> There are alternative ways to install Python and use `uv`. For example, you can install Python directly via `uv` and use `uv add` instead of `uv pip install` for even faster package management.
|
||||
>
|
||||
> If you are a macOS or Linux user and prefer the native `uv` commands, refer to the [./native-uv.md tutorial](./native-uv.md). I also recommend checking the official [`uv` documentation](https://docs.astral.sh/uv/).
|
||||
@@ -49,7 +50,11 @@ python --version
|
||||
If it returns 3.10 or newer, no further action is required.
|
||||
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> If `python --version` indicates that no Python version is installed, you may also want to check `python3 --version` since your system might be configured to use the `python3` command instead.
|
||||
|
||||
|
||||
> **Note:**
|
||||
> I recommend installing a Python version that is at least 2 versions older than the most recent release to ensure PyTorch compatibility. For example, if the most recent version is Python 3.13, I recommend installing version 3.10 or 3.11.
|
||||
|
||||
Otherwise, if Python is not installed or is an older version, you can install it for your operating system as described below.
|
||||
@@ -118,7 +123,7 @@ source .venv/bin/activate
|
||||
```
|
||||
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> If you are using Windows, you may have to replace the command above by `source .venv/Scripts/activate` or `.venv/Scripts/activate`.
|
||||
|
||||
|
||||
@@ -157,7 +162,7 @@ uv pip install -r https://raw.githubusercontent.com/rasbt/LLMs-from-scratch/refs
|
||||
|
||||
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> If you have problems with the following commands above due to certain dependencies (for example, if you are using Windows), you can always fall back to using regular pip:
|
||||
> `pip install -r requirements.txt`
|
||||
> or
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Native pixi Python and package management
|
||||
|
||||
This tutorial is an alternative to the [`./native-uv.md`](native-uv.md) document for those who prefer `pixi`'s native commands over traditional environment and package managers like `conda` and `pip`.
|
||||
This tutorial is an alternative to the [`./native-uv.md`](native-uv.md) document for those who prefer `pixi`'s native commands over traditional environment and package managers like `conda` and `pip`.
|
||||
|
||||
Note that pixi uses `uv add` under the hood, as described in [`./native-uv.md`](native-uv.md).
|
||||
Note that pixi uses `uv add` under the hood, as described in [`./native-uv.md`](native-uv.md).
|
||||
|
||||
Pixi and uv are both modern package and environment management tools for Python, but pixi is a polyglot package manager designed for managing not just Python but also other languages (similar to conda), while uv is a Python-specific tool optimized for ultra-fast dependency resolution and package installation.
|
||||
Pixi and uv are both modern package and environment management tools for Python, but pixi is a polyglot package manager designed for managing not just Python but also other languages (similar to conda), while uv is a Python-specific tool optimized for ultra-fast dependency resolution and package installation.
|
||||
|
||||
Someone might choose pixi over uv if they need a polyglot package manager that supports multiple languages (not just Python) or prefer a declarative environment management approach similar to conda. For more information, please visit the official [pixi documentation](https://pixi.sh/latest/).
|
||||
|
||||
@@ -37,7 +37,7 @@ wget -qO- https://pixi.sh/install.sh | sh
|
||||
powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> For more installation options, please refer to the official [pixi documentation](https://pixi.sh/latest/).
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ You can install Python using pixi:
|
||||
pixi add python=3.10
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> I recommend installing a Python version that is at least 2 versions older than the most recent release to ensure PyTorch compatibility. For example, if the most recent version is Python 3.13, I recommend installing version 3.10 or 3.11. You can find out the most recent Python version by visiting [python.org](https://www.python.org).
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ To install all required packages from a `pixi.toml` file (such as the one locate
|
||||
pixi install
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> If you encounter issues with dependencies (for example, if you are using Windows), you can always fall back to pip: `pixi run pip install -U -r requirements.txt`
|
||||
|
||||
By default, `pixi install` will create a separate virtual environment specific to the project.
|
||||
|
||||
@@ -49,7 +49,7 @@ powershell -c "irm https://astral.sh/uv/install.ps1 | more"
|
||||
|
||||
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> For more installation options, please refer to the official [uv documentation](https://docs.astral.sh/uv/getting-started/installation/#standalone-installer).
|
||||
|
||||
|
||||
@@ -61,12 +61,11 @@ To install all required packages from a `pyproject.toml` file (such as the one l
|
||||
uv sync --dev --python 3.11
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> If you do not have Python 3.11 available on your system, uv will download and install it for you.
|
||||
>
|
||||
> I recommend using a Python version that is at least 1-3 versions older than the most recent release to ensure PyTorch compatibility. For example, if the most recent version is Python 3.13, I recommend using version 3.10, 3.11, 3.12. You can find out the most recent Python version by visiting [python.org](https://www.python.org/downloads/).
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> If you have problems with the following commands above due to certain dependencies (for example, if you are using Windows), you can always fall back to regular pip:
|
||||
> `uv add pip`
|
||||
> `uv run python -m pip install -U -r requirements.txt`
|
||||
@@ -84,7 +83,7 @@ You can install new packages, that are not specified in the `pyproject.toml` via
|
||||
uv add packaging
|
||||
```
|
||||
|
||||
And you can remove packages via `uv remove`, for example,
|
||||
And you can remove packages via `uv remove`, for example,
|
||||
|
||||
```bash
|
||||
uv remove packaging
|
||||
@@ -136,13 +135,13 @@ On Windows (PowerShell):
|
||||
.venv\Scripts\activate
|
||||
```
|
||||
|
||||
Then, you can run scripts via
|
||||
Then, you can run scripts via
|
||||
|
||||
```bash
|
||||
python script.py
|
||||
```
|
||||
|
||||
and launch JupyterLab via
|
||||
and launch JupyterLab via
|
||||
|
||||
```bash
|
||||
juputer lab
|
||||
|
||||
@@ -6,7 +6,7 @@ I used the following libraries listed [here](https://github.com/rasbt/LLMs-from-
|
||||
|
||||
|
||||
|
||||
> [!NOTE]
|
||||
> **Note:**
|
||||
> If you you are using `uv` as described in [Option 1: Using uv](../01_optional-python-setup-preferences/README.md), you can replace `pip` via `pip uv` in the commands below. For example, `pip install -r requirements.txt` becomes `uv pip install -r requirements.txt`
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ The entire process is automated and might take a few minutes, depending on your
|
||||
|
||||
Once completed, VS Code will automatically connect to the container and reopen the project within the newly created Docker development environment. You will be able to write, execute, and debug code as if it were running on your local machine, but with the added benefits of Docker's isolation and consistency.
|
||||
|
||||
> [!WARNING]
|
||||
> **Warning:**
|
||||
> If you are encountering an error during the build process, this is likely because your machine does not support NVIDIA container toolkit because your machine doesn't have a compatible GPU. In this case, edit the `devcontainer.json` file to remove the `"runArgs": ["--runtime=nvidia", "--gpus=all"],` line and run the "Reopen Dev Container" procedure again.
|
||||
|
||||
9. Finished.
|
||||
|
||||
@@ -15,7 +15,7 @@ pip install -r requirements.txt
|
||||
|
||||
<br>
|
||||
|
||||
> [!NOTE] If you are running any of the notebooks on Google Colab and want to install the dependencies, simply run the following code in a new cell at the top of the notebook:
|
||||
> **Note:** If you are running any of the notebooks on Google Colab and want to install the dependencies, simply run the following code in a new cell at the top of the notebook:
|
||||
> `pip install uv && uv pip install --system -r https://raw.githubusercontent.com/rasbt/LLMs-from-scratch/refs/heads/main/requirements.txt`
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user