Thank you for your interest in contributing! This document provides guidelines and instructions.
- Fork the repository
- Clone your fork locally
- Create a virtual environment and install the project with dev dependencies:
python -m venv .venv source .venv/bin/activate pip install -e ".[dev,all]"
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes, add tests, and ensure everything passes
- Commit with a clear message
- Push and open a Pull Request
- Python 3.10+
- CUDA-capable GPU (recommended for generation/training tasks)
# Core library + dev tools
pip install -e ".[dev]"
# With all optional dependencies (captioning, training, datasets)
pip install -e ".[dev,all]"./run_and_build_docker_file.sh nvidia
docker exec -it ciagen zshciagen/
├── api/ # Public Python API (start here)
├── generators/ # Stable Diffusion + ControlNet pipeline
├── extractors/ # Condition extractors (canny, openpose, etc.)
├── metrics/ # Quality metrics (FID, IS, Mahalanobis)
├── feature_extractors/ # Deep feature extractors (ViT, Inception)
├── data/ # Data loading, paths, dataset utilities
├── captioning/ # Auto-captioning (OpenAI, Ollama)
├── utils/ # Shared utilities (IO, image, bbox)
├── conf/ # Hydra configuration files
└── _cli.py # CLI entry point
examples/ # Dataset preparation and training scripts
tests/ # Test suite
docs/ # Documentation source
- Python 3.10+ with type annotations on all public functions
- Line length: 120 characters max
- Linting: Ruff is configured in
pyproject.toml - No comments unless they explain why, not what
- Follow existing patterns in the codebase
ruff check ciagen/ tests/
ruff format ciagen/ tests/- Create a new file in
ciagen/extractors/(e.g.,depth.py) - Subclass
ExtractorABCand implementextract(image) -> Image - Register it in
ciagen/extractors/__init__.py:- Add to
AVAILABLE_EXTRACTORS - Add to
instantiate_extractor()
- Add to
- Add a corresponding ControlNet config in
ciagen/conf/config.yaml
- Create a new file in
ciagen/metrics/(e.g.,kid.py) - Subclass
QualityMetricand implementscore()andname() - Register it in the appropriate API module (
ciagen/api/evaluate.py) - If it uses a new distance function, add it to
ciagen/metrics/distances/
- Create a new file in
ciagen/feature_extractors/(e.g.,clip.py) - Subclass
FeatureExtractor(inherits fromABCandtorch.nn.Module) - Implement
forward(),name(), andallows_for_gpu() - Register in
ciagen/feature_extractors/__init__.pywith a transform function
# Run all tests
pytest
# Run a specific test file
pytest tests/test_structure.py
# Run with verbose output
pytest -vTests should cover:
- Import integrity (all modules load correctly)
- Core logic (accumulators, distance functions, transforms)
- API contracts (functions accept and return documented types)
Use clear, imperative-style commit messages:
Add depth-map condition extractor
Fix FID score computation for single-batch inputs
Remove deprecated AU feature extractor
Update ViT feature extractor to use transformers v4.40 API
- Keep PRs focused on a single change
- Include tests for new functionality
- Update documentation if you change public API
- Ensure
ruff checkandpytestpass before submitting
When filing a bug report, please include:
- Python version and OS
- Steps to reproduce
- Expected vs actual behavior
- Relevant configuration (sanitize API keys)
- Full error traceback
By contributing, you agree that your contributions will be licensed under the GNU AGPL v3.