|
| 1 | +# Running Locally |
| 2 | + |
| 3 | +You can run the notebooks locally on your own machine by following the steps below. |
| 4 | + |
| 5 | +We recommend using `uv` for dependencies as it is much faster and automatically manages a `.venv` for you. |
| 6 | + |
| 7 | +However, you can also install dependencies with plain `pip` if you prefer. |
| 8 | + |
| 9 | +> |
| 10 | +> PyTorch (`torch`) is **not included** in the installation instructions below. PyTorch wheels differ depending on your system and can be very large if installed incorrectly. |
| 11 | +> |
| 12 | +> Please install the version suitable for your setup by following the [official PyTorch installation guide](https://pytorch.org/get-started/locally/). |
| 13 | +
|
| 14 | +## 1. Cloning the repository |
| 15 | +Clone the repository to your machine: |
| 16 | +```bash |
| 17 | +git clone https://github.com/acceleratescience/diffusion-models |
| 18 | +cd diffusion-models |
| 19 | +``` |
| 20 | +Alternatively, if you're using an IDE such as VS Code or PyCharm, you can paste the repository URL directly into the IDE's respective clone repository UI. |
| 21 | + |
| 22 | +## 2. Installing dependencies with `uv` (preferred) |
| 23 | +### Windows (Powershell) |
| 24 | +Install uv if needed: |
| 25 | +```bash |
| 26 | +irm https://astral.sh/uv/install.ps1 | iex |
| 27 | +``` |
| 28 | +Create the virtual environment and install dependencies: |
| 29 | +```bash |
| 30 | +uv sync |
| 31 | +``` |
| 32 | +Finally, activate the environment: |
| 33 | +```bash |
| 34 | +.\.venv\Scripts\activate |
| 35 | +``` |
| 36 | +### macOS / Linux |
| 37 | +Install uv if needed: |
| 38 | +```bash |
| 39 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 40 | +``` |
| 41 | +Create the virtual environment and install dependencies: |
| 42 | +```bash |
| 43 | +uv sync |
| 44 | +``` |
| 45 | +Finally, activate the environment: |
| 46 | +```bash |
| 47 | +source .venv/bin/activate |
| 48 | +``` |
| 49 | + |
| 50 | +## 3. Installing dependencies with `pip` (alternative) |
| 51 | +### Windows (Powershell) |
| 52 | +Create and activate an empty virtual environment: |
| 53 | +```bash |
| 54 | +python3 -m diffusion-models .venv |
| 55 | +.\.venv\Scripts\activate |
| 56 | +``` |
| 57 | +Finally, install dependencies to virtual environment: |
| 58 | +```bash |
| 59 | +pip install . |
| 60 | +``` |
| 61 | +### macOS / Linux |
| 62 | +Create and activate an empty virtual environment: |
| 63 | +```bash |
| 64 | +python3 -m diffusion-models .venv |
| 65 | +source .venv\bin\activate |
| 66 | +``` |
| 67 | +Finally, install dependencies to virtual environment: |
| 68 | +```bash |
| 69 | +pip install . |
| 70 | +``` |
0 commit comments