Seeed-Jetson-DevelopTool / local-llm-text-to-image
AGENTS.md57 starsChanged 4 months agoMITView on GitHub
Run local text-to-image generation on Jetson Orin NX 16GB using Stable Diffusion. Covers three approaches — KerasCV, Hugging Face diffusers, and NVIDIA Jetson Containers (AUTOMATIC1111 WebUI). Includes a Flask API for on-demand image generation. Requires JetPack 5.1.1+.
- Deletes or force-pushes
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository297 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ai-nvrAGENTS.md
- allxon-ota-updateAGENTS.md
- allxon-setupAGENTS.md
- alwaysai-setupAGENTS.md
- backup-restoreAGENTS.md
- bsp-source-buildAGENTS.md
- clawdbot-developmentAGENTS.md
- cochl-sense-setupAGENTS.md
- cvedia-setupAGENTS.md
- dashcamnet-xavier-nx-multicameraAGENTS.md
- deciai-setupAGENTS.md
- deepseek-quick-deployAGENTS.md
- deploy-deepseek-mlcAGENTS.md
- deploy-depth-anything-v3AGENTS.md
- deploy-diaAGENTS.md
- deploy-efficient-vision-engineAGENTS.md
- deploy-frigateAGENTS.md
- deploy-live-vlm-webuiAGENTS.md
- deploy-nvbloxAGENTS.md
- deploy-ollama-anythingllmAGENTS.md
- deploy-riva-llama2AGENTS.md
- developtool-deviceAGENTS.md
- disk-encryptionAGENTS.md
- diy-bsp-buildAGENTS.md
- ethercat-communicationAGENTS.md
- ethercat-setupAGENTS.md
- finetune-llm-llama-factoryAGENTS.md
- fix-browser-snap-jetsonAGENTS.md
- gapi-setupAGENTS.md
- generative-ai-introAGENTS.md
- gpt-oss-liveAGENTS.md
- gr00t-n1-5-deploy-thorAGENTS.md
- gr00t-n1-6-deploy-agxAGENTS.md
- hardhat-setupAGENTS.md
- hybrid-bsp-dk-to-recomputerAGENTS.md
- imx477-a603-setupAGENTS.md
- j501-viola-fruit-sortingAGENTS.md
- jetpack5-ssd-boot-fixAGENTS.md
- jetpack-flash-wsl2AGENTS.md
- jetpack-jetson-overviewAGENTS.md
- jetpack-ota-updateAGENTS.md
- jetson-ai-toolsAGENTS.md
- jetson-docker-setupAGENTS.md
- jetson-faqAGENTS.md
- jetson-pc-wired-shareAGENTS.md
- jetson-project-galleryAGENTS.md
- jetson-resource-indexAGENTS.md
- jetson-tutorial-exercisesAGENTS.md
- ko-module-buildAGENTS.md
- l4t-differencesAGENTS.md
- langchain-output-formattingAGENTS.md
- lerobot-env-setupAGENTS.md
- llama-cpp-rpc-distributedAGENTS.md
- llm-interface-controlAGENTS.md
- local-chatbot-multimodalAGENTS.md
- local-chatbot-physicalAGENTS.md
- local-rag-llamaindexAGENTS.md
- lumeo-setupAGENTS.md
- maskcam-nanoAGENTS.md
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Run one phase at a time. After each phase:
- Very specific: line 16
If output contains [STOP] → stop, consult the failure decision tree.
- Very specific: line 17
If output ends with [OK] → tell the user "Phase N complete" and proceed.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Text-to-Image with Stable Diffusion on Jetson
Generate images from text prompts locally on Jetson using Stable Diffusion. Three deployment paths: KerasCV with TensorFlow, Hugging Face diffusers with PyTorch, and NVIDIA's containerized AUTOMATIC1111 WebUI.
Execution model
Run one phase at a time. After each phase:
- Relay all output to the user.
- If output contains
[STOP]→ stop, consult the failure decision tree. - If output ends with
[OK]→ tell the user "Phase N complete" and proceed.
Prerequisites
| Requirement | Detail |
| Hardware | Jetson Orin NX 16GB (e.g. reComputer J4012) |
| JetPack | 5.1.1+ |
| Storage | ~20 GB free (models are large) |
| RAM tips | Disable desktop GUI to save ~800 MB. Consider disabling ZRAM and using swap. |
Path A — KerasCV Stable Diffusion
Phase A1 — Create virtual environment and install TensorFlow (~10 min)
sudo apt install python3.8-venv
python3 -m venv kerasStableEnvironment
source kerasStableEnvironment/bin/activate
cd kerasStableEnvironment
pip install -U pip
pip install -U numpy grpcio absl-py py-cpuinfo psutil portpicker six mock requests gast h5py astor termcolor protobuf keras-applications keras-preprocessing wrapt google-pasta setuptools testresourcesInstall TensorFlow for your JetPack version (example for JP 5.1.1):
pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v511 tensorflow==2.12.0+nv23.05Verify:
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"[OK] when GPU device is listed.
Phase A2 — Install PyTorch and KerasCV (~5 min)
sudo apt install libopenblas-dev
pip install --no-cache https://developer.download.nvidia.com/compute/redist/jp/v511/pytorch/torch-2.0.0+nv23.05-cp38-cp38-linux_aarch64.whl
pip install keras-cv==0.5.1 keras==2.12.0 PillowVerify PyTorch CUDA:
python -c "import torch; print(torch.cuda.is_available())"[OK] when both return True/GPU.
Phase A3 — Generate an image (~2–5 min)
cat > generate_image.py << 'PYEOF'
import keras_cv
import keras
from PIL import Image
keras.mixed_precision.set_global_policy("mixed_float16")
model = keras_cv.models.StableDiffusion(img_width=512, img_height=512, jit_compile=True)
prompt = "a cute magical flying dog, fantasy art, golden color, high quality"
image = model.text_to_image(prompt, num_steps=25, batch_size=1)
Image.fromarray(image[0]).save("keras_generate_image.png")
print("Image saved: keras_generate_image.png")
PYEOF
python generate_image.py[OK] when keras_generate_image.png is created.
Path B — Hugging Face Diffusers
Phase B1 — Create virtual environment and install PyTorch (~5 min)
python3 -m venv huggingfaceTesting
source huggingfaceTesting/bin/activate
cd huggingfaceTesting
sudo apt install libopenblas-dev
pip install --no-cache https://developer.download.nvidia.com/compute/redist/jp/v511/pytorch/torch-2.0.0+nv23.05-cp38-cp38-linux_aarch64.whl
pip install diffusers transformers accelerate[OK] when all packages install.
Phase B2 — Generate with Stable Diffusion v1.5 (~5–10 min first run)
cat > stableDiffusion.py << 'PYEOF'
from diffusers import StableDiffusionPipeline
import torch
model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
prompt = "a master jedi cat in star wars holding a lightsaber, cinematic lighting"
image = pipe(prompt).images[0]
image.save("cat_jedi.png")
print("Image saved: cat_jedi.png")
PYEOF
python stableDiffusion.pyFirst run downloads model checkpoints (~4 GB).
[OK] when cat_jedi.png is created.
Phase B3 — Try SDXL-Turbo (optional, faster)
cat > sdxl_turbo.py << 'PYEOF'
from diffusers import AutoPipelineForText2Image
import torch
pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")
prompt = "full body, cat dressed as a Viking, with weapon, hyper-detail, cinematic"
image = pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
image.save("sdxl-turbo.png")
print("Image saved: sdxl-turbo.png")
PYEOF
python sdxl_turbo.py[OK] when image is generated (~30 s).
Path C — NVIDIA Jetson Containers (AUTOMATIC1111 WebUI)
Phase C1 — Install Jetson Containers (~3 min)
git clone https://github.com/dusty-nv/jetson-containers
cd jetson-containers
sudo apt update
sudo apt install -y python3-pip
pip3 install -r requirements.txt[OK] when requirements install.
Phase C2 — Run Stable Diffusion WebUI container (~10–20 min first run)
cd jetson-containers
./run.sh $(./autotag stable-diffusion-webui)Accept the container pull when prompted. The container downloads the model and starts the WebUI on port 7860.
Open browser: http://<jetson-ip>:7860
[OK] when the AUTOMATIC1111 WebUI loads with a checkpoint selected.
[STOP] if no checkpoint appears — check disk space with df -h.
Phase C3 — Add Stable Diffusion XL model (optional)
CONTAINERS_DIR=~/jetson-containers
MODEL_DIR=$CONTAINERS_DIR/data/models/stable-diffusion/models/Stable-diffusion/
sudo chown -R $USER $MODEL_DIR
wget -P $MODEL_DIR https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensorsRefresh the checkpoint dropdown in the WebUI.
[OK] when SDXL model appears in the dropdown.
Failure decision tree
| Symptom | Action |
| TensorFlow GPU not detected | Verify JetPack version matches TF wheel. Check CUDA: nvcc --version. |
PyTorch torch.cuda.is_available() returns False | Reinstall PyTorch wheel matching your JetPack. Check nvidia-smi. |
| OOM during image generation | Reduce image size (e.g. 256x256). Disable desktop GUI. Enable swap. |
| Model download fails | Check disk space: df -h. Clear cache: rm -rf ~/.cache/huggingface. |
| AUTOMATIC1111 no checkpoint | Disk full. Free space and restart container. |
| Container gets killed | Not enough RAM/swap. Add swap: sudo fallocate -l 8G /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile. |
| Flask API not accessible | Check firewall: sudo ufw allow 8080. Verify Flask is running on 0.0.0.0. |
pip install keras-cv fails | Check Python version matches (3.8 for JP 5.1.1). Try pip install --no-cache-dir. |
Reference files
references/source.body.md— Full Seeed Wiki tutorial with all three deployment paths, Flask API code, screenshots, and additional model examples from Civitai (reference only)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

