Skip to content
tkdyun.xyz

Stable Diffusion for Jetson

Porting and optimizing SD to an 8 GB Jetson Orin Nano

Generative AI

Year
2025
Role
Solo • Intern · ALLAI
Stack
Stable Diffusion · TensorRT · Docker · PyTorch · JetPack
View on GitHub

Jetson Docker Setup

For NVIDIA Jetson devices running JetPack 6 (L4T r36.4.0), a dedicateddockerfile and docker-compose.yaml were provided to optimize the environment for Jetson's aarch64 architecture.

Dockerfile

Built on nvcr.io/nvidia/l4t-jetpack:r36.4.0, it installs PyTorch 2.9.1 and Torchvision 0.24.1 built for JetPack 6 (cu126, aarch64), CUDSS for accelerated sparse solvers, and a dedicated non-root user for the workspace.

docker-compose.yaml

Uses the nvidia driver for full GPU acceleration, binds a local./workspace directory for persistent storage, and exposes port 8888 for Jupyter notebooks.

Usage

1. Execute Docker Container

$ docker compose build
$ docker compose up -d
$ docker attach jetson_docker

2. Generate Images

$ python3 optimizedSD/optimized_txt2img.py \
  --prompt "A highly detailed cinematic portrait..." \
  --H 512 --W 512 \
  --seed 27 --n_iter 1 --n_samples 1 --dim_steps 50

Results

Images generated on the Jetson Orin Nano (8 GB):

PromptResult
A highly detailed cinematic portrait of a cybernetic wanderer in a neon-lit futuristic Seoul street, wearing techwear clothing, intricate mechanical details on face, rainy night, reflection on puddles, photorealistic, masterpiece, shot on 35mm lens, sharp focus, depth of field.
High quality result
A highly detailed cinematic portrait of a cybernetic wanderer in a neon-lit futuristic Seoul street, wearing techwear clothing, intricate mechanical details on face, rainy night, reflection on puddles
Lower quality result
Korean man wearing coat jacket in the coffee shop drink iced americano using transparent straw.
Korean man drinking coffee

Search the site

Choose a destination, or type to search.