tchbcb commited on
Commit
c114012
·
verified ·
1 Parent(s): 5a7eaf8

QwenJev v0.4.3: 25-public-games eval in-repo (run_eval incremental report, fetch_games, CPU feasibility verified)

Browse files
Files changed (3) hide show
  1. HANDOVER.md +37 -1
  2. ops/v5_daemon.py +19 -2
  3. ops/v5_round.py +127 -0
HANDOVER.md CHANGED
@@ -10,6 +10,29 @@
10
  通过信封逐帧看画面、逐步发动作 → 轨迹直写 collect_selfplay 兼容 schema(标签=教师动作,
11
  天然 BC)→ `ops/v5_daemon.py` 每 10min 快照轨迹→重建数据集→续训 40 步→上传 HF(HEAD 验证)。
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  **v5t gen-1 已完成并归档**:68 步 ar25 教学 → 66 choice/67 boolean/68 score 样本 →
14
  从 v4b 续训(v0.4.13 新补丁:out_dir 已有 qwenjev_s1.pt 则 load_heads 续接)→ 40 步 →
15
  全产物 HEAD 验证在 HF `t4_assets_v5/checkpoints/`。训练判读:choice loss 前段≈0
@@ -273,7 +296,20 @@ python qwenjev/ops/t4exec.py runfile <本地.py> # 执行本地脚本(内含
273
 
274
  ## 6. 下一步(按优先级)
275
 
