Training an image-model LoRA on a rented GPU, step by step
I wanted an image model to learn my own visual style so I could use it inside a generative artwork. The way to do that is a LoRA: a small add-on file, about 170MB in my case, that nudges a huge model towards a particular look. You train it on a handful of example images, each with a short caption.
Training needs a powerful NVIDIA graphics card. Rather than buy one, I rented one by the hour from Runpod for an afternoon. The whole run cost $3.37. This is how it went, from setting up SSH to deleting the machine.
Pick the right model first
A LoRA only works with the model family it was trained on. I'd already trained one on SDXL, but my artwork runs on Flux Schnell, and the two are built differently. The SDXL file would have loaded and done nothing. So I started again, on Flux Schnell.
What you need
- 20 to 30 example images in your style, each with a one-line caption
- A Runpod account with a few dollars of credit
- A terminal (Mac, Linux, or Windows with OpenSSH)
- A Hugging Face account with a read-only access token. Flux Schnell is "gated", which means you have to accept its licence on the model page before you can download it
1. Prepare the images and captions
I used 26 of my own renders. Each image has a text file with the same name, holding a one-line description that starts with a made-up trigger word, here dawes:
dawes, 3D render of a dense tangled mass of glossy ribbons and hair-like strands,
olive yellow, dark green and brown, on a pale blue-grey gradient background
Captions describe what's in the picture, not the style. The style is what the model is meant to learn.
2. Set up SSH, once
SSH is how your own computer talks to the rented one. It gives you a command line on the machine and lets you copy files back and forth. You set it up once and reuse it for every machine you rent.
An SSH key pair is two files: a private key that never leaves your computer, and a public key that you hand to Runpod.
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_runpod -C "runpod"
Then print the public key and copy the whole line, which starts with ssh-ed25519:
cat ~/.ssh/id_ed25519_runpod.pub
In the Runpod console, open the Credentials page, select the SSH Public Keys tab, click Add SSH Key, paste the key, give it a name and save.
Every key on your account is added to every pod you rent, including ones that are already running.
Doing it from code instead? When you create a pod through the API you can pass your public key as an environment variable called
PUBLIC_KEY. That's what I did, and it meant nothing had to be saved on my account.
3. Check stock and rent the GPU
I looked at what was in stock, then tried to rent. My first two choices, an L40S at $1.09 an hour and an RTX A6000 at $0.69, had both been taken in the few seconds between checking and renting. That happens a lot, so have a second and third choice ready.
The third try worked: an A100 with 80GB of memory, at $2.19 an hour, on Runpod's Secure Cloud. I used one of Runpod's official PyTorch templates, which already run an SSH service, so there was nothing to install. I added a 50GB container disk and a 100GB persistent volume mounted at /workspace, because the base model alone is tens of gigabytes. For file copying, the pod needs a public address and port 22 exposed, which the official templates provide.
4. Find the connection command and connect
Open the Pods page, select your pod, and open its Connect tab. There are two ways in:
- SSH gives you a command line through Runpod's proxy, with no file copying. It's good for quick access to any pod.
- SSH over exposed TCP gives you a full SSH connection, including
scpandsftp. Use it for copying files and long jobs.
A pod can say "running" before its connection address shows up. Give it about a minute. The address and port are different for every pod, and they change if you stop and restart it.
Paste the command, adding -i to point at your key if it isn't the default name:
ssh root@<POD_IP> -p <PORT> -i ~/.ssh/id_ed25519_runpod
The first time, SSH asks whether you trust the new machine. Type yes. You land at a prompt as root on the pod.
5. Upload and install
Copy the images up. Note the capital -P for the port, where plain ssh uses a lowercase -p:
scp -i ~/.ssh/id_ed25519_runpod -P <PORT> -r ./dataset root@<POD_IP>:/workspace/
I used ai-toolkit, a free training tool. On the pod:
git clone https://github.com/ostris/ai-toolkit.git
cd ai-toolkit && python3 -m venv venv && . venv/bin/activate
pip3 install -r requirements.txt
Install the matching PyTorch build first, using the exact versions in the project's README, because they change quickly. The whole install took about ten minutes.
6. The settings
The tool reads one configuration file. The settings that matter, in plain English:
steps(2000): how long to train. I planned for 2000 and stopped earlier.linear/linear_alpha(16 / 16): how big and detailed the LoRA is. Higher means larger and more expressive.lr(1e-4): how fast it learns. Too high and it overshoots.resolution(512, 768, 1024): image sizes to train on. Mixing sizes helps.quantize(true): runs the base model at lower precision, to save memory.assistant_lora_path(the Schnell training adapter): needed to train on Schnell, which is a speed-tuned model.save_every/sample_every(250): save a checkpoint and make test images every 250 steps.trigger_word(dawes): the word that goes at the start of each caption.
The last two matter most. Saving a checkpoint every 250 steps is what let me pick the best moment afterwards.
7. Start the training
The base model is gated, so the pod needs your Hugging Face token. I sent it over SSH into a file only I could read, instead of putting it on a command line where other users on the machine could see it:
cat ~/.huggingface/token | ssh -i ~/.ssh/id_ed25519_runpod -p <PORT> root@<POD_IP> 'umask 077; cat > /root/.hf_token'
Then start the run detached. A job started in your SSH session stops when the session ends, so send its output to a log file and let it run in the background:
export HF_TOKEN=$(cat /root/.hf_token)
setsid nohup python run.py /workspace/my_lora.yaml > /workspace/train.log 2>&1 < /dev/null &
You can disconnect and check on it later:
tail -f /workspace/train.log
It first downloaded the base model, about five minutes, then ran at roughly two seconds per step.
8. Watch it learn
Every 250 steps the tool makes three test images from fixed prompts, so you can compare them like a flip book. Here's the same prompt, "a dense tangled mass of glossy ribbons", across the run:

