File size: 6,291 Bytes
338d95d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# 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:

```bash
# 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:

```bash
# 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.