Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Warning Behavior in test_extra_constraint_integration and test_invalid_loss_stopping: Only Passes on First Run #1935

Open
yuetingLuo opened this issue Sep 26, 2024 · 3 comments

Comments

@yuetingLuo
Copy link

I encountered an issue while running the development version of NetKet using pytest. When I run the test suite 50 times, the test_extra_constraint_integration test consistently fails after the first run. The first run always passes, but subsequent runs fail with the "DID NOT WARN" error, even though the expected warning should have been emitted. The error message is as follows:
image

The same issue also occurs with the test_invalid_loss_stopping test, where it consistently fails after the first run. image

Environment Details:
Python version: 3.11.7
NetKet version: Main branch
OS: Ubuntu 20.04 (in WSL)

Please let me know if more information is required to diagnose this issue.

@PhilipVinc
Copy link
Member

Hi.
Could you please paste the output (not a screenshot, please) of the command python -m netket.tools.info ran from the folder where you have netket?

Also, could you also try running pytest -n0 --jax-cpu-disable-async-dispatch test/hilbert/test_custom_constraint.py and tell me me what is the error (pasting it)

@yuetingLuo
Copy link
Author

Hi,

Below is the information by running command python -m netket.tools.info

  • NetKet Diagnostic Information
    NetKet version : 3.14.1

  • Python

    • implementation : CPython
    • version : 3.11.7
    • distribution : GCC 11.2.0
    • path : /home/issac/anaconda3/bin/python
  • Host information

    • System : Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
    • Architecture : x86_64
    • AVX : True
    • AVX2 : True
    • Cores : 8
  • NetKet dependencies

    • numpy : 1.26.4
    • jaxlib : 0.4.31
    • jax : 0.4.31
    • equinox : 0.11.5
    • flax : 0.9.0
    • optax : 0.2.3
    • numba : 0.59.0
    • mpi4py : unavailable
    • mpi4jax : unavailable
    • netket : 3.14.1
  • Jax
    An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.

    • backends : ['cpu']
      • cpu : ['<0: cpu>']

After run JAX_CPU_ASYNC_DISPATCH=False pytest -n0 test/hilbert/test_custom_constraint.py, the output is:
============================================== test session starts ==============================================
platform linux -- Python 3.11.7, pytest-8.3.3, pluggy-1.5.0 -- /home/issac/anaconda3/bin/python3.11
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/home/issac/luoluoworkbench/netket/.hypothesis/examples'))
rootdir: /home/issac/luoluoworkbench/netket
configfile: pyproject.toml
plugins: repeat-0.9.3, anyio-4.6.0, jaxtyping-0.2.34, typeguard-2.13.3, xdist-3.6.1, hypothesis-6.112.1
collected 7 items

test/hilbert/test_custom_constraint.py::test_sum_constraint PASSED [ 14%]
test/hilbert/test_custom_constraint.py::test_sum_partition_constraint PASSED [ 28%]
test/hilbert/test_custom_constraint.py::test_extra_constraint PASSED [ 42%]
test/hilbert/test_custom_constraint.py::test_extra_constraint_integration PASSED [ 57%]
test/hilbert/test_custom_constraint.py::test_hilbert_extra_constraint PASSED [ 71%]
test/hilbert/test_custom_constraint.py::test_constraint_interface_errors PASSED [ 85%]
test/hilbert/test_custom_constraint.py::test_extra_constraint_spin_orbital_fermion PASSED [100%]

============================================= slowest 50 durations ==============================================
3.04s call test/hilbert/test_custom_constraint.py::test_extra_constraint_integration
0.76s call test/hilbert/test_custom_constraint.py::test_extra_constraint_spin_orbital_fermion

(19 durations < 0.005s hidden. Use -vv to show these durations.)
=============================================== 7 passed in 4.06s ===============================================

@PhilipVinc
Copy link
Member

So it seems that it's working? What was failing exactly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants