解析出力が未反映のミニバッチを含まず、探索回数がバッチサイズ未満のときゼロ除算で異常終了する問題を修正 - #124
Open
hechima256 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
cgos-genmove_analyze / cgos-analyze の応答生成時に、探索結果が1つも反映されていないと ZeroDivisionError でエンジンが異常終了します (GTP 経由では engine died に見えます)。
発生条件 (いずれも v0.11.1 で再現確認済み):
--const-time 1〜3+--batch-size 64: プロセス最初の1手で必ず発生します。探索速度の初期値が 20 visits/s のため初手の探索予算が 20〜60 となり、バッチサイズ 64 に届きません (2手目以降は実測速度に較正されるため初手のみ)--time) の時間切迫時: 探索予算 = 実測速度 × 残り時間/10 のため、残り時間が 640/実測速度 秒 (実測 806 visits/s の環境で約0.8秒) を切ると発生します。時間切れ寸前の負けかけの局面ですが、時間切れ負けと違いエンジンごと落ちるため、連続対局の残りが全て失われます--visits< バッチサイズ: 最小再現 (--visits 4 --batch-size 8など)原因
探索ループはミニバッチが満杯になったときだけ process_mini_batch を呼ぶため、ループ終了時に最大 batch_size − 1 プレイアウトが未反映のままキューに残ります。search() の解析出力 (interval == 0) はこの反映より前に実行されるため:
--visits 100 --batch-size 8で visits:96 と報告される)修正
検証 (v0.11.1、Python 3.13 / torch 2.10)
--const-time 1 --batch-size 64で{"winrate":...,"visits":20,...})--visits 100 --batch-size 8: 報告 visits が 96 → 100 になり、全探索が反映されることを確認🤖 Generated with Claude Code