How to use from the
Use from the
Diffusers library
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", dtype=torch.bfloat16, device_map="cuda")
pipe.load_lora_weights("RASHID778/king2-image")

prompt = "a futuristic royal palace at sunset, highly detailed, 8k, golden hour, epic composition"
image = pipe(prompt).images[0]

KING2 Image Banner

πŸ‘‘ KING2-IMAGE β€” SDXL LoRA

A Stable Diffusion XL LoRA (rank 16) fine-tuned for majestic, high-quality text-to-image generation with a distinctive aesthetic.

Hugging Face Spaces License KING2 Series


πŸ“‹ Overview

KING2-IMAGE is a Stable Diffusion XL LoRA adapter (rank 16) trained on a 3,000-image subset of the jackyhate/text-to-image-2M dataset. It is designed to produce visually striking, detailed, and aesthetically refined images β€” from majestic royal scenes and cinematic landscapes to fantasy art and photorealistic portraits.

Built as part of the KING2 AI ecosystem, this model inherits the "royal" essence of the KING2 brand, excelling at generating images with grandeur, rich color palettes, and epic compositions.

πŸ”„ v2 continuation (2026-09-20): the adapter was further fine-tuned with +2,000 steps on the RASHID778/king2-image-dataset (19,998 indoor/outdoor scene photos) at 512Γ—512, using a stability guard (loss cap 100, prediction cap 1000, AdamW eps 1e-6) that eliminated a NaN/divergence failure seen in earlier runs. The current pytorch_lora_weights.safetensors (root) is the continued weights; intermediate checkpoint-continue-* snapshots are available below.

Property Value
Base Model stabilityai/stable-diffusion-xl-base-1.0
VAE (training) madebyollin/sdxl-vae-fp16-fix
LoRA Rank 16
Resolution 768Γ—768
Training Steps 1,500
Precision fp16
Library 🧨 Diffusers
License OpenRAIL++

✨ Features

  • 🎨 Refined Aesthetic β€” Fine-tuned on high-quality synthetic image-text pairs emphasizing composition and visual appeal.
  • πŸ‘‘ Royal & Majestic Style β€” Excels at grand, epic, and regal image generation β€” palaces, knights, kings, fantasy worlds.
  • 🌍 Bilingual Prompt Support β€” Works with both English and Arabic prompts (Arabic prompts may require transliteration or English for best results).
  • ⚑ Lightweight Adapter β€” Only ~93 MB LoRA weights; combines with the base SDXL model for a total footprint manageable on consumer GPUs.
  • πŸ•΄οΈ Stickman Adapter Included β€” A second LoRA in stickman/ for stick-figure pose illustrations (see below).
  • πŸ”„ Diffusers Native β€” Drop-in compatible with the Hugging Face Diffusers ecosystem; easy to integrate into existing pipelines.

πŸ‹οΈ Training Details

Dataset

Property Detail
Source jackyhate/text-to-image-2M
Subset Size 3,000 images (sampled from the dataset stream)
Resolution 768Γ—768 (center-cropped)
Format Image-Text pairs

The training used a 3,000 image-text pair sample from the text-to-image-2M dataset β€” a large collection of high-quality synthetic images with descriptive captions covering diverse scenes (nature, architecture, fantasy, portraits, landscapes).

Two-stage training: the adapter was fine-tuned in two stages β€” the original run (below) and a v2 continuation on a real-world indoor/outdoor photo dataset. Final weights = both stages combined.

Stage 1 β€” Original Fine-Tune

Parameter Value
Dataset 3,000-image subset of jackyhate/text-to-image-2M
Resolution 768 Γ— 768
Optimizer AdamW (8-bit)
Learning Rate 1e-4
Training Steps 1,500

Stage 2 β€” v2 Continuation (2026-09-20)

Parameter Value
Dataset RASHID778/king2-image-dataset (19,998 indoor/outdoor scene photos β€” 9,999 each)
Resolution 512 Γ— 512
Optimizer AdamW, eps 1e-6
Learning Rate 1e-4 (100-step warmup)
Training Steps +2,000 (checkpoint every 500)
Gradient Accumulation 4
Stability Guard skip micro-batch if loss > 100 or pred.max > 1000 (fixes fp16 divergence)
Mixed Precision fp16
Total Steps (adapted) 3,500

Checkpoints

