refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,174 @@
|
||||
---
|
||||
id: wiki-2026-0508-오픈소스-기반-맞춤형-이미지-생성-워크플로우-구축
|
||||
title: 오픈소스 기반 맞춤형 이미지 생성 워크플로우 구축
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [OSS Image Gen Workflow, ComfyUI Pipeline, Local Diffusion Stack]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [diffusion, comfyui, flux, lora, image-gen, oss]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: python
|
||||
framework: ComfyUI-FLUX
|
||||
---
|
||||
|
||||
# 오픈소스 기반 맞춤형 이미지 생성 워크플로우 구축
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 base model + LoRA + ControlNet + upscaler = production stack"**. 2026 기준 FLUX.1 (Black Forest Labs) 가 SDXL 을 대체하며 OSS image gen 의 base, ComfyUI 가 node-based orchestration 의 표준. 8GB VRAM 부터 가능, 24GB 이상에서 batch + LoRA stacking 자유.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 stack 구성
|
||||
- **Base model**: FLUX.1-dev (12B), FLUX.1-schnell (4-step), SD3.5-Large (8B), SDXL (legacy).
|
||||
- **Adapter**: LoRA (1-100MB) · IPAdapter (style transfer) · ControlNet (pose/depth/canny).
|
||||
- **Upscaler**: 4x-UltraSharp, RealESRGAN, SUPIR (face-aware).
|
||||
- **Orchestrator**: ComfyUI (node graph) · InvokeAI (UX) · A1111 (legacy webui).
|
||||
|
||||
### 매 hardware tier
|
||||
- **8GB (RTX 3060/4060)**: schnell + GGUF Q4 · 1024² · 30s/img.
|
||||
- **16GB (4080/4090)**: dev fp8 · LoRA stack · 60s/img.
|
||||
- **24GB+ (4090/5090)**: dev fp16 · 2K render · ControlNet 동시 3개.
|
||||
- **Apple Silicon (M3/M4 32GB+)**: MLX-FLUX · DiffusionKit.
|
||||
|
||||
### 매 응용
|
||||
1. 브랜드 일관 캐릭터 — character LoRA + IPAdapter face.
|
||||
2. 제품 사진 — ControlNet depth + product photo LoRA.
|
||||
3. 컨셉 아트 — style LoRA + 4-stage upscale (1K→4K).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### ComfyUI 기본 FLUX workflow (Python API)
|
||||
```python
|
||||
import json, urllib.request
|
||||
|
||||
workflow = {
|
||||
"3": {"class_type": "KSampler", "inputs": {
|
||||
"seed": 42, "steps": 20, "cfg": 3.5,
|
||||
"sampler_name": "euler", "scheduler": "simple",
|
||||
"model": ["10", 0], "positive": ["6", 0],
|
||||
"negative": ["7", 0], "latent_image": ["5", 0]
|
||||
}},
|
||||
"5": {"class_type": "EmptyLatentImage",
|
||||
"inputs": {"width": 1024, "height": 1024, "batch_size": 1}},
|
||||
"6": {"class_type": "CLIPTextEncode",
|
||||
"inputs": {"text": "studio portrait, soft light", "clip": ["10", 1]}},
|
||||
"10": {"class_type": "CheckpointLoaderSimple",
|
||||
"inputs": {"ckpt_name": "flux1-dev.safetensors"}}
|
||||
}
|
||||
urllib.request.urlopen("http://127.0.0.1:8188/prompt",
|
||||
data=json.dumps({"prompt": workflow}).encode())
|
||||
```
|
||||
|
||||
### LoRA stacking (캐릭터 + 스타일)
|
||||
```python
|
||||
# ComfyUI LoraLoader 노드 직렬화
|
||||
"15": {"class_type": "LoraLoader", "inputs": {
|
||||
"model": ["10", 0], "clip": ["10", 1],
|
||||
"lora_name": "char_alice_v3.safetensors",
|
||||
"strength_model": 0.85, "strength_clip": 1.0
|
||||
}},
|
||||
"16": {"class_type": "LoraLoader", "inputs": {
|
||||
"model": ["15", 0], "clip": ["15", 1],
|
||||
"lora_name": "watercolor_style.safetensors",
|
||||
"strength_model": 0.55, "strength_clip": 0.7
|
||||
}}
|
||||
```
|
||||
|
||||
### LoRA 학습 (kohya-ss FLUX)
|
||||
```bash
|
||||
accelerate launch sd-scripts/flux_train_network.py \
|
||||
--pretrained_model_name_or_path flux1-dev.safetensors \
|
||||
--train_data_dir ./dataset/alice \
|
||||
--output_dir ./out --output_name char_alice_v3 \
|
||||
--network_module networks.lora_flux \
|
||||
--network_dim 32 --network_alpha 16 \
|
||||
--resolution 1024 --train_batch_size 1 \
|
||||
--gradient_accumulation_steps 4 \
|
||||
--learning_rate 1e-4 --max_train_steps 1500 \
|
||||
--mixed_precision bf16 --save_precision bf16 \
|
||||
--cache_text_encoder_outputs --cache_latents
|
||||
```
|
||||
|
||||
### ControlNet (pose-guided)
|
||||
```python
|
||||
"20": {"class_type": "ControlNetLoader",
|
||||
"inputs": {"control_net_name": "flux-controlnet-pose-v3.safetensors"}},
|
||||
"21": {"class_type": "LoadImage", "inputs": {"image": "pose_ref.png"}},
|
||||
"22": {"class_type": "ControlNetApply", "inputs": {
|
||||
"conditioning": ["6", 0], "control_net": ["20", 0],
|
||||
"image": ["21", 0], "strength": 0.65
|
||||
}}
|
||||
```
|
||||
|
||||
### SUPIR upscale (face-aware 4x)
|
||||
```python
|
||||
"30": {"class_type": "SUPIR_Upscale", "inputs": {
|
||||
"image": ["8", 0], "scale": 4,
|
||||
"model": "SUPIR-v0F.ckpt",
|
||||
"denoise": 0.35, "cfg_scale": 4.0,
|
||||
"color_fix_type": "Wavelet"
|
||||
}}
|
||||
```
|
||||
|
||||
### Batch automation (재현 가능)
|
||||
```python
|
||||
import itertools, hashlib
|
||||
seeds = [42, 1234, 7777]
|
||||
prompts = ["forest", "city night", "studio"]
|
||||
for p, s in itertools.product(prompts, seeds):
|
||||
hsh = hashlib.md5(f"{p}-{s}".encode()).hexdigest()[:8]
|
||||
run_workflow(prompt=p, seed=s, save_as=f"out_{hsh}.png")
|
||||
```
|
||||
|
||||
### MLX-FLUX (Apple Silicon)
|
||||
```bash
|
||||
pip install mflux
|
||||
mflux-generate --model dev \
|
||||
--prompt "isometric tiny city, paper craft" \
|
||||
--steps 20 --seed 42 --quantize 8 \
|
||||
--output out.png
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 8GB VRAM, 빠른 iteration | FLUX.1-schnell GGUF Q4. |
|
||||
| 캐릭터 일관성 필요 | character LoRA + IPAdapter. |
|
||||
| 제품 컴포지션 강제 | ControlNet depth/canny. |
|
||||
| 4K 출력 | 1K base → SUPIR 4x. |
|
||||
| Mac M3/M4 | MLX-FLUX (mflux). |
|
||||
|
||||
**기본값**: FLUX.1-dev fp8 · ComfyUI · 1024² · 20 steps · cfg 3.5 · LoRA 0.7-0.9.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Diffusion-Models]] · [[Generative-AI]]
|
||||
- 변형: [[FLUX]]
|
||||
- 응용: [[ControlNet]] · [[IPAdapter]]
|
||||
- Adjacent: [[ComfyUI]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: ComfyUI workflow JSON 작성, LoRA 학습 스크립트 튜닝, prompt engineering.
|
||||
**언제 X**: real-time inference (< 1s) — closed API (Midjourney/DALL-E) 가 여전히 지연 면 우위.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **LoRA strength 1.0 fixed**: overcooked 결과. 0.6-0.85 range 가 sweet spot.
|
||||
- **CFG 7+ on FLUX**: artifact. FLUX 는 3-4가 정상 (SDXL 의 7과 다름).
|
||||
- **No seed control**: 재현 불가능 → A/B 비교 불능.
|
||||
- **VAE mismatch**: SDXL VAE 를 FLUX 에 사용 시 색 깨짐.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Black Forest Labs FLUX docs, ComfyUI repo, kohya-ss flux_train).
|
||||
- 신뢰도 A — 2024-2026 OSS image gen 의 표준.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — OSS image gen workflow (FLUX/ComfyUI) |
|
||||
Reference in New Issue
Block a user