numpy 2.5でMCTS探索中にプロセスが異常終了する問題を修正#122
Merged
Merged
Conversation
positional_hashは長さ1のnumpy配列で、スカラー枠への配列代入は numpy 2.5からValueErrorに格上げされたため、探索中にプロセスが 異常終了する。配列から中身のスカラーを取り出して代入するよう修正。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kobanium
approved these changes
Jul 6, 2026
Owner
|
原因調査から修正、動作確認までしていただきありがとうございます。 |
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.
問題
numpy 2.5 以降の環境で、着手を記録する際に
ValueError: setting an array element with a sequence.が発生し、探索中にエンジンのプロセスが異常終了します(GTP経由で使っている場合は engine died に見えます)。原因
GoBoard.positional_hashは長さ1のnumpy配列(np.zeros(1, dtype=np.uint64))ですが、Record.saveがこれをself.hash_value[moves](スカラー要素)へそのまま代入しています。この「長さ1配列→スカラー要素」の代入は numpy 2.0 までは非推奨警告つきで許容されていましたが、numpy 2.5 で ValueError に変更されました。requirements.txtの指定がnumpy>=1.19.5のため、新しい環境では numpy 2.5 が入りこの問題が顕在化します。修正
配列から中身のスカラー(
hash_value[0])を取り出して代入するようにしました。どのnumpyバージョンでも正しく動作します。検証
put_stoneで ValueError → 修正後は正常動作