OmniConsistency: Learning Style-Agnostic
Consistency from Paired Stylization Data
Yiren Song ,
Cheng Liu ,
and
Mike Zheng Shou
Show Lab , National University of Singapore
We recommend using Python 3.10 and PyTorch with CUDA support. To set up the environment:
1 # Create a new conda environment
2 conda create -n omniconsistency python = 3.10
3 conda activate omniconsistency
4
5 # Install other dependencies
6 pip install -r requirements.txt
You can download the OmniConsistency model and trained LoRAs directly from
Hugging Face .
Or download using Python script:
1 from huggingface_hub import hf_hub_download
2 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/3D_Chibi_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
3 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/American_Cartoon_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
4 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Chinese_Ink_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
5 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Clay_Toy_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
6 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Fabric_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
7 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Ghibli_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
8 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Irasutoya_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
9 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Jojo_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
10 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/LEGO_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
11 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Line_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
12 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Macaron_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
13 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Oil_Painting_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
14 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Origami_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
15 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Paper_Cutting_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
16 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Picasso_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
17 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Pixel_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
18 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Poly_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
19 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Pop_Art_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
20 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Rick_Morty_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
21 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Snoopy_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
22 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Van_Gogh_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
23 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "LoRAs/Vector_rank128_bf16.safetensors" , local_dir = "./LoRAs" )
1 from huggingface_hub import hf_hub_download
2 hf_hub_download ( repo_id = "showlab/OmniConsistency" , filename = "OmniConsistency.safetensors" , local_dir = "./Model" )
1 import time
2 import torch
3 from PIL import Image
4 from src_inference . pipeline import FluxPipeline
5 from src_inference . lora_helper import set_single_lora
6
7 def clear_cache ( transformer ) :
8 for name , attn_processor in transformer . attn_processors . items ( ) :
9 attn_processor . bank_kv . clear ( )
10
11 # Initialize model
12 device = "cuda"
13 base_path = "/path/to/black-forest-labs/FLUX.1-dev"
14 pipe = FluxPipeline . from_pretrained ( base_path , torch_dtype = torch . bfloat16 ) . to ( "cuda" )
15
16 # Load OmniConsistency model
17 set_single_lora ( pipe . transformer ,
18 "/path/to/OmniConsistency.safetensors" ,
19 lora_weights = [ 1 ] , cond_size = 512 )
20
21 # Load external LoRA
22 pipe . unload_lora_weights ( )
23 pipe . load_lora_weights ( "/path/to/lora_folder" ,
24 weight_name = "lora_name.safetensors" )
1 image_path1 = "figure/test.png"
2 prompt = "3D Chibi style, Three individuals standing together in the office."
3
4 subject_images = [ ]
5 spatial_image = [ Image . open ( image_path1 ) . convert ( "RGB" ) ]
6
7 width , height = 1024 , 1024
8
9 start_time = time . time ( )
10
11 image = pipe (
12 prompt ,
13 height = height ,
14 width = width ,
15 guidance_scale = 3.5 ,
16 num_inference_steps = 25 ,
17 max_sequence_length = 512 ,
18 generator = torch . Generator ( "cpu" ) . manual_seed ( 5 ) ,
19 spatial_images = spatial_image ,
20 subject_images = subject_images ,
21 cond_size = 512 ,
22 ) . images [ 0 ]
23
24 end_time = time . time ( )
25 elapsed_time = end_time - start_time
26 print ( f"code running time: { elapsed_time } s" )
27
28 # Clear cache after generation
29 clear_cache ( pipe . transformer )
30
31 image . save ( "results/output.png" )
Our datasets have been uploaded to the
Hugging Face . and is available for direct use via the datasets library.
1 from datasets import load_dataset
2
3 # Load a single style (e.g., Ghibli)
4 ds = load_dataset ( "showlab/OmniConsistency" , split = "Ghibli" )
5 print ( ds [ 0 ] )
@inproceedings{Song2025OmniConsistencyLS,
title={OmniConsistency: Learning Style-Agnostic Consistency from Paired Stylization Data},
author={Yiren Song and Cheng Liu and Mike Zheng Shou},
year={2025},
url={https://api.semanticscholar.org/CorpusID:278905729}
}