# Qwen-Image-Edit Rapid-AIO v23 — headless edit API (tour / MI50) Runs Phr00t's **Rapid-AIO NSFW v23** (the same tune as the gradio app) as a **Q8 GGUF** on the AMD Instinct **MI50 32GB** (`tour`, gfx906, ROCm 5.7, torch 2.3.1), served by ComfyUI behind a thin FastAPI throughput endpoint: **image + prompt in → edited PNG out**. ## Layout on `tour` ``` /media/tour/APPS/comfyui/ venv/ torch 2.3.1+rocm5.7 + ComfyUI deps ComfyUI/ backend + ComfyUI-GGUF custom node models/unet/Qwen-Rapid-NSFW-v23_Q8_0.gguf (21.8 GB) models/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors (9.4 GB) models/vae/qwen_image_vae.safetensors (0.25 GB) api/ edit_api.py + workflow + scripts ``` ## Run ```bash # 1) backend (terminal 1) /media/tour/APPS/comfyui/api/run_comfyui.sh # 2) API (terminal 2) /media/tour/APPS/comfyui/api/start_api.sh ``` ## Use ```bash curl -s -X POST http://192.168.1.160:8500/edit \ -F image=@car.png \ -F 'prompt=put the car on a beach at sunset' \ -F seed=-1 -F steps=4 \ -o out.png ``` Form fields: `prompt` (required), `seed` (-1 = random), `steps` (4), `cfg` (1.0), `sampler_name` (euler_ancestral), `scheduler` (beta), `max_area` (px, 0 = server default ~1MP). Response headers expose `X-Seed`, `X-Width`, `X-Height`. Settings match Phr00t's v23 recommendation: **euler_ancestral / beta, 4 steps, CFG 1**. Output size tracks the input aspect ratio, scaled to `MAX_AREA`. ## Performance (MI50, gfx906, 4 steps) Compute-bound — the 20.8GB unet stays resident; only the text encoder swaps. | Output budget | Latency | |---------------|---------| | 0.59 MP | ~110 s | | 0.79 MP (default) | ~140 s | | 1.0 MP | ~180 s | ## Gotchas (why it's built this way) - **ComfyUI pinned to `v0.3.77`.** `master` imports `comfy_kitchen`, which needs `torch.library.custom_op` (torch ≥ 2.4). gfx906/ROCm-5.7 tops out at the proven `torch 2.3.1+rocm5.7`, so newer ComfyUI won't import. v0.3.77 is the newest tag that still has `TextEncodeQwenImageEditPlus` without that dependency. - **`--use-split-cross-attention`** (in `run_comfyui.sh`) is required: the default pytorch attention path OOMs a 20B edit model on 32GB. Split attention chunks the attention matmul so it fits. - The audio custom-node import errors in the ComfyUI log (`libcudart.so.13`) are harmless — a CUDA `torchaudio` got pulled in; image editing doesn't use it. ## Manage (local machine) From this machine, use the `deploy_api.sh` script: ```bash cd tour-comfy ./deploy_api.sh deploy tour # sync files and (re)start services ./deploy_api.sh stop tour # stop and disable services ./deploy_api.sh status tour # check service status and logs ``` ## Manage (on `tour`) ```bash sudo bash /media/tour/APPS/comfyui/api/deploy.sh # (re)install and start services sudo bash /media/tour/APPS/comfyui/api/stop.sh # stop and disable services ``` ### Logs ```bash journalctl -u comfyui-backend -f journalctl -u comfyui-api -f ```