Instructions to use RASHID778/king2-image with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use RASHID778/king2-image with Diffusers:
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] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
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 β SDXL LoRA
A Stable Diffusion XL LoRA (rank 16) fine-tuned for majestic, high-quality text-to-image generation with a distinctive aesthetic.
π 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.
| 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).
Hyperparameters
| Parameter | Value |
|---|---|
| Base Model | stabilityai/stable-diffusion-xl-base-1.0 |
| VAE | madebyollin/sdxl-vae-fp16-fix |
| LoRA Rank (r) | 16 |
| LoRA Alpha | 16 |
| Resolution | 768 Γ 768 |
| Optimizer | AdamW (8-bit) |
| Learning Rate | 1e-4 |
| LR Scheduler | Cosine |
| Training Steps | 1,500 |
| Batch Size | 1 (per device) |
| Gradient Accumulation | 4 |
| Mixed Precision | fp16 |
| Checkpoints Saved | Every 500 steps (checkpoint-500, checkpoint-1000, checkpoint-1500) |
Checkpoints
| Checkpoint | Steps | Description |
|---|---|---|
checkpoint-500 |
500 | Early snapshot β good for broad compositional styles |
checkpoint-1000 |
1,000 | Mid-training β balanced detail and coherence |
checkpoint-1500 |
1,500 (final) | Fully trained β recommended for best results |
π¦ 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
Images generated with KING2-IMAGE using prompts from the example tables 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.pyscript. - All checkpoints use
.safetensorsformat 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
- Stability AI for the SDXL base model
- @jackyhate for the text-to-image-2M dataset
- @madebyollin for the fp16 VAE fix
- Hugging Face for the Diffusers library and model hosting
- fal-ai for the inference provider integration
π¬ Contact & Community
- Author: RASHID778
- GitHub: MOT1209
- Report Issues: Community Tab
Made with π by RASHID778
Part of the KING2 AI Series β Royal Intelligence
- Downloads last month
- 14
Model tree for RASHID778/king2-image
Base model
stabilityai/stable-diffusion-xl-base-1.0