Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- nbeerbower/FIXBODY
|
| 5 |
+
base_model:
|
| 6 |
+
- Qwen/Qwen-Image-Edit
|
| 7 |
+
tags:
|
| 8 |
+
- lora
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
|
| 13 |
+
# FIXBODY-r128
|
| 14 |
+
|
| 15 |
+
An imperfect LoRA for Qwen-Image-Edit focused on correcting hands and anatomy issues in anime-style illustrations while preserving the original art style.
|
| 16 |
+
|
| 17 |
+
This is a longer more aggressive training of the LoRA, as I noticed it had not yet overfit to training data.
|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
|
| 21 |
+
```
|
| 22 |
+
pipeline.load_lora_weights(
|
| 23 |
+
"nbeerbower/FIXBODY-r128-Qwen-Image-Edit",
|
| 24 |
+
weight_name="pytorch_lora_weights.safetensors"
|
| 25 |
+
)
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
Triggered by `fix [her/his/their] hands/legs` (the pronoun can be omitted, and it works best focusing on one body part at a time)
|
| 29 |
+
|
| 30 |
+
## Model Configuration
|
| 31 |
+
|
| 32 |
+
[Training code available on Github!](https://github.com/nbeerbower/Qwen-Image-Edit-LoRA-Trainer)
|
| 33 |
+
|
| 34 |
+
```
|
| 35 |
+
# Aggressive Configuration for FIXBODY - 86 samples
|
| 36 |
+
|
| 37 |
+
# Model settings
|
| 38 |
+
pretrained_model_name_or_path: "Qwen/Qwen-Image-Edit"
|
| 39 |
+
|
| 40 |
+
# Dataset settings
|
| 41 |
+
dataset_name: "nbeerbower/FIXBODY"
|
| 42 |
+
dataset_split: "train"
|
| 43 |
+
max_samples: null
|
| 44 |
+
|
| 45 |
+
# Prompt settings
|
| 46 |
+
use_prompt_directly: true
|
| 47 |
+
prompt_template: "{prompt}"
|
| 48 |
+
|
| 49 |
+
# LoRA configuration - MAX CAPACITY
|
| 50 |
+
lora_rank: 128 # Maximum practical rank
|
| 51 |
+
lora_alpha: 256 # 2x rank
|
| 52 |
+
lora_dropout: 0.0 # No dropout - let it fit
|
| 53 |
+
target_modules: ["to_k", "to_q", "to_v", "to_out.0", "ff.net.0.proj", "ff.net.2"]
|
| 54 |
+
|
| 55 |
+
# Training settings - AGGRESSIVE
|
| 56 |
+
train_batch_size: 1
|
| 57 |
+
gradient_accumulation_steps: 1 # Update every sample
|
| 58 |
+
num_train_epochs: 100 # Many epochs to really learn
|
| 59 |
+
max_train_steps: 10000
|
| 60 |
+
learning_rate: 1.5e-4 # Higher LR
|
| 61 |
+
lr_scheduler: "constant" # No decay
|
| 62 |
+
lr_warmup_steps: 20
|
| 63 |
+
|
| 64 |
+
# Optimizer settings
|
| 65 |
+
use_8bit_adam: true
|
| 66 |
+
adam_beta1: 0.9
|
| 67 |
+
adam_beta2: 0.999
|
| 68 |
+
adam_weight_decay: 0.0001 # Minimal weight decay
|
| 69 |
+
adam_epsilon: 1e-8
|
| 70 |
+
max_grad_norm: 1.0
|
| 71 |
+
|
| 72 |
+
# Mixed precision
|
| 73 |
+
mixed_precision: "bf16"
|
| 74 |
+
|
| 75 |
+
# Checkpointing and logging
|
| 76 |
+
output_dir: "./output_fixbody_aggressive"
|
| 77 |
+
logging_dir: "logs"
|
| 78 |
+
checkpointing_steps: 300 # Frequent checkpoints
|
| 79 |
+
checkpoints_total_limit: 30 # Keep many
|
| 80 |
+
report_to: "wandb"
|
| 81 |
+
tracker_project_name: "qwen-fixbody"
|
| 82 |
+
run_name: "r128-aggressive-100ep"
|
| 83 |
+
|
| 84 |
+
# Data processing
|
| 85 |
+
save_embeddings: true
|
| 86 |
+
dataloader_num_workers: 1
|
| 87 |
+
|
| 88 |
+
# Memory optimization
|
| 89 |
+
gradient_checkpointing: true
|
| 90 |
+
```
|