supli6669 commited on
Commit ·
7d99559
1
Parent(s): bcf89b8
feat: add sequential model improvement roadmap (Phase 1 complete — yml config fixes)
Browse files- .agents/AGENTS.md +22 -0
- models/CodeFormer/options/CodeFormer_stage3_custom.yml +13 -13
- train_custom.py +5 -3
.agents/AGENTS.md
CHANGED
|
@@ -30,3 +30,25 @@ All AI agents working on this codebase must adhere strictly to these rules:
|
|
| 30 |
```
|
| 31 |
- This will copy the latest `AGENTS.md` to the vault's Rules directory and update the vault timestamp.
|
| 32 |
- Vault location: `D:\AgentBrain\`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
```
|
| 31 |
- This will copy the latest `AGENTS.md` to the vault's Rules directory and update the vault timestamp.
|
| 32 |
- Vault location: `D:\AgentBrain\`
|
| 33 |
+
|
| 34 |
+
7. **Mandatory Sequential Model Improvement Roadmap**:
|
| 35 |
+
- All model-related work MUST follow the sequential phase order defined in the task list artifact:
|
| 36 |
+
`C:\Users\admin\.gemini\antigravity-ide\brain\0bf6bec8-6164-477e-a32d-6f0b9ef577c6\task.md`
|
| 37 |
+
- **Before starting any model improvement task**, read `task.md` and identify the first incomplete task (`[ ]`).
|
| 38 |
+
- Do **NOT** skip phases or implement out-of-order. Each phase builds on the previous:
|
| 39 |
+
- **Phase 1** — Config fixes (yml) — COMPLETED ✅
|
| 40 |
+
- **Phase 2** — Resume & complete training run (iter 2k → 20k)
|
| 41 |
+
- **Phase 3** — ArcFace identity loss integration
|
| 42 |
+
- **Phase 4** — Dataset expansion verification & game character mixing
|
| 43 |
+
- **Phase 5** — Static INT8 ONNX quantization with calibration
|
| 44 |
+
- **Phase 6** — Stage II transformer fine-tune (GPU only, HF Space/Colab)
|
| 45 |
+
- **Phase 7** — A/B test UI & model selection dropdown
|
| 46 |
+
- After completing a task, mark it `[x]` in `task.md` before proceeding to the next.
|
| 47 |
+
- Reference the full improvement rationale in:
|
| 48 |
+
`C:\Users\admin\.gemini\antigravity-ide\brain\0bf6bec8-6164-477e-a32d-6f0b9ef577c6\model_improvement_proposals.md`
|
| 49 |
+
|
| 50 |
+
8. **Always Update task.md During Model Work**:
|
| 51 |
+
- Mark tasks `[/]` (in progress) when starting them.
|
| 52 |
+
- Mark tasks `[x]` (done) when verified complete.
|
| 53 |
+
- Add notes under each task if you discover important findings (e.g., actual iteration count, loss values, timing).
|
| 54 |
+
- This ensures seamless handover between sessions and agents.
|
models/CodeFormer/options/CodeFormer_stage3_custom.yml
CHANGED
|
@@ -24,7 +24,7 @@ datasets:
|
|
| 24 |
use_corrupt: true
|
| 25 |
blur_kernel_size: 41
|
| 26 |
use_motion_kernel: true
|
| 27 |
-
motion_kernel_prob: 0.
|
| 28 |
kernel_list:
|
| 29 |
- iso
|
| 30 |
- aniso
|
|
@@ -36,13 +36,13 @@ datasets:
|
|
| 36 |
- 10.0
|
| 37 |
downsample_range:
|
| 38 |
- 1.0
|
| 39 |
-
-
|
| 40 |
noise_range:
|
| 41 |
- 0.0
|
| 42 |
-
-
|
| 43 |
jpeg_range:
|
| 44 |
-
-
|
| 45 |
-
-
|
| 46 |
blur_sigma_large:
|
| 47 |
- 1.0
|
| 48 |
- 15.0
|
|
@@ -53,13 +53,13 @@ datasets:
|
|
| 53 |
- 0.0
|
| 54 |
- 30.0
|
| 55 |
jpeg_range_large:
|
| 56 |
-
-
|
| 57 |
-
-
|
| 58 |
latent_gt_path: null
|
| 59 |
num_worker_per_gpu: 0
|
| 60 |
batch_size_per_gpu: 1
|
| 61 |
-
dataset_enlarge_ratio:
|
| 62 |
-
prefetch_mode:
|
| 63 |
network_g:
|
| 64 |
type: CodeFormer
|
| 65 |
dim_embd: 512
|
|
@@ -97,7 +97,7 @@ path:
|
|
| 97 |
param_key_g: params_ema
|
| 98 |
strict_load_g: false
|
| 99 |
pretrain_network_d: null
|
| 100 |
-
resume_state: D:\.gemini-scratch\custom-ai-enhancer\models\CodeFormer\experiments\20260708_201102_CodeFormer_stage3_custom\training_states\
|
| 101 |
train:
|
| 102 |
use_hq_feat_loss: true
|
| 103 |
feat_loss_weight: 1.0
|
|
@@ -121,11 +121,11 @@ train:
|
|
| 121 |
scheduler:
|
| 122 |
type: CosineAnnealingRestartLR
|
| 123 |
periods:
|
| 124 |
-
-
|
| 125 |
restart_weights:
|
| 126 |
- 1
|
| 127 |
-
eta_min:
|
| 128 |
-
total_iter:
|
| 129 |
warmup_iter: -1
|
| 130 |
ema_decay: 0.997
|
| 131 |
pixel_opt:
|
|
|
|
| 24 |
use_corrupt: true
|
| 25 |
blur_kernel_size: 41
|
| 26 |
use_motion_kernel: true
|
| 27 |
+
motion_kernel_prob: 0.15
|
| 28 |
kernel_list:
|
| 29 |
- iso
|
| 30 |
- aniso
|
|
|
|
| 36 |
- 10.0
|
| 37 |
downsample_range:
|
| 38 |
- 1.0
|
| 39 |
+
- 20.0
|
| 40 |
noise_range:
|
| 41 |
- 0.0
|
| 42 |
+
- 30.0
|
| 43 |
jpeg_range:
|
| 44 |
+
- 10
|
| 45 |
+
- 70
|
| 46 |
blur_sigma_large:
|
| 47 |
- 1.0
|
| 48 |
- 15.0
|
|
|
|
| 53 |
- 0.0
|
| 54 |
- 30.0
|
| 55 |
jpeg_range_large:
|
| 56 |
+
- 5
|
| 57 |
+
- 50
|
| 58 |
latent_gt_path: null
|
| 59 |
num_worker_per_gpu: 0
|
| 60 |
batch_size_per_gpu: 1
|
| 61 |
+
dataset_enlarge_ratio: 5
|
| 62 |
+
prefetch_mode: null
|
| 63 |
network_g:
|
| 64 |
type: CodeFormer
|
| 65 |
dim_embd: 512
|
|
|
|
| 97 |
param_key_g: params_ema
|
| 98 |
strict_load_g: false
|
| 99 |
pretrain_network_d: null
|
| 100 |
+
resume_state: D:\.gemini-scratch\custom-ai-enhancer\models\CodeFormer\experiments\20260708_201102_CodeFormer_stage3_custom\training_states\2000.state
|
| 101 |
train:
|
| 102 |
use_hq_feat_loss: true
|
| 103 |
feat_loss_weight: 1.0
|
|
|
|
| 121 |
scheduler:
|
| 122 |
type: CosineAnnealingRestartLR
|
| 123 |
periods:
|
| 124 |
+
- 20000
|
| 125 |
restart_weights:
|
| 126 |
- 1
|
| 127 |
+
eta_min: 5.0e-06
|
| 128 |
+
total_iter: 2002
|
| 129 |
warmup_iter: -1
|
| 130 |
ema_decay: 0.997
|
| 131 |
pixel_opt:
|
train_custom.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import cv2
|
| 4 |
import torch
|
| 5 |
-
torch.set_num_threads(
|
| 6 |
import yaml
|
| 7 |
import subprocess
|
| 8 |
import glob
|
|
@@ -60,7 +60,9 @@ def main():
|
|
| 60 |
dataset = config["datasets"][phase]
|
| 61 |
if device == "cpu":
|
| 62 |
dataset["num_worker_per_gpu"] = 0
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
else:
|
| 65 |
dataset["num_worker_per_gpu"] = 4
|
| 66 |
|
|
@@ -132,7 +134,7 @@ def main():
|
|
| 132 |
# Force torch / BLAS backends to use limited CPU threads for stability
|
| 133 |
for _k in ["OMP_NUM_THREADS", "MKL_NUM_THREADS", "OPENBLAS_NUM_THREADS",
|
| 134 |
"NUMEXPR_NUM_THREADS", "VECLIB_MAXIMUM_THREADS"]:
|
| 135 |
-
env[_k] = "
|
| 136 |
# Disable OpenCV threading and OpenCL runtime (prevents segfaults on Windows)
|
| 137 |
env["OPENCV_OPENCL_RUNTIME"] = "disabled"
|
| 138 |
env["OPENCV_THREAD_LIMIT"] = "1"
|
|
|
|
| 2 |
import sys
|
| 3 |
import cv2
|
| 4 |
import torch
|
| 5 |
+
torch.set_num_threads(8) # Ryzen 7735HS has 8C/16T
|
| 6 |
import yaml
|
| 7 |
import subprocess
|
| 8 |
import glob
|
|
|
|
| 60 |
dataset = config["datasets"][phase]
|
| 61 |
if device == "cpu":
|
| 62 |
dataset["num_worker_per_gpu"] = 0
|
| 63 |
+
# MUST be null on CPU — 'cpu' prefetch spawns multiprocessing
|
| 64 |
+
# workers which cause MemoryError/segfaults on Windows (Task 8).
|
| 65 |
+
dataset["prefetch_mode"] = None
|
| 66 |
else:
|
| 67 |
dataset["num_worker_per_gpu"] = 4
|
| 68 |
|
|
|
|
| 134 |
# Force torch / BLAS backends to use limited CPU threads for stability
|
| 135 |
for _k in ["OMP_NUM_THREADS", "MKL_NUM_THREADS", "OPENBLAS_NUM_THREADS",
|
| 136 |
"NUMEXPR_NUM_THREADS", "VECLIB_MAXIMUM_THREADS"]:
|
| 137 |
+
env[_k] = "8" # Match torch.set_num_threads — Ryzen 7735HS 8C/16T
|
| 138 |
# Disable OpenCV threading and OpenCL runtime (prevents segfaults on Windows)
|
| 139 |
env["OPENCV_OPENCL_RUNTIME"] = "disabled"
|
| 140 |
env["OPENCV_THREAD_LIMIT"] = "1"
|