File size: 1,273 Bytes
b28c738
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""静态核对: 流水路径与同步路径在关键行为上是否一致。"""
P = "/home/haojinw2/rose-bundle-new/verl/recipe/rose/rose_agent_loop.py"
s = open(P).read()
sync = s[s.index("async def _run_sync"): s.index("    # ==================================================================")]
pipe = s[s.index("async def _run_pipelined"):]

checks = [
    ("teacher budget 上限受 response_length 约束", "response_length - len(prefix_ids)" in pipe),
    ("跨词表 splice 走同一函数", "self._splice(" in pipe and "self._splice(" in sync),
    ("train_prefix 分支", "self.train_prefix" in pipe and "self.train_prefix" in sync),
    ("on_early_finish=drop 生效", '"drop"' in pipe or 'item["drop"]' in pipe),
    ("resample 逻辑", "resample" in pipe),
    ("response 截断到 response_length", "[: self.response_length]" in pipe),
    ("seam_shift 上报", "seam_shift" in pipe),
]
for name, ok in checks:
    print(f"  [{'OK' if ok else '缺'}] {name}")

# drop 语义: 同步版 skip 后 teacher_ids 为空 -> mask 全 0; 流水版 tprompt=None -> reply 空 -> 同样全 0
print("\n同步版 drop 处理:", "skip = early_finish and self.on_early_finish" in sync)
print("流水版 drop 处理: tprompt 置 None ->", 'if not drop and prefix_ids:' in s)