Checkpoint Steps Description
checkpoint-500 / 1000 / 1500 500 / 1,000 / 1,500 Original-stage snapshots
checkpoint-continue-500 1,500 β†’ 2,000 First v2 continuation snapshot
checkpoint-continue-1000 β†’ 2,500 Mid-continuation
checkpoint-continue-1500 β†’ 3,000 Late-continuation
checkpoint-continue-2000 β†’ 3,500 (final) Last continuation step β€” recommended
pytorch_lora_weights.safetensors (root) 3,500 Current weights (the v2-continued adapter)

πŸ“¦ Installation

Requirements

  • Python β‰₯ 3.10
  • PyTorch β‰₯ 2.0.0
  • CUDA-compatible GPU with β‰₯ 8 GB VRAM (recommended)
  • Hugging Face Diffusers, Transformers, Accelerate

Setup

# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # Linux/macOS
# .\venv\Scripts\activate   # Windows

# Install dependencies
pip install -U diffusers transformers accelerate torch safetensors

πŸš€ Usage

Basic Inference

import torch
from diffusers import DiffusionPipeline, AutoencoderKL

# Optional but recommended: the fp16-safe VAE used during training
vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
    torch_dtype=torch.float16,
)

# Load the base SDXL pipeline
pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    torch_dtype=torch.float16,
    variant="fp16",
    use_safetensors=True,
)
pipe.to("cuda")

# Load the KING2-IMAGE LoRA adapter
pipe.load_lora_weights("RASHID778/king2-image")

# Generate
prompt = "a futuristic royal palace at sunset, highly detailed, 8k, golden hour"
image = pipe(
    prompt,
    num_inference_steps=30,
    guidance_scale=7.5,
    height=768,
    width=768,
    negative_prompt="blurry, low quality, distorted, ugly, bad anatomy, watermark, text",
).images[0]

image.save("king2_output.png")

LoRA Weight Configuration

You can adjust the LoRA influence scale for finer control:

pipe.load_lora_weights("RASHID778/king2-image", adapter_name="king2")
pipe.set_adapters(["king2"], adapter_weights=[0.85])  # scale from 0.0 to 1.0

πŸ•΄οΈ Stickman Adapter

The repo also ships a second LoRA adapter at stickman/pytorch_lora_weights.safetensors β€” a style/pose adapter that makes SDXL draw stick-figure illustrations across a wide range of human poses and actions (run, jump, kick, sit, climb, dance…).

Trained on 10,000 curated 1024Γ—1024 stick-figure frames derived from HumanML3D motion sequences (quality-scored, de-duplicated, captioned from the official HumanML3D texts).

pipe.load_lora_weights(
    "RASHID778/king2-image",
    weight_name="stickman/pytorch_lora_weights.safetensors",
    adapter_name="stickman",
)

image = pipe(
    "a stickman doing a backflip, simple black and white stick figure line drawing",
    num_inference_steps=30,
    guidance_scale=7.0,
).images[0]

Prompting tips:

  • Keep the trigger phrasing seen in training: …, simple black and white stick figure line drawing.
  • Best at single-figure body poses/actions; multi-figure scenes are out of distribution.
  • LoRA scale 0.8–1.0 (lower toward 0.6 if the pose collapses), guidance 6–8, 25–35 steps.
  • Style is fixed: thick-stroke skeleton on white background β€” no head circle, colors, props, or backgrounds.

⚠️ The stickman adapter's training data derives from HumanML3D (AMASS/HumanAct12). Treat it as research use; review upstream licensing before commercial deployment.


Inference Providers (Zero Setup)

You can run the LoRA without any local GPU via fal.ai:

# pip install fal-client  (and set FAL_KEY)
import fal_client

result = fal_client.subscribe(
    "fal-ai/lora",
    arguments={
        "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
        "loras": [{
            "path": "https://huggingface.co/RASHID778/king2-image/resolve/main/pytorch_lora_weights.safetensors",
            "scale": 0.85,
        }],
        "prompt": "cosmic king on a throne of stars, nebula background, majestic, epic fantasy",
        "negative_prompt": "blurry, low quality",
        "image_size": "square",
        "guidance_scale": 7.5,
        "num_inference_steps": 30,
    },
)
print(result["images"][0]["url"])

You can also use the Inference Providers widget on this model page (powered by fal-ai) with zero setup.


🎯 Example Prompts

Here are some prompts that work exceptionally well with KING2-IMAGE:

Royal & Majestic

