Skip to content

Case Studies · Generative AI · · Updated

Kiffusion and SpaceVision: a FLUX LoRA training dataset and space LoRAs

By Khadim Hussain · 7 min read

In short

Kiffusion is a FLUX LoRA training dataset of 1,964 space and sci-fi image-caption pairs from NASA, Wallhaven and LAION-Aesthetics. Every image was auto-captioned with JoyCaption Beta One, and the captions average about 1,090 characters, each starting with the trigger word spacevision. SpaceVision is the pair of LoRA adapters I trained on it with SimpleTuner: a 38 MB adapter for FLUX.2-klein (9B), trained on an int8-quantized base, and a 46.6 MB adapter for Kolors. As of 27 October 2026 the dataset has 3,635 downloads on Hugging Face, against 223 for the FLUX.2 adapter and 82 for the Kolors one.

3.6k+

downloads

1,964

image pairs

9B

base model

  • PyTorch
  • FLUX.2
  • Kolors
  • LoRA
  • SimpleTuner
  • Diffusers
  • JoyCaption
  • optimum-quanto
  • Hugging Face
Space images generated with the SpaceVision LoRA
Contents

Kiffusion is a FLUX LoRA training dataset I built from scratch: 1,964 space and sci-fi images from NASA, Wallhaven and LAION-Aesthetics, each auto-captioned with JoyCaption. SpaceVision is the pair of LoRA adapters I trained on it, one for FLUX.2-klein (9B) and one for Kolors. The dataset, both adapters and the pipeline code are public, and the dataset has turned out to be the part people use.

Why do captions matter in a FLUX LoRA training dataset?

A LoRA learns a style from image-caption pairs, so the captions matter as much as the images. Every image here was captioned automatically with JoyCaption, so the captions describe composition and lighting in the detail a diffusion model needs, instead of relying on short alt text. Each caption also starts with one trigger word, spacevision, which lets the adapter switch the style on.

Where did the 1,964 images come from?

SourceImagesWhat it adds
NASA Images API915Public-domain space photography: nebulae, galaxies, spacecraft, astronauts, planets
Wallhaven API845Sci-fi and space digital art, concept art and wallpapers, all 1920 px or wider
LAION-2B-en-aesthetic204Web images matching space and sci-fi keywords with an aesthetic score of 6.0 or more

Wallhaven was the cleanest source and LAION the noisiest: 73% of the LAION downloads were under 512 px. I collected 2,426 images in total, and a quality pass dropped images under 512 px, corrupt files and placeholders under 10 KB. It also converted 108 grayscale, 133 RGBA and 4 palette images to RGB, compositing transparent images onto white. That left 2,144.

Three curation rounds then removed off-topic images by filtering their captions. A blacklist of terms flagged press events, buildings and portraits (46 images), then off-topic LAION results such as strawberries, swimming pools and red carpets (85), then merchandise, promotional shots, domestic scenes, text and UI images and generic shots (49). A whitelist overrode the blacklist for any caption that still mentioned space or sci-fi terms. That left 1,964.

How does the JoyCaption auto captioning work?

The captioner is JoyCaption Beta One, a LLaVA-based model that needs about 17 GB of VRAM, or about 10 GB in 8-bit. It samples at temperature 0.6 and top-p 0.9, with up to 384 new tokens per caption.

The first overnight run failed on all 2,426 images. JoyCaption takes 384 × 384 input, and its processor resizes with torchvision's lanczos mode, which fails on tensors: Only 3D, 4D and 5D input Tensors supported ... (got lanczos). The fix was to resize and crop each image with PIL before the processor sees it:

from PIL import Image
 
def preprocess_image_for_joycaption(image: Image.Image, target_size: int = 384) -> Image.Image:
    """Pre-resize image to avoid torchvision lanczos interpolation issues."""
    width, height = image.size
    scale = target_size / min(width, height)
    image = image.resize((int(width * scale), int(height * scale)), Image.LANCZOS)
    left = (image.width - target_size) // 2
    top = (image.height - target_size) // 2
    return image.crop((left, top, left + target_size, top + target_size))

