A Stable Diffusion 3.5-M model fine-tuned with GRPO (Generative Reinforcement Policy Optimization) method, specifically designed for generating images with precise object counting control.
This repository contains four variants of the model, each trained with different strategies:
-
Strict First (strict_first/)
- Uses strict reward function
- Timestep selection: First 50 steps
- Best for: Most accurate object counting
-
Relative First (relative_first/)
- Uses relative reward function
- Timestep selection: First 50 steps
- Best for: Balance between accuracy and image quality
-
Strict Random (strict_random/)
- Uses strict reward function
- Timestep selection: Random steps
- Best for: Diverse image generation with accurate counting
-
Relative Random (relative_random/)
- Uses relative reward function
- Timestep selection: Random steps
- Best for: Maximum diversity in generation
1from huggingface_hub import snapshot_download
2
3# Download the model locally (replace variant with one of: strict_first, relative_first, strict_random, relative_random)
4variant = "strict_first" # Choose the variant you want to use
5model_path = snapshot_download(
6 repo_id="MiaTiancai/grpo-counting-model",
7 local_dir=f"./grpo_counting_model_{variant}", # specify your local path
8 subfolder=variant # Specify which variant to download
9)
For inference, please refer to the
Flow-GRPO repository. The repository contains all necessary code and instructions for running inference with this model.