← All articles
Published July 15, 2025by halftimecoder
Creating an image using Flux and sd-scripts to test LORA in remote services
31 views0 reactions0 comments on CivitAI0 collected
trainingtool guidesd-scriptsflux

sd-scripts have two very handy utilities to create images with SD1.5 and SDXL. Their use is described here.
For FLUX, the sd3 branch only have the utility flux_minimal_inference.py. It works very well to test LORA created in remote services, without using Automatic A1111 or Comfy.
I use paperspace, so I downloaded all the models to /tmp/, to clear all space when the machine is down. The script is something like this:
#!/bin/bash
# --pretrained_model_name_or_path "/tmp/flux.safetensors" \
# --clip_l "/tmp/clip_l.safetensors" \
# --ae "/tmp/ae.safetensors" \
# --t5xxl "/tmp/fp8.safetensors" \
if [ ! -f /tmp/flux1-dev-fp8-e4m3fn.safetensors ]
then
wget -O /tmp/flux1-dev-fp8-e4m3fn.safetensors "https://huggingface.co/Kijai/flux-fp8/resolve/main/flux1-dev-fp8-e4m3fn.safetensors?download=true"
fi
if [ ! -f /tmp/flux1-schnell-fp8-e4m3fn.safetensors ]
then
wget -O /tmp/flux1-schnell-fp8-e4m3fn.safetensors / "https://huggingface.co/Kijai/flux-fp8/resolve/main/flux1-schnell-fp8-e4m3fn.safetensors?download=true"
fi
if [ ! -f /tmp/clip_l.safetensors ]
then
wget -O /tmp/clip_l.safetensors "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors?download=true"
fi
if [ ! -f /tmp/ae.safetensors ]
then
wget -O /tmp/ae.safetensors "https://huggingface.co/modelzpalace/ae.safetensors/resolve/main/ae.safetensors?download=true"
fi
if [ ! -f /tmp/t5xxl_fp8_e4m3fn.safetensors ]
then
wget -O /tmp/t5xxl_fp8_e4m3fn.safetensors "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors?download=true"
fi
The script to create the images have the following form:
#!/bin/bash
CKPT_PATH="/tmp/flux1-dev-fp8-e4m3fn.safetensors" # I used the fp8 version to train
#CKPT_PATH="/tmp/flux1-schnell-fp8-e4m3fn.safetensors"
LORA_NAME="output/LORA_NAME.safetensors" # You should replace this with your LORA filename
STEPS=20
python flux_minimal_inference.py --ckpt_path "${CKPT_PATH}" \
--clip_l /tmp/clip_l.safetensors \
--t5xxl /tmp/t5xxl_fp8_e4m3fn.safetensors \
--ae /tmp/ae.safetensors \
--t5xxl_dtype fp8 \
--seed 12345 \
--flux_dtype fp8 --offload \
--prompt "(realistic photography:1.2), portrait of a woman" \
--output_dir imgs \
--steps $STEPS --guidance 3.0 \
--lora_weights "${LORA_NAME}" \
--width 512 --height 512