google-deepmind / ferminet

An implementation of the Fermionic Neural Network for ab-initio electronic structure calculations
Apache License 2.0
740 stars 129 forks source link

Issue on running pytest #62

Closed SLZ0106 closed 1 year ago

SLZ0106 commented 1 year ago

Based on the guidance, I have already installed the ferminet, but I still have issues when running the pytest.

The error is below: ========== short test summary info=============== ERROR ferminet/pbc/tests/features_test.py - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type' ERROR ferminet/pbc/tests/hamiltonian_test.py - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type' ERROR ferminet/tests/envelopes_test.py - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type' ERROR ferminet/tests/hamiltonian_test.py - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type' ERROR ferminet/tests/networks_test.py - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type' ERROR ferminet/tests/psiformer_test.py - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type' ERROR ferminet/tests/train_test.py - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type'

My python version is 3.9.13 And I use Ubuntu 22.04.2 LTS to run the code, is there any reason lead to this problem?

jsspencer commented 1 year ago

Hard to know without a full stack trace from one of the tests, but I suspect ferminet needs a python 3.10 or 3.11 (I don't have versions older than 3.11 to hand to check, unfortunately).

SLZ0106 commented 1 year ago

Hi I have updated python to 3.10.6, but new error occurs in ferminet/tests/train_test.py.

======================================================================= short test summary info =======================================================================FAILED ferminet/tests/train_test.py::QmcTest::test_training_step0 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcTest::test_training_step1 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcTest::test_training_step4 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcTest::test_training_step5 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcTest::test_training_step8 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcPyscfMolTest::test_schnet_training_step0 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcPyscfMolTest::test_schnet_training_step1 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcPyscfMolTest::test_schnet_training_step2 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcPyscfMolTest::test_schnet_training_step3 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcPyscfMolTest::test_schnet_training_step4 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name' FAILED ferminet/tests/train_test.py::QmcPyscfMolTest::test_training_step_pyscf1 - TypeError: RepeatedDenseBlock.update_curvature_matrix_estimate() missing 1 required positional argument: 'pmap_axis_name'

jsspencer commented 1 year ago

This is due to a minor API change in KFAC. I pushed an update fixing this.

SLZ0106 commented 1 year ago

Thanks a lot, it is solved. But one more interesting thing I would like to know is that in which part of the code represents the optimization of the wave function (because I am majoring in Computer Science so I cannot fully understand the paper and the code). Many Thanks!

jsspencer commented 1 year ago

The training loop is in ferminet/train.py - the training step with KFAC is created in make_kfac_training_step [https://github.com/deepmind/ferminet/blob/main/ferminet/train.py#L280], though the training step using optax optimizers are more accessible if you wish to read the entire code.