- Step 0. Plain Flux makes thin, flat ribbons.
- Step 250. Almost no change. That's normal for this early on.
- Step 500. The ribbons thicken and start to twist like rope.
- Step 1000. The look is firmly in: a dense mass of glossy, curling, hair-like strands.
- Step 1500. Overtrained. The style is the same, but the model has stopped listening to the prompt. On other test prompts it turned a "glossy form with hair-like strands" into one smooth pink lump with the hair gone.
Here's a different prompt, a folded cream form, across the same steps:

The style was in by about step 1000, and everything after that mostly made things worse. I stopped the run at about step 1880.
9. Copy it home and delete the machine
The checkpoints were 172MB each. I copied them down and checked the sizes matched:
scp -i ~/.ssh/id_ed25519_runpod -P <PORT> "root@<POD_IP>:/workspace/output/my_lora/*.safetensors" ./checkpoints/
Then I terminated the pod from the Runpod console and checked the pod list was empty. A running pod bills by the hour whether you use it or not. A stopped pod keeps its disk and still bills a small storage fee, and a terminated pod is gone and bills nothing. Deleting wipes the disk, so copy everything off first.
10. Try it for real
I put the step-1000 file into my image tool's LoRA folder and wired it into my artwork's network as one more style layer. The same seed, with the LoRA off and then at increasing strengths:

What it cost
- Rent, upload and install: about 15 minutes
- Download the base model: about 5 minutes
- Training: about an hour, stopped at about step 1880
- Copy back and delete: a few minutes
- Total rental: about an hour and a half, $3.37
Summary
- Pick the right model first. A LoRA is tied to the model family it was trained on.
- GPU stock disappears. Have a second choice ready.
- Check the model's licence before you rent, so the download doesn't stop you.
- More training isn't better. Watch the test images and stop when the style is in.
- Save a checkpoint often. The best one is rarely the last.
- The connection address changes. Re-copy the command from the Connect tab whenever you stop and restart a pod.
- Don't put secrets on the command line. Other users on the machine can see command lines.
- Careful with
pkill -f. It matches on text and can match your own SSH command. Mine ended my own session. - Delete the pod when you're done, after you've copied everything off.


