Zeta36 / chess-alpha-zero

Chess reinforcement learning by AlphaGo Zero methods.
MIT License
2.13k stars 480 forks source link

AttributeError: module 'chess.pgn' has no attribute 'scan_offsets' #84

Open CasellaJr opened 4 years ago

CasellaJr commented 4 years ago

Hello everyone

I want to run this project and see how works the training When I run this: python src/chess_zero/run.py sl I receive this: 2019-12-09 22:46:36,750@chess_zero.manager INFO # config type: mini ['C:\\Users\\Dell\\Desktop\\chess-alpha-zero-master\\data\\play_data\\ficsgamesdb_201901_standard2000_nomovetimes_103890.pgn'] Traceback (most recent call last): File "src/chess_zero/run.py", line 20, in <module> manager.start() File "src\chess_zero\manager.py", line 73, in start return sl.start(config) File "src\chess_zero\worker\sl.py", line 25, in start return SupervisedLearningWorker(config).start() File "src\chess_zero\worker\sl.py", line 55, in start games = self.get_games_from_all_files() File "src\chess_zero\worker\sl.py", line 79, in get_games_from_all_files games.extend(get_games_from_file(filename)) File "src\chess_zero\worker\sl.py", line 114, in get_games_from_file offsets = list(chess.pgn.scan_offsets(pgn)) AttributeError: module 'chess.pgn' has no attribute 'scan_offsets'

Browsing on Google, I found this link in which there is written: "chess.pgn.scan_headers() and chess.pgn.scan_offsets() have been removed. Instead the new functions chess.pgn.read_headers() and chess.pgn.skip_game() can be used for a similar purpose."

So, i went in src/chess-zero/worker and I tried to edit the sl file, replacing the function scan_offsets() with skip_game(), but i have a different error now: 2019-12-09 23:05:27,292@chess_zero.manager INFO # config type: mini ['C:\\Users\\Dell\\Desktop\\C0\\data\\play_data\\ficsgamesdb_201901_standard2000_nomovetimes_103890.pgn'] Traceback (most recent call last): File "src/chess_zero/run.py", line 20, in <module> manager.start() File "src\chess_zero\manager.py", line 73, in start return sl.start(config) File "src\chess_zero\worker\sl.py", line 25, in start return SupervisedLearningWorker(config).start() File "src\chess_zero\worker\sl.py", line 55, in start games = self.get_games_from_all_files() File "src\chess_zero\worker\sl.py", line 79, in get_games_from_all_files games.extend(get_games_from_file(filename)) File "src\chess_zero\worker\sl.py", line 114, in get_games_from_file offsets = list(chess.pgn.skip_game(pgn)) TypeError: 'bool' object is not iterable

What can I do?

DailyMeme commented 4 years ago

The issue you mentioned is also addressed in: https://github.com/Zeta36/chess-alpha-zero/issues/78 For now the solution is to downgrade python-chess (for me it's 0.23.10) until a way has been found to correctly rewrite it.