The raw captions needed two cleanups: 91% opened with "This is…", which a regex removed, and 28% ran over several lines, which were flattened to one. Then the trigger word went in front. In the published metadata.jsonl, the captions average 1,089 characters and 171 words, and all 1,964 start with spacevision. One from the NASA subset:

spacevision, High-resolution, color photograph of a cratered asteroid captured in space. The image shows the asteroid's surface from a top-down perspective, predominantly a muted brown and gray, with numerous small and large craters scattered across it...

How were the FLUX.2-klein and Kolors LoRAs trained?

SpaceVision is the set of LoRA adapters trained on that dataset, using SimpleTuner and Diffusers, both on one RTX 5090 with 32 GB of VRAM. A LoRA trains a small set of extra weights instead of the whole model, so the adapters stay small enough to download and swap in seconds.

SettingKolorsFLUX.2-klein
Base modelKwai-Kolors/Kolors-diffusers (2.6B)black-forest-labs/FLUX.2-klein-base-9B
Base precisionbf16, unchangedint8 via optimum-quanto, quantized on the CPU
LoRA rank / alpha16 / 1616 / 16
Learning rate4e-5, cosine1e-4, cosine
Batch2, gradient accumulation 41
Epochs3 (about 690 steps)3 (5,892 steps, about 4 hours)
Othernoise offset 0.02, 10% caption dropoutflow schedule shift 3, no noise offset, 10% caption dropout
Resolution10241024
Adapter46.6 MB38 MB
Inference50 steps, guidance 3.4, about 6 GB VRAM16 steps, guidance 4.0, about 24 GB VRAM

Kolors was the fast one to iterate on, and it took four configurations. The first, at learning rate 1e-4 with a polynomial schedule, crashed with segmentation faults. The second, at 4e-5 with a constant schedule, came out too flat. The third added SNR gamma 5.0 and washed the images out. The fourth dropped SNR gamma, switched to a cosine schedule and added a small noise offset, and that is the published adapter. For inference I compared 20, 30 and 50 steps and kept 50.

FLUX.2-klein was the quality target, and in bf16 it did not fit in 32 GB. I trained it with the base weights in int8, quantizing on the CPU so the quantization step itself didn't run out of GPU memory. The adapter expects the same int8 quantization at inference. Its learning rate went up to 1e-4, and noise offset came out, since FLUX.2 trains with flow matching. Flux2KleinPipeline was only in the development version of Diffusers at the time, so inference needs Diffusers installed from Git.

The two adapters use the same rank and the same data, yet the one for the 9B model is smaller than the one for the 2.6B model. Adapter size follows the base model's architecture, not its parameter count.

The evidence for the adapters is visual. Each model card shows base and LoRA images side by side for the same prompt, and on the FLUX.2-klein card every pair uses seed 42, 16 steps, guidance 4.0 and 1024 × 1024 (the image at the top of this page comes from that card). I have not published a quantitative score such as FID.

What else went wrong along the way?

Besides the captioning crash and the four Kolors configurations:

  • Training on the RTX 5090 hit segmentation faults, and the final Kolors run finished on attempt 9 of 15 inside an automatic resume-and-retry loop.
  • upload_folder timed out on the gigabyte-scale dataset, so the upload moved to upload_large_folder.
  • Pushing each curation round to the same dataset repo would have bloated its Git history with large files, so I recreated the Hugging Face repo after each round.
  • A run on the 32B FLUX.2 [dev] was planned and never trained.

What got used?

All-time download counts from Hugging Face, read on 27 October 2026:

ArtifactTypeDownloads, all timeLast 30 days
kiffusion-space-scifiDataset3,635389
spacevision-flux2-loraLoRA for FLUX.2-klein22335
spacevision-kolors-loraLoRA for Kolors8219

The dataset is used far more than the adapters, which suggests that a well-captioned niche dataset is the more reusable artifact.

