Comp-I / docs /PROJECT_STRUCTURE.md
axrzce's picture
Deploy from GitHub main
338d95d verified
|
raw
history blame
6.29 kB

CompI Project Structure

This document outlines the organized structure of the CompI (Compositional Intelligence) project.

πŸ“ Directory Structure

Project CompI/
β”œβ”€β”€ πŸ“ src/                          # Source code (organized modules)
β”‚   β”œβ”€β”€ πŸ“ generators/               # Image generation modules
β”‚   β”‚   β”œβ”€β”€ __init__.py             # Module initialization
β”‚   β”‚   β”œβ”€β”€ compi_phase1_text2image.py          # Basic text-to-image
β”‚   β”‚   β”œβ”€β”€ compi_phase1_advanced.py            # Advanced generation
β”‚   β”‚   β”œβ”€β”€ compi_phase1b_styled_generation.py  # Style conditioning
β”‚   β”‚   β”œβ”€β”€ compi_phase1b_advanced_styling.py   # Advanced styling
β”‚   β”‚   β”œβ”€β”€ compi_phase1d_evaluate_quality.py   # Quality evaluation (Streamlit)
β”‚   β”‚   β”œβ”€β”€ compi_phase1d_cli_evaluation.py     # Quality evaluation (CLI)
β”‚   β”‚   β”œβ”€β”€ compi_phase1e_dataset_prep.py       # LoRA dataset preparation
β”‚   β”‚   β”œβ”€β”€ compi_phase1e_lora_training.py      # LoRA fine-tuning
β”‚   β”‚   β”œβ”€β”€ compi_phase1e_style_generation.py   # Personal style generation
β”‚   β”‚   └── compi_phase1e_style_manager.py      # LoRA style management
β”‚   β”œβ”€β”€ πŸ“ models/                   # Model implementations (future)
β”‚   β”œβ”€β”€ πŸ“ utils/                    # Utility functions
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ logging_utils.py
β”‚   β”‚   └── file_utils.py
β”‚   β”œβ”€β”€ πŸ“ data/                     # Data processing modules (future)
β”‚   β”œβ”€β”€ πŸ“ ui/                       # User interface components (future)
β”‚   β”œβ”€β”€ config.py                    # Project configuration
β”‚   β”œβ”€β”€ setup_env.py                 # Environment setup script
β”‚   └── test_setup.py                # Environment testing
β”œβ”€β”€ πŸ“ notebooks/                    # Jupyter notebooks
β”‚   └── 01_getting_started.ipynb    # Tutorial notebook
β”œβ”€β”€ πŸ“ data/                         # Dataset storage
β”œβ”€β”€ πŸ“ outputs/                      # Generated content
β”‚   β”œβ”€β”€ images/                      # Generated images
β”‚   └── metadata/                    # Generation metadata
β”œβ”€β”€ πŸ“ tests/                        # Unit tests (future)
β”œβ”€β”€ 🐍 run_basic_generation.py       # Convenience: Basic generation
β”œβ”€β”€ 🐍 run_advanced_generation.py    # Convenience: Advanced generation
β”œβ”€β”€ 🐍 run_styled_generation.py      # Convenience: Style conditioning
β”œβ”€β”€ 🐍 run_advanced_styling.py       # Convenience: Advanced styling
β”œβ”€β”€ 🐍 run_evaluation.py             # Convenience: Quality evaluation
β”œβ”€β”€ 🐍 run_lora_training.py          # Convenience: LoRA training
β”œβ”€β”€ 🐍 run_style_generation.py       # Convenience: Personal style generation
β”œβ”€β”€ πŸ“„ requirements.txt              # Python dependencies
β”œβ”€β”€ πŸ“„ development.md                # Development roadmap
β”œβ”€β”€ πŸ“„ PHASE1_USAGE.md              # Phase 1 usage guide
β”œβ”€β”€ πŸ“„ PROJECT_STRUCTURE.md         # This file
β”œβ”€β”€ πŸ“„ .gitignore                   # Git ignore rules
└── πŸ“„ README.md                    # Project overview

πŸš€ Usage Patterns

Convenience Scripts (Recommended)

Run from project root for easy access:

# Basic text-to-image generation
python run_basic_generation.py "prompt here"

# Advanced generation with options
python run_advanced_generation.py "prompt" --negative "unwanted" --steps 50

# Interactive style selection
python run_styled_generation.py

# Advanced style conditioning
python run_advanced_styling.py "prompt" --style "oil painting" --mood "dramatic"

# Quality evaluation interface
python run_evaluation.py

# LoRA personal style training
python run_lora_training.py --dataset-dir datasets/my_style

# Generate with personal style
python run_style_generation.py --lora-path lora_models/my_style/checkpoint-1000 "prompt"

# LoRA personal style training
python run_lora_training.py --dataset-dir datasets/my_style

# Generate with personal style
python run_style_generation.py --lora-path lora_models/my_style/checkpoint-1000 "prompt"

Direct Module Access

Run generators directly from their organized location:

# Direct access to generators
python src/generators/compi_phase1_text2image.py "prompt"
python src/generators/compi_phase1b_advanced_styling.py --list-styles

# Environment setup and testing
python src/setup_env.py
python src/test_setup.py

🎯 Benefits of This Organization

1. Clean Separation of Concerns

  • src/generators/ - All image generation logic
  • src/utils/ - Reusable utility functions
  • src/ - Core project modules and configuration
  • Root level - Convenience scripts and documentation

2. Professional Python Structure

  • Proper module organization with __init__.py files
  • Clear import paths and dependencies
  • Scalable architecture for future expansion

3. Easy Access

  • Convenience scripts provide simple access from project root
  • Direct module access for advanced users
  • Maintains backward compatibility

4. Future-Ready

  • Organized structure ready for Phase 2+ implementations
  • Clear places for audio processing, UI components, etc.
  • Modular design supports easy testing and maintenance

πŸ”§ Development Guidelines

Adding New Generators

  1. Create new generator in src/generators/
  2. Add imports to src/generators/__init__.py
  3. Create convenience script in project root if needed
  4. Update documentation

Adding New Utilities

  1. Add utility functions to appropriate module in src/utils/
  2. Update src/utils/__init__.py imports
  3. Import in generators as needed

Testing

  1. Add tests to tests/ directory
  2. Use src/test_setup.py for environment verification
  3. Test both convenience scripts and direct module access

πŸ“š Documentation

  • README.md - Project overview and quick start
  • development.md - Comprehensive development roadmap
  • PHASE1_USAGE.md - Detailed Phase 1 usage guide
  • PROJECT_STRUCTURE.md - This organizational guide

This structure provides a solid foundation for the CompI project's continued development through all planned phases.