Prompt Style
a futuristic royal palace at sunset, highly detailed, 8k, golden hour, epic composition Cinematic / Epic
majestic arabian knight on horseback, desert landscape, cinematic lighting, photorealistic, 4k Photorealistic
cosmic king on a throne of stars, nebula background, majestic, epic fantasy, concept art Fantasy Art
ancient king with golden crown, ornate throne room, dramatic lighting, oil painting style Classical Art

Fantasy & Mystical

Prompt Style
ancient library with floating books, mystical atmosphere, volumetric lighting, detailed illustration Illustrative
enchanted forest with glowing crystals, magical blue and purple hues, fantasy landscape, detailed Fantasy
dragon coiled around a crystal tower, stormy sky, epic scale, cinematic, 8k Epic Fantasy

Architecture & Scenery

Prompt Style
grand mosque at night, illuminated, reflective pool, stars, ultra detailed, architectural photography Architectural
oriental garden with water fountain, blooming flowers, warm sunlight, peaceful, highly detailed Scenic
massive marble palace with golden domes, symmetrical composition, bright blue sky, majestic Symmetrical

Arabic / Middle Eastern Themes

Prompt Style
arabian fortress at dawn, sandstorm clearing, golden light, cinematic wide shot Cinematic
traditional arabian market alley, lanterns, warm colors, detailed architecture, bustling Detailed

πŸ–ΌοΈ Example Images

Validation 1 β€” Futuristic royal palace at sunset Validation 2 β€” Majestic arabian knight on horseback

Validation 3 β€” Ancient library with floating books Validation 4 β€” Cosmic king on a throne of stars

Images generated with KING2-IMAGE from the **final v2-continued weights** (pytorch_lora_weights.safetensors, 2026-09-20) using the prompts above.


⚠️ Limitations

  • Resolution Constraint β€” Trained at 768Γ—768. Higher resolutions (>1024) may produce artifacts or quality degradation.
  • Synthetic Training Data β€” The training subset consists of AI-generated images, so the adapter inherits the visual style (and any artifacts) of the generator used to build the source dataset.
  • Domain Specificity β€” Fine-tuned primarily for majestic, royal, and fantasy aesthetics. May not perform optimally on unrelated domains (e.g., modern tech, medical imagery, abstract minimalism).
  • Bias & Representation β€” As with all generative models trained on web-scale data, the model may reflect biases present in the training dataset. Use responsibly and critically evaluate outputs.
  • Arabic Prompts β€” The model was trained primarily on English captions. Arabic prompts may produce less reliable results; transliteration to English is recommended.
  • Not a Checkpoint β€” This is a LoRA adapter only. The base SDXL model must be loaded separately (requires ~12 GB VRAM for full pipeline).
  • Safety β€” The model has not been fine-tuned for safety filtering. Always use appropriate NSFW/content filters in production deployments.

πŸ”¬ Technical Notes

  • The adapter was trained using the Diffusers train_text_to_image_lora_sdxl.py script.
  • All checkpoints use .safetensors format for secure and fast loading.
  • Xet storage is used on Hugging Face for efficient large-file hosting.
  • Available for live inference via the fal-ai Inference Provider on Hugging Face.

πŸ“œ License

This model is released under the OpenRAIL++ license (inherited from stabilityai/stable-diffusion-xl-base-1.0), which permits:

  • βœ… Use β€” Free to use for both research and commercial purposes
  • βœ… Modification β€” You may fine-tune, adapt, or modify the weights
  • βœ… Distribution β€” You may share the weights and derivatives

Conditions:

  • ❗ You must not use the model to generate illegal or harmful content
  • ❗ You must include the same license when redistributing
  • ❗ You must not use the model to violate any applicable laws

Note: the stickman adapter has additional upstream data considerations β€” see the Stickman Adapter section above.


πŸ›οΈ KING2 Ecosystem

KING2-IMAGE is part of the KING2 AI Series:

Model Type Description
king2-qwen2.5-3b LLM (LoRA) Arabic conversational AI assistant with royal persona
king2-image SDXL LoRA Text-to-image generation with majestic aesthetic
king2-image β†’ stickman/ SDXL LoRA Stick-figure pose illustration adapter
KING2 Space Demo Try the KING2 experience live

πŸ™ Acknowledgements


πŸ“¬ Contact & Community


Made with πŸ‘‘ by RASHID778
Part of the KING2 AI Series β€” Royal Intelligence

Downloads last month
137
Inference Providers NEW
Examples

Model tree for RASHID778/king2-image

Adapter
(9724)
this model

Dataset used to train RASHID778/king2-image