How do I use the dataset and the LoRAs?

Load the dataset with the datasets library:

from datasets import load_dataset
 
dataset = load_dataset("khadim-hussain/kiffusion-space-scifi")

The Kolors adapter loads on top of the base pipeline:

import torch
from diffusers import KolorsPipeline
 
pipe = KolorsPipeline.from_pretrained("Kwai-Kolors/Kolors-diffusers", torch_dtype=torch.float16)
pipe.load_lora_weights("khadim-hussain/spacevision-kolors-lora")
pipe = pipe.to("cuda")
 
image = pipe(
    "spacevision, nebula with swirling purple gas clouds and bright stars",
    num_inference_steps=50,
    guidance_scale=3.4,
).images[0]

The FLUX.2-klein adapter needs the transformer quantized the same way it was trained:

import torch
from diffusers import Flux2KleinPipeline
from optimum.quanto import quantize, freeze, qint8
 
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-base-9B", torch_dtype=torch.bfloat16)
quantize(pipe.transformer, weights=qint8)
freeze(pipe.transformer)
pipe.to("cuda")
pipe.load_lora_weights("khadim-hussain/spacevision-flux2-lora")
 
image = pipe(
    "spacevision, the Pillars of Creation in Eagle Nebula",
    num_inference_steps=16,
    guidance_scale=4.0,
    height=1024,
    width=1024,
).images[0]

The Kiffusion repo has the scrapers, the captioning script, both SimpleTuner configs and a script that renders base and LoRA images side by side. Check the licenses before you build on any of it. The dataset is CC-BY-NC-4.0 and its Wallhaven and LAION images keep their original licenses, so it is for non-commercial use. The FLUX.2 adapter inherits the FLUX.2 research license of its base model. The Kolors adapter is released under Apache 2.0, and Kolors itself has its own license terms.

Next

Frequently asked questions

What is in the Kiffusion dataset?

1,964 image-caption pairs: 915 NASA photographs, 845 Wallhaven digital artworks and 204 LAION-Aesthetics images. Every image is RGB and at least 512 px on one side, and every caption is a single line from JoyCaption Beta One that starts with the trigger word spacevision. It loads with load_dataset("khadim-hussain/kiffusion-space-scifi").

How do I fix the JoyCaption lanczos error?

JoyCaption's processor resizes images with torchvision's lanczos mode, which fails on tensors with "Only 3D, 4D and 5D input Tensors supported". Resize and center-crop each image to 384 x 384 with PIL's LANCZOS filter before it reaches the processor, as auto_caption.py in the Kiffusion repo does.

Can I train a FLUX.2-klein LoRA on a 32 GB GPU?

Yes, with the base model quantized to int8. FLUX.2-klein-base-9B did not fit in 32 GB in bf16, so I trained with SimpleTuner's int8-quanto option and quantized on the CPU to avoid running out of memory during quantization. Three epochs over 1,964 images took 5,892 steps and about four hours on an RTX 5090.

Which trainers can use the dataset?

The dataset uses the Hugging Face imagefolder layout, with a metadata.jsonl that holds the caption in a text field. The dataset card gives examples for Kohya sd-scripts, ai-toolkit and SimpleTuner. I trained both SpaceVision adapters with SimpleTuner.

Can I use the dataset commercially?

No. The dataset is released under CC-BY-NC-4.0, and the Wallhaven and LAION images keep their original licenses. Of the adapters, the FLUX.2 one inherits the FLUX.2 research license of its base model; the Kolors one is Apache 2.0, while Kolors itself has its own license terms.

Why is the FLUX.2 adapter smaller than the Kolors one?

Both use LoRA rank 16 on the same data, yet the adapter for the 9B FLUX.2-klein is 38 MB and the one for the 2.6B Kolors is 46.6 MB. Adapter size follows the base model's architecture, not its parameter count.

Want a second pair of eyes on this?

Book a 15-minute intro call. Bring the problem, and you leave with a concrete next step.