File size: 1,029 Bytes
53f0cc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Quick verification for Component 9 LoRA pipeline.
Runs a tiny 5-step smoke fine-tune.
"""

from __future__ import annotations

import sys
from pathlib import Path

import yaml

# Ensure imports work.
PROJECT_ROOT = Path(__file__).resolve().parents[1]
if str(PROJECT_ROOT) not in sys.path:
    sys.path.insert(0, str(PROJECT_ROOT))

from scripts.run_component9_lora_finetune import main as lora_main  # noqa: E402


if __name__ == "__main__":
    cfg_path = PROJECT_ROOT / "configs" / "component9_lora_config.yaml"
    cfg = yaml.safe_load(cfg_path.read_text(encoding="utf-8-sig"))
    cfg["finetune"]["max_steps"] = 5
    cfg["finetune"]["save_every"] = 5
    cfg["finetune"]["eval_every"] = 5
    cfg["resume"]["resume_from"] = "none"
    tmp = PROJECT_ROOT / "configs" / "component9_lora_config.verify.yaml"
    tmp.write_text(yaml.safe_dump(cfg, sort_keys=False), encoding="utf-8-sig")

    sys.argv = ["verify_component9_lora.py", "--config", str(tmp)]
    lora_main()
    print("\nComponent 9 verification passed.")