official-stockfish/nnue-pytorch

conda issue, recent Pytorch support

jdart1 opened this issue · 0 comments

Trying to run this under Anaconda with the supplied requrirements.txt, I am getting an exception. I have tried a couple different Anaconda releases, most recently Anaconda3-2023.03-1, based on Python 3.10.

Traceback (most recent call last):
  File "/home/jdart/chess/stockfish-pytorch/nnue-pytorch/train.py", line 175, in <module>
    main()
  File "/home/jdart/chess/stockfish-pytorch/nnue-pytorch/train.py", line 146, in main
    checkpoint_callback = pl.callbacks.ModelCheckpoint(save_last=args.save_last_network, every_n_epochs=args.network_save_period, save_top_k=-1)
  File "/home/jdart/miniconda3/envs/nnue/lib/python3.11/site-packages/pytorch_lightning/callbacks/model_checkpoint.py", line 242, in __init__
    self.__init_monitor_mode(mode)
  File "/home/jdart/miniconda3/envs/nnue/lib/python3.11/site-packages/pytorch_lightning/callbacks/model_checkpoint.py", line 446, in __init_monitor_mo\
de
    torch_inf = torch.tensor(np.Inf)
                             ^^^^^^
  File "/home/jdart/miniconda3/envs/nnue/lib/python3.11/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.Inf` was removed in the NumPy 2.0 release. Use `np.inf` instead.. Did you mean: 'inf'?

downgrading numpy to 1.26.4 seems to work. This should be specified in the requirements.txt.

Eventually, this code should support numpy 2.x, which would also require torch>=2.3.0. However, you can't upgrade to this pytorch version w/o code changes because the compatible pytorch-lightning has breaking changes, notably in command-line parsing (uses .yml config files now).