Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,44 +1,41 @@
|
|
| 1 |
-
|
| 2 |
-
tags:
|
| 3 |
-
- activation-avatars
|
| 4 |
-
- milady
|
| 5 |
-
- flux
|
| 6 |
-
- adapter
|
| 7 |
-
- qwen3
|
| 8 |
-
license: mit
|
| 9 |
-
pipeline_tag: image-generation
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
# Milady Avatar Adapter
|
| 13 |
-
|
| 14 |
-
A CrossAttention adapter that maps Qwen3-4B LLM activations to FLUX.2-Klein
|
| 15 |
-
prompt embedding space, producing Milady NFT-style avatar expressions in real-time.
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
- **Input**: Qwen3-4B hidden states from layers [9, 18, 27] (7680 dims)
|
| 20 |
-
- **Layer Weighting**: Learned weighted combination → 2560 dims
|
| 21 |
-
- **Adapter**: CrossAttentionAdapter (rank=128, 64 output tokens, 2 decoder layers)
|
| 22 |
-
- **Output**: 64 × 7680 prompt embeddings for FLUX.2-Klein
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
-
|
| 27 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
# activation: [7680] tensor from Qwen3-4B layers [9,18,27]
|
| 31 |
-
expression = adapter(activation, emotion_scale=4.0)
|
| 32 |
-
# expression: [64, 7680] — concatenate with base prompt_embeds for Klein
|
| 33 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
-
|
| 39 |
-
- 80 epochs, AdamW optimizer, cosine+MSE loss
|
| 40 |
-
- Style descriptions mapped through Klein's text encoder (layers 10,20,30)
|
| 41 |
|
| 42 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
# Milady Avatar Adapter (SDXL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
Neural adapter that maps Qwen3-4B language model activations to SDXL prompt embedding space,
|
| 4 |
+
enabling real-time emotional avatar generation in the Milady art style.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
## Architecture
|
| 7 |
|
| 8 |
+
### SDXL Adapter (NEW - Higher Quality)
|
| 9 |
+
- **Input**: Qwen3-4B hidden states from layers [9, 18, 27] → 7680 dims
|
| 10 |
+
- **Layer Weighting**: Learned weighted combination → 2560 dims
|
| 11 |
+
- **Cross-Attention Decoder**: 3-layer transformer decoder with 8 heads
|
| 12 |
+
- **Output**: SDXL prompt embeddings [77, 2048] + pooled embeddings [1280]
|
| 13 |
+
- **Parameters**: 5.28M
|
| 14 |
+
- **Training**: 500 epochs on 200 emotion-labeled samples, MSE loss
|
| 15 |
+
- **Best Val Loss**: 6.762
|
| 16 |
|
| 17 |
+
### Pipeline
|
|
|
|
|
|
|
|
|
|
| 18 |
```
|
| 19 |
+
Emotional Text → Qwen3-4B (hooks on layers 9,18,27) → Adapter → SDXL + Milady LoRA → Avatar Image
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
## Files
|
| 23 |
|
| 24 |
+
### SDXL Version (Recommended)
|
| 25 |
+
- `sdxl/best_sdxl_adapter.pt` - Trained adapter weights
|
| 26 |
+
- `sdxl/sdxl_adapter.py` - Adapter architecture
|
| 27 |
+
- `sdxl/test_sdxl_pipeline.py` - End-to-end inference script
|
| 28 |
+
- `sdxl/train_sdxl_adapter.py` - Training script
|
| 29 |
|
| 30 |
+
### Klein Version (Legacy)
|
| 31 |
+
- `adapters/` - Original FLUX.2-Klein adapter weights
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
## Requirements
|
| 34 |
+
- SDXL base model: `stabilityai/stable-diffusion-xl-base-1.0`
|
| 35 |
+
- Milady LoRA: CivitAI Milady SDXL LoRA
|
| 36 |
+
- Qwen3-4B: `Qwen/Qwen3-4B`
|
| 37 |
+
- Python packages: `torch`, `transformers`, `diffusers`, `safetensors`
|
| 38 |
|
| 39 |
+
## Emotions Supported
|
| 40 |
+
20 emotions: happy, sad, angry, surprised, scared, disgusted, neutral, excited, calm, anxious,
|
| 41 |
+
confident, shy, proud, loving, jealous, curious, bored, amused, thoughtful, determined
|