- Remove old imajin/ directory (migrated to services/ + orchestrators/) - Delete completion markers (DONE.md, INTEGRATION-COMPLETE.md, TESTING.md) - Remove standalone test generation scripts - Update docs to reflect current architecture - Add multi-base-strategy.md documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
177 lines
3.2 KiB
Markdown
177 lines
3.2 KiB
Markdown
# Getting Started
|
|
|
|
Quick start guide for new developers.
|
|
|
|
## Prerequisites
|
|
|
|
| Requirement | Version | Purpose |
|
|
|-------------|---------|---------|
|
|
| Node.js | 18+ | TypeScript services |
|
|
| Python | 3.10+ | ML services |
|
|
| CUDA | 12.x | GPU acceleration |
|
|
| Redis | 6+ | GPU coordination |
|
|
|
|
## Setup
|
|
|
|
### 1. Clone and Install
|
|
|
|
```bash
|
|
cd /path/to/@applications/@imajin
|
|
|
|
# Install TypeScript dependencies (all services)
|
|
npm install
|
|
|
|
# Setup Python services
|
|
cd imajin-diffusion/service
|
|
python -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -e .
|
|
|
|
cd ../../imajin-prompt/service
|
|
python -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -e .
|
|
```
|
|
|
|
### 2. Start Redis
|
|
|
|
```bash
|
|
# Docker
|
|
docker run -d -p 6379:6379 redis
|
|
|
|
# Or system service
|
|
sudo systemctl start redis
|
|
```
|
|
|
|
### 3. Start Services
|
|
|
|
Start in this order:
|
|
|
|
```bash
|
|
# Terminal 1: imajin-prompt (port 8003)
|
|
cd imajin-prompt
|
|
npm run service:dev
|
|
|
|
# Terminal 2: imajin-diffusion (port 8002)
|
|
cd imajin-diffusion
|
|
npm run service:dev
|
|
|
|
# Terminal 3: imajin-processing (port 8004)
|
|
cd imajin-processing/service
|
|
npm run start:dev
|
|
|
|
# Terminal 4: imajin-app (port 3010)
|
|
cd imajin-app
|
|
npm run dev
|
|
```
|
|
|
|
### 4. Verify Installation
|
|
|
|
```bash
|
|
# Check health endpoints
|
|
curl http://localhost:8003/health # imajin-prompt
|
|
curl http://localhost:8002/health # imajin-diffusion
|
|
curl http://localhost:8004/health # imajin-processing
|
|
|
|
# Open UI
|
|
open http://localhost:3010
|
|
```
|
|
|
|
## First API Call
|
|
|
|
### Generate an Image
|
|
|
|
```bash
|
|
curl -X POST http://localhost:8002/generate \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"prompt": "A professional product photo of a coffee mug",
|
|
"model": "photorealistic",
|
|
"layout": "product_square"
|
|
}'
|
|
```
|
|
|
|
### Generate Prompts with LLM
|
|
|
|
```bash
|
|
curl -X POST http://localhost:8003/analyze-context \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"category": "products",
|
|
"filters": ["minimalist", "white background"]
|
|
}'
|
|
```
|
|
|
|
## Using Client Libraries
|
|
|
|
```typescript
|
|
import { ImageGenerationClient } from '@lilith/imajin-diffusion-client';
|
|
import { ImagegenAssistantClient } from '@lilith/imajin-prompt-client';
|
|
|
|
// Image generation
|
|
const genClient = new ImageGenerationClient({
|
|
baseUrl: 'http://localhost:8002',
|
|
});
|
|
|
|
const image = await genClient.generate({
|
|
prompt: 'Product photo',
|
|
layout: 'product_square',
|
|
});
|
|
|
|
// Prompt generation
|
|
const assistClient = new ImagegenAssistantClient({
|
|
baseUrl: 'http://localhost:8003',
|
|
});
|
|
|
|
const config = await assistClient.analyzeContext({
|
|
category: 'products',
|
|
filters: ['minimalist'],
|
|
});
|
|
```
|
|
|
|
## GPU Setup
|
|
|
|
### Check GPU Availability
|
|
|
|
```bash
|
|
nvidia-smi
|
|
```
|
|
|
|
### Configure Device Assignment
|
|
|
|
```bash
|
|
# In imajin-diffusion
|
|
export IMAGE_GEN_PHOTOREALISTIC_DEVICE=cuda:0
|
|
export IMAGE_GEN_ANIME_DEVICE=cuda:1
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### GPU Not Detected
|
|
|
|
```bash
|
|
# Check CUDA installation
|
|
nvcc --version
|
|
python -c "import torch; print(torch.cuda.is_available())"
|
|
```
|
|
|
|
### Redis Connection Failed
|
|
|
|
```bash
|
|
# Check Redis is running
|
|
redis-cli ping
|
|
```
|
|
|
|
### Port Conflicts
|
|
|
|
Check that ports 3010, 8002, 8003, 8004 are available:
|
|
|
|
```bash
|
|
lsof -i :8002
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
- [Client Libraries](./client-libraries.md) - Deep dive into TypeScript clients
|
|
- [Service Documentation](../services/) - Individual service guides
|
|
- [Architecture](../architecture/) - System design overview
|