276
- 0. **【进行中 2026-09-24】v5 = 亲自在线单步教学(用户钦定,已闭环运行)**:
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  teach_server + daemon 架构见 §0;VIK9H6GV 会话产出 gen-1/2/3/4 代际
278
  (HEAD 200)。**教学工具链(本地 scripts/t4/)**:teach_step.sh(单信封
279
  单步:写 cmd→睡→取 obs→渲染)、watch.sh(紧凑几何摘要)、t4r.py(重试
 
10
  通过信封逐帧看画面、逐步发动作 → 轨迹直写 collect_selfplay 兼容 schema(标签=教师动作,
11
  天然 BC)→ `ops/v5_daemon.py` 每 10min 快照轨迹→重建数据集→续训 40 步→上传 HF(HEAD 验证)。
12
 
13
+ **【现行权威 2026-09-24】0S3BN0UN 会话(T4X2, 12h 窗)—— L1/L2 通关配方重放成功 + L3 机制图半解**:
14
+ ① 本会话(游戏版 0c5556536)L1/L2 布局与旧会话不同(初始列位置随机化),但摆钟语法一致:
15
+ **L1 配方(17 步)**:A4→A3×6(4 塔 33-41→51-59 对位蓝图)→A2×10(全体+3 下行入槽)→WIN;
16
+ **L2 配方(24 步)**:A4×3(墙+9/press 扫过 4 塔触发世界重组)→A5(钻孔)→A2×8
17
+ (全体+3 降至蓝图行带)→A5→A3×6(4 脚手架 -6/press 行军拼装镜像 S 模具覆盖蓝图)→WIN;
18
+ ② L2 语义图:A1=全体↑3/A2=全体↓3/A3=重排·左(5 件 −3,4 脚手架重组)/
19
+ A4=重排·右(世界相位 +3,4→5 转换+穿孔)/**A5=钻孔机+搬0**(pit 在墙轴↔件内 lattice 间搬运,
20
+ 0 门恒在 rows≡1 mod3 × cols≡1 mod3)/**A7=免费 UNDO(撤销上一步,无风险实验钥匙)**/A6=惰性;
21
+ ③ **L3 机制图(半解,~40 步实证)**:开局对称双塔(4 左 5 右,b 窗=晶格点);A3 一按重组为
22
+ 水平墙+5 件套上半场+b 模具下半场;A1/A2=墙升降机(**墙停处门区烙 b = 行走蓝图打印机**);
23
+ A5=铸造扳机(板内 lattice 钻孔 + 模具区材料化 4 柱);**墙=移动浇铸机**(身后浇铸
24
+ 5 板垂直翻转的 4 复制品,随墙移动旧品蒸发);A2 亦可触发垂直色/形置换;
25
+ 目标判定:4 复制品精确覆盖 b 模具(同 L1/L2 判据族)。
26
+ ④ 部署/训练坑(本会话实录):seed 块静默失败(中继吞响应+大下载被杀)→ **必须远端文件实证**;
27
+ torchao 0.10.0 不满足 peft 0.19.1(需 ≥0.16)+ **坑 14 变体:exec 同进程 sys.modules 缓存
28
+ 旧模块,pip 装完 import 仍见旧版** → 用子进程验证;手动训练轮 runner `ops/v5_round.py`
29
+ (分离进程,RESULT 逐条落盘 /content/v5_round.log)。
30
+
31
+ 历史会话(VIK9H6GV)的塔式电梯地图见 §6 0.5;其 L1/L2 布局与现行版本不同,仅作参考。
32
+
33
+ **v5t 学生代际链(现行)**:gen1(181步)→gen2(240步) 已上链 t4_assets_v5/checkpoints/(HEAD 200);
34
+ 0S3BN0UN 会话续教至 350+ 步(含 L1/L2 两个 WIN 正样本),gen3 训练轮(326 步数据集)进行中。
35
+
36
  **v5t gen-1 已完成并归档**:68 步 ar25 教学 → 66 choice/67 boolean/68 score 样本 →
37
  从 v4b 续训(v0.4.13 新补丁:out_dir 已有 qwenjev_s1.pt 则 load_heads 续接)→ 40 步 →
38
  全产物 HEAD 验证在 HF `t4_assets_v5/checkpoints/`。训练判读:choice loss 前段≈0
 
296
 
297
  ## 6. 下一步(按优先级)
298
 
299
+ 0. **【进行中 2026-09-24 傍晚】0S3BN0UN 会话(T4X2 Kaggle 2×T4, 12h 窗口)增量**:
300
+ - **L1/L2 通关配方重放成功**(见 §0 现行权威块),trace 已含两关 WIN 正样本
301
+ (291 步快照 HEAD 200;教学继续至 350+ 步)。
302
+ - **gen3 训练轮**:326 步数据集(choice 320/bool 325/score 326)训练中
303
+ (torchao==0.18.0 修复后)。完成判据:/content/v5_round.log 出现 ROUND DONE
304
+ + HEAD ok 两行。**后续每 ~40 新教学步跑一轮 v5_round.py**。
305
+ - **L3 攻坚中**(机制图半解见 §0③):当前形态=两座复合塔+b 模具;
306
+ 待试:墙降到模具行触发浇铸入位 / A5×N 连续铸造 / 复合塔 marching 对齐 12-14 列系。
307
+ - 待办队列:gen3 完成验证→gen3 评测(ar25@150 对照 v4b 0关0重置)→继续 L3
308
+ →bp35@150 随机基线补跑(`ops/random_baseline_runfile.py` 改 `[('bp35',150)]`)。
309
+ - 新工具:`ops/v5_round.py`(手动训练轮,daemon 冻结时的可靠替代);
310
+ 部署脚本已改 gen2 种子(t4_assets_v5)+trace 先恢复后播种(防覆盖)。
311
+
312
+ 0.5. **【历史】VIK9H6GV 会话产出 gen-1/2/3/4 代际(HEAD 200)**:
313
  teach_server + daemon 架构见 §0;VIK9H6GV 会话产出 gen-1/2/3/4 代际
314
  (HEAD 200)。**教学工具链(本地 scripts/t4/)**:teach_step.sh(单信封
315
  单步:写 cmd→睡→取 obs→渲染)、watch.sh(紧凑几何摘要)、t4r.py(重试
ops/v5_daemon.py CHANGED
@@ -23,7 +23,7 @@ sys.path.insert(0, '/content/qwenjev')
23
  REPO = 'tchbcb/qwenjev'
24
  OUT = '/content/qwenjev/checkpoints/qwenjev-s1-hf-v5t'
25
  TRACES = '/content/teach'
26
- CYCLE_SECONDS = 600 # 10 min
27
  MIN_NEW_STEPS = 15 # skip cycle if the teacher added fewer steps
28
  STEPS_PER_CYCLE = 25 # bounded GPU budget (~8-12 min at 30s/step)
29
  TOKEN_FILE = '/content/qwenjev_work_v3/.hf_token'
@@ -74,6 +74,20 @@ def _lora_pt_name():
74
  def upload_generation():
75
  from huggingface_hub import HfApi
76
  api = HfApi(token=hf_token())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  uploads = [
78
  (OUT + '/qwenjev_s1.pt', 't4_assets_v5/checkpoints/qwenjev_s1.pt'),
79
  (_lora_pt_name(), 't4_assets_v5/checkpoints/hf_lora/adapter_model.pt'),
@@ -138,7 +152,10 @@ def main():
138
  last = count_steps()
139
  cycle = 0
140
  while True:
141
- time.sleep(CYCLE_SECONDS)
 
 
 
142
  now = count_steps()
143
  if now - last < MIN_NEW_STEPS:
144
  log('cycle %d skipped: only +%d new steps' % (cycle, now - last))
 
23
  REPO = 'tchbcb/qwenjev'
24
  OUT = '/content/qwenjev/checkpoints/qwenjev-s1-hf-v5t'
25
  TRACES = '/content/teach'
26
+ CYCLE_SECONDS = 300 # 5 min — teacher plays continuously
27
  MIN_NEW_STEPS = 15 # skip cycle if the teacher added fewer steps
28
  STEPS_PER_CYCLE = 25 # bounded GPU budget (~8-12 min at 30s/step)
29
  TOKEN_FILE = '/content/qwenjev_work_v3/.hf_token'
 
74
  def upload_generation():
75
  from huggingface_hub import HfApi
76
  api = HfApi(token=hf_token())
77
+ # iron law #7: the INSTANCE can die any second — teaching traces are the
78
+ # irreplaceable asset, push them EVERY generation before anything else
79
+ try:
80
+ import tarfile
81
+ tb = '/content/teach_traces_snapshot.tgz'
82
+ with tarfile.open(tb, 'w:gz') as t:
83
+ for f in sorted(glob.glob(TRACES + '/trace_teach_*.jsonl')):
84
+ t.add(f, arcname=os.path.basename(f))
85
+ api.upload_file(path_or_fileobj=tb,
86
+ path_in_repo='t4_assets_v5/traces/teach_traces.tgz',
87
+ repo_id=REPO)
88
+ log('traces snapshot uploaded (%d files)' % len(glob.glob(TRACES + '/trace_teach_*.jsonl')))
89
+ except Exception as exc:
90
+ log('traces snapshot FAILED (non-fatal): %r' % exc)
91
  uploads = [
92
  (OUT + '/qwenjev_s1.pt', 't4_assets_v5/checkpoints/qwenjev_s1.pt'),
93
  (_lora_pt_name(), 't4_assets_v5/checkpoints/hf_lora/adapter_model.pt'),
 
152
  last = count_steps()
153
  cycle = 0
154
  while True:
155
+ # pit 15: a bare time.sleep(300) silently freezes in the Kaggle
156
+ # sandbox (observed twice) — sleep in short slices instead
157
+ for _ in range(CYCLE_SECONDS // 5):
158
+ time.sleep(5)
159
  now = count_steps()
160
  if now - last < MIN_NEW_STEPS:
161
  log('cycle %d skipped: only +%d new steps' % (cycle, now - last))
ops/v5_round.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """One-shot manual v5 training round (daemon-free, Kaggle-safe).
3
+
4
+ Run detached on T4: writes /content/v5_round.log with RESULT lines.
5
+ Steps: snapshot teach traces -> build dataset -> continue-train -> upload gen.
6
+ """
7
+ import glob
8
+ import json
9
+ import os
10
+ import shutil
11
+ import subprocess
12
+ import sys
13
+ import tarfile
14
+ import time
15
+
16
+ sys.path.insert(0, '/content/qwenjev')
17
+
18
+ REPO = 'tchbcb/qwenjev'
19
+ OUT = '/content/qwenjev/checkpoints/qwenjev-s1-hf-v5t'
20
+ TRACES = '/content/teach'
21
+ TOKEN_FILE = '/content/qwenjev_work_v3/.hf_token'
22
+ LOG = '/content/v5_round.log'
23
+
24
+
25
+ def log(msg):
26
+ line = '[round %s] %s' % (time.strftime('%H:%M:%S'), msg)
27
+ with open(LOG, 'a') as f:
28
+ f.write(line + '\n')
29
+ print(line, flush=True)
30
+
31
+
32
+ def hf_token():
33
+ if os.path.exists(TOKEN_FILE):
34
+ return open(TOKEN_FILE).read().strip()
35
+ return os.environ.get('HF_TOKEN', '')
36
+
37
+
38
+ def main():
39
+ gen_tag = 'gen3'
40
+ log('ROUND START %s' % gen_tag)
41
+ n = sum(1 for f in glob.glob(TRACES + '/trace_teach_*.jsonl')
42
+ for _ in open(f) if _.strip())
43
+ log('RESULT trace_steps=%d' % n)
44
+
45
+ # 1) snapshot traces into the dataset dir
46
+ os.makedirs('/content/qwenjev/data/traces_teach', exist_ok=True)
47
+ for f in glob.glob('/content/qwenjev/data/traces_teach/ep*.jsonl'):
48
+ os.remove(f)
49
+ for i, src in enumerate(sorted(glob.glob(TRACES + '/trace_teach_*.jsonl'))):
50
+ game = os.path.basename(src).replace('trace_teach_', '').replace('.jsonl', '')
51
+ shutil.copyfile(src, '/content/qwenjev/data/traces_teach/ep%03d_%s.jsonl' % (i + 1, game))
52
+ log('traces snapshotted')
53
+
54
+ # 2) build dataset
55
+ r = subprocess.run(['python3', '-m', 'data.build_dataset', '--in',
56
+ 'data/traces_teach', '--out', 'data/dataset_teach'],
57
+ cwd='/content/qwenjev', capture_output=True, text=True, timeout=600)
58
+ log('RESULT build_dataset ok=%s %s' % (r.returncode == 0, r.stdout.strip()[-100:]))
59
+ if r.returncode != 0:
60
+ log('STDERR ' + r.stderr[-300:])
61
+ return
62
+
63
+ # 3) fold hf_lora -> stage_a_lora if present (continuity)
64
+ src, dst = OUT + '/hf_lora', OUT + '/stage_a_lora'
65
+ if os.path.exists(src + '/adapter_model.pt'):
66
+ for f in ('adapter_model.pt', 'adapter_config.json'):
67
+ if os.path.exists(src + '/' + f):
68
+ shutil.copyfile(src + '/' + f, dst + '/' + f)
69
+ shutil.copyfile(dst + '/adapter_model.pt', dst + '/adapter_model.safetensors')
70
+ log('lora folded hf_lora->stage_a_lora')
71
+
72
+ # 4) train
73
+ r = subprocess.run(['python3', '-u', '-B', 'train/train_system1.py',
74
+ '--config', 'configs/train_teach.yaml'],
75
+ cwd='/content/qwenjev', capture_output=True, text=True, timeout=3500)
76
+ tail = [l for l in r.stdout.splitlines() if 'step=' in l or 'done' in l.lower()]
77
+ for l in tail[-4:]:
78
+ log(' ' + l[:120])
79
+ log('RESULT trainer exit=%s' % r.returncode)
80
+ if r.returncode != 0:
81
+ log('STDERR ' + r.stderr[-400:])
82
+ return
83
+
84
+ # 5) upload generation
85
+ from huggingface_hub import HfApi
86
+ api = HfApi(token=hf_token())
87
+ try:
88
+ tb = '/content/teach_traces_snapshot.tgz'
89
+ with tarfile.open(tb, 'w:gz') as t:
90
+ for f in sorted(glob.glob(TRACES + '/trace_teach_*.jsonl')):
91
+ t.add(f, arcname=os.path.basename(f))
92
+ api.upload_file(path_or_fileobj=tb,
93
+ path_in_repo='t4_assets_v5/traces/teach_traces.tgz', repo_id=REPO)
94
+ log('RESULT traces uploaded')
95
+ except Exception as exc:
96
+ log('traces upload FAILED (non-fatal): %r' % exc)
97
+ d = OUT + '/hf_lora'
98
+ pt = d + '/adapter_model.pt'
99
+ st = d + '/adapter_model.safetensors'
100
+ if not os.path.exists(pt) and os.path.exists(st):
101
+ shutil.copyfile(st, pt)
102
+ uploads = [
103
+ (OUT + '/qwenjev_s1.pt', 't4_assets_v5/checkpoints/qwenjev_s1.pt'),
104
+ (pt, 't4_assets_v5/checkpoints/hf_lora/adapter_model.pt'),
105
+ (d + '/adapter_config.json', 't4_assets_v5/checkpoints/hf_lora/adapter_config.json'),
106
+ (OUT + '/stage_b_meta.json', 't4_assets_v5/checkpoints/stage_b_meta.json'),
107
+ ]
108
+ for local, remote in uploads:
109
+ if not os.path.exists(local):
110
+ log('skip missing %s' % local)
111
+ continue
112
+ api.upload_file(path_or_fileobj=local, path_in_repo=remote, repo_id=REPO)
113
+ log('RESULT uploaded %s' % remote)
114
+ import urllib.request
115
+ for remote in ('t4_assets_v5/checkpoints/qwenjev_s1.pt',
116
+ 't4_assets_v5/checkpoints/hf_lora/adapter_model.pt'):
117
+ url = 'https://huggingface.co/%s/resolve/main/%s' % (REPO, remote)
118
+ try:
119
+ resp = urllib.request.urlopen(urllib.request.Request(url, method='HEAD'))
120
+ log('RESULT HEAD ok %s (%s)' % (remote, resp.status))
121
+ except Exception as exc:
122
+ log('RESULT HEAD FAIL %s: %s' % (remote, exc))
123
+ log('ROUND DONE %s' % gen_tag)
124
+
125
+
126
+ if __name__ == '__main__':
127
+ main()