You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dgx_spark.md
+32-15Lines changed: 32 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,14 @@
1
-
# MaxDiffusion on DGX Spark GPU: A complete User Guide
1
+
# MaxDiffusion on Nvidia DGX Spark GPU: A complete User Guide
2
2
3
-
This guide provides a detailed step-by-step walkthrough for setting up and running the maxdiffusion library within a custom Docker environment on an ARM-based machine with NVIDIA GPU support (like a spark VM). We will cover everything from building the optimized Docker image to generating your first image and retrieving it successfully.
3
+
This guide provides a detailed step-by-step walkthrough for setting up and running the maxdiffusion library within a custom Docker environment on an ARM-based machine with NVIDIA GPU support. We will cover everything from building the optimized Docker image to generating your first image and retrieving it successfully.
4
4
5
5
## Prerequisites
6
6
7
7
Before you begin, ensure you have the following:
8
8
9
-
- Access to an ARM-based Linux machine (e.g., your spark VM) with Docker installed.
10
-
- NVIDIA GPU drivers and the NVIDIA Container Toolkit installed on the host machine to enable `--gpus all` support.
9
+
- Access to [Nvidia DGX Spark Box](https://www.nvidia.com/en-us/products/workstations/dgx-spark/).
11
10
- The maxdiffusion source code cloned onto the machine.
12
11
- Branch: dgx_spark
13
-
- A requirements.txt file in the root of the maxdiffusion directory
14
12
- An internet connection for the initial Docker build and for downloading models (if not cached).
15
13
16
14
## Part 1: Building the Optimized Docker Image
@@ -22,7 +20,8 @@ The foundation of a smooth workflow is a well-built Docker image. The following
22
20
In the root directory of your maxdiffusion project, create a file named box.Dockerfile and paste the following content into it.
23
21
24
22
```docker
25
-
# Base image for ARM64 with CUDA support
23
+
# Nvidia Base image for ARM64 with CUDA support
24
+
# As JAX AI Image as it currently doesn't support ARM builds.
26
25
FROM nvcr.io/nvidia/cuda-dl-base@sha256:3631d968c12ef22b1dfe604de63dbc71a55f3ffcc23a085677a6d539d98884a4
27
26
28
27
# Set environment variables (these rarely change)
@@ -65,27 +64,27 @@ CMD ["/bin/bash"]
65
64
66
65
### Step2: Build the Image
67
66
68
-
Open your terminal on the spark VM, navigate to the root directory of the maxdiffusion project, and run the build command:
67
+
Open your terminal on DGX Spark, navigate to the root directory of the maxdiffusion project, and run the build command:
This command will execute the steps in your Dockerfile, download the necessary layers, install all dependencies, and create a local Docker image named maxdiffusion-arm-gpu. The first build may take some time. Subsequent builds will be much faster if you only change the source code.
73
+
This command will execute the steps in your Dockerfile, download the necessary layers, install all dependencies, and create a local Docker image named `maxdiffusion-arm-gpu`. The first build may take some time. Subsequent builds will be much faster if you only change the source code.
75
74
76
75
## Part 2: Running the Container for Image Generation
77
76
78
77
To run the image generator effectively, we need to connect our local machine's folders to the container. This prevents re-downloading models and makes it easy to retrieve the output images.
79
78
80
79
### Step 1: Create a Local Output Directory
81
80
82
-
On your spark VM, create a directory to store the generated images.
81
+
On your DGX Spark, create a directory to store the generated images.
83
82
84
83
```bash
85
84
mkdir -p ~/maxdiffusion_output
86
85
```
87
86
88
-
### Step 2: Launch the Container with Volume Mounts
87
+
### Step 2a: Launch the Container with Volume Mounts
89
88
90
89
Run the following command to start an interactive session inside your container. This command links your Hugging Face cache (to avoid re-downloading models) and the output directory you just created.
91
90
@@ -97,6 +96,24 @@ maxdiffusion-arm-gpu
97
96
```
98
97
Your terminal prompt will change, indicating you are now inside the running container.
99
98
99
+
#### Step 2b: Log in to Hugging Face (First-Time Setup)
100
+
101
+
You must do this once to download the required model weights.
102
+
103
+
```bash
104
+
# [Inside the Docker Container]
105
+
huggingface-cli login
106
+
```
107
+
108
+
You will be prompted to paste a Hugging Face User Access Token.
109
+
110
+
1. Go to[ huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) in your web browser.
111
+
112
+
2. Copy your token (or create a new one with write permissions).
113
+
114
+
3. Paste the token into the terminal and press Enter.
115
+
116
+
100
117
## Part 3: Generating Your First Image
101
118
102
119
Now that you are inside the container's interactive shell, you can execute the image generation script. Run the following command:
@@ -112,30 +129,30 @@ The generation script saves the final image to its working directory (/app) insi
112
129
113
130
### Step 1: Copy the Image from Container to VM
114
131
115
-
Open a new terminal window and connect to your spark VM. Do not close the terminal where the container is running.
132
+
Open a new terminal window. Do not close the terminal where the container is running.
116
133
First, find your container's ID:
117
134
118
135
```bash
119
136
docker ps
120
137
```
121
138
122
139
Look for the container with the image maxdiffusion-arm-gpu and note its ID (e.g., 9049895399fc).
123
-
Now, copy the image from the container to a temporary location on the VM and fix its permissions.
140
+
Now, copy the image from the container to a temporary location on DGX Spark and fix its permissions.
0 commit comments