TiPAI-TSPO (Tournament-based Safety Policy Optimization) is a high-performance inference pipeline designed to audit and "steer" text-to-image generation toward safety. It detects adversarial violations (nudity, violence, etc.) mid-generation and uses a tournament-based selection process to inpaint and reinsert safe content without destroying the image trajectory.
Standard DDIM/DDPM reinsertion often fails on Flow-Matching architectures (FLUX.1 / SD 3.5), resulting in incomprehensible noise. This pipeline implements a Linear Flow Interpolation Bridge:
Environment:
# Create and activate venv
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Authentication:
Create a .env file in the root directory:
HF_TOKEN=your_huggingface_token_here
Configuration:
Edit tipai/config.yaml to select your base model and audit schedule.
python3 tipai/run.py --prompt "a cinematic photo of a neon sign" --config tipai/config.yaml
Outputs are saved in the results/ directory:
*_safe.png: The final audited/intervened image.tournament_results/: Visual diagnostic grids showing the candidate selection process.1 commits
Python
96.8%
Shell
3.2%
TiPAI-TSPO (Tournament-based Safety Policy Optimization) is a high-performance inference pipeline designed to audit and "steer" text-to-image generation toward safety. It detects adversarial violations (nudity, violence, etc.) mid-generation and uses a tournament-based selection process to inpaint and reinsert safe content without destroying the image trajectory.
Standard DDIM/DDPM reinsertion often fails on Flow-Matching architectures (FLUX.1 / SD 3.5), resulting in incomprehensible noise. This pipeline implements a Linear Flow Interpolation Bridge:
Environment:
# Create and activate venv
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Authentication:
Create a .env file in the root directory:
HF_TOKEN=your_huggingface_token_here
Configuration:
Edit tipai/config.yaml to select your base model and audit schedule.
python3 tipai/run.py --prompt "a cinematic photo of a neon sign" --config tipai/config.yaml
Outputs are saved in the results/ directory:
*_safe.png: The final audited/intervened image.tournament_results/: Visual diagnostic grids showing the candidate selection process.1 commits
Python
96.8%
Shell
3.2%