CoRe^2: Collect, Reflect and Refine to Generate Better and Faster
Authors:
Shitong Shao, Zikai Zhou, Dian Xie, Yuetong Fang, Tian Ye, Lichen Bai and Zeke Xie*
xLeaf Lab, HKUST (GZ)
*: Corresponding author
-
Release the inference code of SD3.5 and SDXL.
-
Release noise model's weights.
-
Deploy the huggingface space demo.
-
Release the inference code of FLUX.
-
Release the inference code of LlamaGen.
-
Release the implementation of the Collect phase.
-
Release the implementation of the Reflect phase.
This guide provides instructions on how to use the CoRe^2.
Here we provide the inference code which supports different models like Stable Diffusion XL, Stable Diffusion 3.5 Large.
pip install -r requirements.txt
First, run:
huggingface-cli download sst12345/CoRe2 weights/sd35_noise_model.pth weights/sdxl_noise_model.pth --local-dir ./
To use the CoRe^2 pipeline, you need to run the sample_img.py
script with appropriate command-line arguments. Below are the available options:
--pipeline
: Select the model pipeline (sdxl
,sd35
). Default issdxl
.--prompt
: The textual prompt based on which the image will be generated. Default is "Mickey Mouse painting by Frank Frazetta."--inference-step
: Number of inference steps for the diffusion process. Default is 50.--cfg
: Classifier-free guidance scale. Default is 5.5.--pretrained-path
: Path to the pretrained model weights. Default is a specified path in the script.--size
: The size (height and width) of the generated image. Default is 1024.--method
: Select the inference method (standard
,core
,zigzag
,z-core
)--w2s-guidance
: Weak-to-strong guidance.--end_timesteps
: How many timesteps do weak-to-strong guidance.
Run the script from the command line by navigating to the directory containing sample_img.py
and executing:
python sample_img.py \
--pipeline sd35 \
--cfg 3.5 \
--w2s-guidance 1.5 \
--prompt "A stunningly beautiful young woman, 25 years old, porcelain skin with soft freckles, luminous hazel eyes with long lashes, flowing chestnut hair with golden highlights, wearing an ethereal white chiffon dress adorned with floral embroidery, standing in a sunlit meadow surrounded by blooming peonies and floating cherry blossom petals, soft bokeh background, golden hour lighting, hyper-detailed facial features, gentle smile, cinematic composition, 8k resolution, realism, artstation trending, Unreal Engine 5 render" \
--size 1024 \
--inference-step 28
--end_timesteps 28
This command will generate an image based on the prompt using the Stable Diffusion XL model with an image size of 1024x1024 pixels.
The script will save one image.
SD3.5-Standard^2:
SDXL-CoRe^2: