NetKet 3.11.4__tar.gz → 3.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. {netket-3.11.4 → netket-3.12.0}/PKG-INFO +8 -7
  2. {netket-3.11.4 → netket-3.12.0}/netket/_version.py +2 -2
  3. {netket-3.11.4 → netket-3.12.0}/netket/callbacks/convergence_stopping.py +23 -8
  4. {netket-3.11.4 → netket-3.12.0}/netket/callbacks/earlystopping.py +41 -10
  5. {netket-3.11.4 → netket-3.12.0}/netket/callbacks/invalidlossstopping.py +24 -5
  6. {netket-3.11.4 → netket-3.12.0}/netket/callbacks/timeout.py +14 -9
  7. {netket-3.11.4 → netket-3.12.0}/netket/driver/abstract_variational_driver.py +54 -41
  8. {netket-3.11.4 → netket-3.12.0}/netket/experimental/driver/tdvp_common.py +47 -38
  9. {netket-3.11.4 → netket-3.12.0}/netket/experimental/driver/tdvp_schmitt.py +2 -0
  10. {netket-3.11.4 → netket-3.12.0}/netket/experimental/driver/vmc_srt.py +5 -3
  11. {netket-3.11.4 → netket-3.12.0}/netket/experimental/dynamics/_rk_solver_structures.py +1 -8
  12. {netket-3.11.4 → netket-3.12.0}/netket/experimental/hilbert/spin_orbital_fermions.py +7 -1
  13. {netket-3.11.4 → netket-3.12.0}/netket/experimental/models/__init__.py +1 -1
  14. {netket-3.11.4 → netket-3.12.0}/netket/experimental/operator/_fermion_operator_2nd_jax.py +9 -2
  15. {netket-3.11.4 → netket-3.12.0}/netket/experimental/sampler/metropolis_pt.py +222 -102
  16. {netket-3.11.4 → netket-3.12.0}/netket/experimental/sampler/rules/fermion_2nd.py +8 -4
  17. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/abstract_hilbert.py +2 -5
  18. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/custom_hilbert.py +36 -24
  19. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/discrete_hilbert.py +39 -105
  20. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/doubled_hilbert.py +10 -16
  21. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/fock.py +7 -14
  22. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/homogeneous.py +86 -66
  23. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/index/__init__.py +4 -3
  24. netket-3.12.0/netket/hilbert/index/base.py +67 -0
  25. netket-3.12.0/netket/hilbert/index/constraints/__init__.py +2 -0
  26. netket-3.12.0/netket/hilbert/index/constraints/base.py +158 -0
  27. netket-3.12.0/netket/hilbert/index/constraints/sum.py +127 -0
  28. netket-3.12.0/netket/hilbert/index/unconstrained.py +64 -0
  29. netket-3.12.0/netket/hilbert/index/uniform_tensor.py +69 -0
  30. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/qubit.py +3 -4
  31. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/random/base.py +5 -0
  32. netket-3.12.0/netket/hilbert/random/fock.py +141 -0
  33. netket-3.12.0/netket/hilbert/random/spin.py +87 -0
  34. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/spin.py +8 -16
  35. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/tensor_hilbert.py +12 -12
  36. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/tensor_hilbert_discrete.py +27 -46
  37. {netket-3.11.4 → netket-3.12.0}/netket/jax/__init__.py +3 -1
  38. {netket-3.11.4 → netket-3.12.0}/netket/jax/_jacobian/logic.py +2 -1
  39. netket-3.12.0/netket/jax/_sort.py +121 -0
  40. {netket-3.11.4 → netket-3.12.0}/netket/jax/_vjp_chunked.py +1 -3
  41. {netket-3.11.4 → netket-3.12.0}/netket/jax/sharding.py +105 -21
  42. {netket-3.11.4 → netket-3.12.0}/netket/models/__init__.py +3 -2
  43. {netket-3.11.4 → netket-3.12.0}/netket/models/full_space.py +1 -2
  44. netket-3.12.0/netket/models/slater.py +294 -0
  45. netket-3.12.0/netket/models/tensor_networks/__init__.py +20 -0
  46. netket-3.12.0/netket/models/tensor_networks/mpdo.py +284 -0
  47. netket-3.12.0/netket/models/tensor_networks/mps.py +240 -0
  48. {netket-3.11.4 → netket-3.12.0}/netket/nn/__init__.py +0 -1
  49. {netket-3.11.4 → netket-3.12.0}/netket/nn/symmetric_linear.py +1 -1
  50. {netket-3.11.4 → netket-3.12.0}/netket/nn/utils.py +6 -26
  51. {netket-3.11.4 → netket-3.12.0}/netket/operator/__init__.py +1 -1
  52. netket-3.12.0/netket/operator/_bose_hubbard/__init__.py +17 -0
  53. netket-3.12.0/netket/operator/_bose_hubbard/base.py +221 -0
  54. netket-3.12.0/netket/operator/_bose_hubbard/jax.py +143 -0
  55. netket-3.11.4/netket/operator/_bose_hubbard.py → netket-3.12.0/netket/operator/_bose_hubbard/numba.py +38 -117
  56. {netket-3.11.4 → netket-3.12.0}/netket/operator/_discrete_operator_jax.py +2 -3
  57. {netket-3.11.4 → netket-3.12.0}/netket/operator/_graph_operator.py +1 -1
  58. {netket-3.11.4 → netket-3.12.0}/netket/operator/_ising/jax.py +10 -3
  59. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_operator/base.py +18 -4
  60. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_operator/convert.py +4 -2
  61. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_operator/jax.py +17 -4
  62. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/linear_operator.py +3 -0
  63. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/preconditioner.py +13 -3
  64. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/qgt_jacobian_dense.py +2 -1
  65. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/qgt_jacobian_pytree.py +2 -1
  66. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/qgt_onthefly.py +4 -2
  67. {netket-3.11.4 → netket-3.12.0}/netket/sampler/__init__.py +0 -1
  68. {netket-3.11.4 → netket-3.12.0}/netket/sampler/base.py +2 -3
  69. {netket-3.11.4 → netket-3.12.0}/netket/sampler/exact.py +1 -20
  70. {netket-3.11.4 → netket-3.12.0}/netket/sampler/metropolis.py +21 -51
  71. {netket-3.11.4 → netket-3.12.0}/netket/sampler/metropolis_numpy.py +1 -3
  72. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/exchange.py +7 -6
  73. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/hamiltonian.py +59 -47
  74. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/multiple.py +9 -3
  75. {netket-3.11.4 → netket-3.12.0}/netket/tools/info.py +1 -0
  76. {netket-3.11.4 → netket-3.12.0}/netket/utils/__init__.py +14 -1
  77. {netket-3.11.4 → netket-3.12.0}/netket/utils/_dependencies_check.py +2 -12
  78. {netket-3.11.4 → netket-3.12.0}/netket/utils/config_flags.py +38 -2
  79. netket-3.12.0/netket/utils/display/__init__.py +15 -0
  80. netket-3.12.0/netket/utils/display/repr.py +56 -0
  81. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/_permutation_group.py +5 -1
  82. netket-3.12.0/netket/utils/mpi/gpu_autorank_util.py +134 -0
  83. {netket-3.11.4 → netket-3.12.0}/netket/utils/mpi/mpi.py +14 -0
  84. netket-3.12.0/netket/utils/static_range.py +236 -0
  85. netket-3.12.0/netket/utils/timing.py +236 -0
  86. {netket-3.11.4 → netket-3.12.0}/netket/vqs/full_summ/state.py +3 -6
  87. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/common.py +2 -1
  88. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/expect_forces_chunked.py +1 -1
  89. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/expect_grad.py +0 -8
  90. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/state.py +39 -34
  91. {netket-3.11.4 → netket-3.12.0}/pyproject.toml +14 -11
  92. netket-3.11.4/netket/hilbert/index/base.py +0 -48
  93. netket-3.11.4/netket/hilbert/index/constrained.py +0 -118
  94. netket-3.11.4/netket/hilbert/index/unconstrained.py +0 -115
  95. netket-3.11.4/netket/hilbert/random/fock.py +0 -75
  96. netket-3.11.4/netket/hilbert/random/spin.py +0 -118
  97. netket-3.11.4/netket/models/mps.py +0 -176
  98. netket-3.11.4/netket/models/slater.py +0 -135
  99. {netket-3.11.4 → netket-3.12.0}/.gitignore +0 -0
  100. {netket-3.11.4 → netket-3.12.0}/LICENSE +0 -0
  101. {netket-3.11.4 → netket-3.12.0}/README.md +0 -0
  102. {netket-3.11.4 → netket-3.12.0}/netket/__init__.py +0 -0
  103. {netket-3.11.4 → netket-3.12.0}/netket/callbacks/__init__.py +0 -0
  104. {netket-3.11.4 → netket-3.12.0}/netket/driver/__init__.py +0 -0
  105. {netket-3.11.4 → netket-3.12.0}/netket/driver/steady_state.py +0 -0
  106. {netket-3.11.4 → netket-3.12.0}/netket/driver/vmc.py +0 -0
  107. {netket-3.11.4 → netket-3.12.0}/netket/driver/vmc_common.py +0 -0
  108. {netket-3.11.4 → netket-3.12.0}/netket/errors.py +0 -0
  109. {netket-3.11.4 → netket-3.12.0}/netket/exact.py +0 -0
  110. {netket-3.11.4 → netket-3.12.0}/netket/experimental/__init__.py +0 -0
  111. {netket-3.11.4 → netket-3.12.0}/netket/experimental/driver/__init__.py +0 -0
  112. {netket-3.11.4 → netket-3.12.0}/netket/experimental/driver/tdvp.py +0 -0
  113. {netket-3.11.4 → netket-3.12.0}/netket/experimental/dynamics/__init__.py +0 -0
  114. {netket-3.11.4 → netket-3.12.0}/netket/experimental/dynamics/_rk_solver.py +0 -0
  115. {netket-3.11.4 → netket-3.12.0}/netket/experimental/dynamics/_rk_tableau.py +0 -0
  116. {netket-3.11.4 → netket-3.12.0}/netket/experimental/hilbert/__init__.py +0 -0
  117. {netket-3.11.4 → netket-3.12.0}/netket/experimental/logging/__init__.py +0 -0
  118. {netket-3.11.4 → netket-3.12.0}/netket/experimental/logging/hdf5_log.py +0 -0
  119. {netket-3.11.4 → netket-3.12.0}/netket/experimental/models/fast_rnn.py +0 -0
  120. {netket-3.11.4 → netket-3.12.0}/netket/experimental/models/rnn.py +0 -0
  121. {netket-3.11.4 → netket-3.12.0}/netket/experimental/nn/__init__.py +0 -0
  122. {netket-3.11.4 → netket-3.12.0}/netket/experimental/nn/rnn/__init__.py +0 -0
  123. {netket-3.11.4 → netket-3.12.0}/netket/experimental/nn/rnn/cells.py +0 -0
  124. {netket-3.11.4 → netket-3.12.0}/netket/experimental/nn/rnn/layers.py +0 -0
  125. {netket-3.11.4 → netket-3.12.0}/netket/experimental/nn/rnn/layers_fast.py +0 -0
  126. {netket-3.11.4 → netket-3.12.0}/netket/experimental/nn/rnn/ordering.py +0 -0
  127. {netket-3.11.4 → netket-3.12.0}/netket/experimental/observable/__init__.py +0 -0
  128. {netket-3.11.4 → netket-3.12.0}/netket/experimental/observable/renyi2/S2_operator.py +0 -0
  129. {netket-3.11.4 → netket-3.12.0}/netket/experimental/observable/renyi2/__init__.py +0 -0
  130. {netket-3.11.4 → netket-3.12.0}/netket/experimental/observable/renyi2/exact.py +0 -0
  131. {netket-3.11.4 → netket-3.12.0}/netket/experimental/observable/renyi2/expect.py +0 -0
  132. {netket-3.11.4 → netket-3.12.0}/netket/experimental/operator/__init__.py +0 -0
  133. {netket-3.11.4 → netket-3.12.0}/netket/experimental/operator/_fermion_operator_2nd_base.py +0 -0
  134. {netket-3.11.4 → netket-3.12.0}/netket/experimental/operator/_fermion_operator_2nd_numba.py +0 -0
  135. {netket-3.11.4 → netket-3.12.0}/netket/experimental/operator/_fermion_operator_2nd_utils.py +0 -0
  136. {netket-3.11.4 → netket-3.12.0}/netket/experimental/operator/fermion.py +0 -0
  137. {netket-3.11.4 → netket-3.12.0}/netket/experimental/operator/pyscf.py +0 -0
  138. {netket-3.11.4 → netket-3.12.0}/netket/experimental/qsr/__init__.py +0 -0
  139. {netket-3.11.4 → netket-3.12.0}/netket/experimental/qsr/dataset.py +0 -0
  140. {netket-3.11.4 → netket-3.12.0}/netket/experimental/qsr/driver.py +0 -0
  141. {netket-3.11.4 → netket-3.12.0}/netket/experimental/qsr/logic_helpers.py +0 -0
  142. {netket-3.11.4 → netket-3.12.0}/netket/experimental/sampler/__init__.py +0 -0
  143. {netket-3.11.4 → netket-3.12.0}/netket/experimental/sampler/metropolis.py +0 -0
  144. {netket-3.11.4 → netket-3.12.0}/netket/experimental/sampler/metropolis_pmap.py +0 -0
  145. {netket-3.11.4 → netket-3.12.0}/netket/experimental/sampler/rules/__init__.py +0 -0
  146. {netket-3.11.4 → netket-3.12.0}/netket/experimental/vqs/__init__.py +0 -0
  147. {netket-3.11.4 → netket-3.12.0}/netket/experimental/vqs/io.py +0 -0
  148. {netket-3.11.4 → netket-3.12.0}/netket/graph/__init__.py +0 -0
  149. {netket-3.11.4 → netket-3.12.0}/netket/graph/_lattice_edge_logic.py +0 -0
  150. {netket-3.11.4 → netket-3.12.0}/netket/graph/abstract_graph.py +0 -0
  151. {netket-3.11.4 → netket-3.12.0}/netket/graph/common_lattices.py +0 -0
  152. {netket-3.11.4 → netket-3.12.0}/netket/graph/graph.py +0 -0
  153. {netket-3.11.4 → netket-3.12.0}/netket/graph/lattice.py +0 -0
  154. {netket-3.11.4 → netket-3.12.0}/netket/graph/space_group.py +0 -0
  155. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/__init__.py +0 -0
  156. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/continuous_hilbert.py +0 -0
  157. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/particle.py +0 -0
  158. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/random/__init__.py +0 -0
  159. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/random/custom.py +0 -0
  160. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/random/doubled.py +0 -0
  161. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/random/particle.py +0 -0
  162. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/random/qubit.py +0 -0
  163. {netket-3.11.4 → netket-3.12.0}/netket/hilbert/random/tensor_hilbert.py +0 -0
  164. {netket-3.11.4 → netket-3.12.0}/netket/jax/_chunk_utils.py +0 -0
  165. {netket-3.11.4 → netket-3.12.0}/netket/jax/_expect.py +0 -0
  166. {netket-3.11.4 → netket-3.12.0}/netket/jax/_grad.py +0 -0
  167. {netket-3.11.4 → netket-3.12.0}/netket/jax/_jacobian/__init__.py +0 -0
  168. {netket-3.11.4 → netket-3.12.0}/netket/jax/_jacobian/default_mode.py +0 -0
  169. {netket-3.11.4 → netket-3.12.0}/netket/jax/_jacobian/jacobian_dense.py +0 -0
  170. {netket-3.11.4 → netket-3.12.0}/netket/jax/_jacobian/jacobian_pytree.py +0 -0
  171. {netket-3.11.4 → netket-3.12.0}/netket/jax/_math.py +0 -0
  172. {netket-3.11.4 → netket-3.12.0}/netket/jax/_scanmap.py +0 -0
  173. {netket-3.11.4 → netket-3.12.0}/netket/jax/_utils_dtype.py +0 -0
  174. {netket-3.11.4 → netket-3.12.0}/netket/jax/_utils_random.py +0 -0
  175. {netket-3.11.4 → netket-3.12.0}/netket/jax/_utils_tree.py +0 -0
  176. {netket-3.11.4 → netket-3.12.0}/netket/jax/_vjp.py +0 -0
  177. {netket-3.11.4 → netket-3.12.0}/netket/jax/_vmap_chunked.py +0 -0
  178. {netket-3.11.4 → netket-3.12.0}/netket/logging/__init__.py +0 -0
  179. {netket-3.11.4 → netket-3.12.0}/netket/logging/base.py +0 -0
  180. {netket-3.11.4 → netket-3.12.0}/netket/logging/json_log.py +0 -0
  181. {netket-3.11.4 → netket-3.12.0}/netket/logging/runtime_log.py +0 -0
  182. {netket-3.11.4 → netket-3.12.0}/netket/logging/state_log.py +0 -0
  183. {netket-3.11.4 → netket-3.12.0}/netket/logging/tensorboard.py +0 -0
  184. {netket-3.11.4 → netket-3.12.0}/netket/models/README.md +0 -0
  185. {netket-3.11.4 → netket-3.12.0}/netket/models/autoreg.py +0 -0
  186. {netket-3.11.4 → netket-3.12.0}/netket/models/deepset.py +0 -0
  187. {netket-3.11.4 → netket-3.12.0}/netket/models/equivariant.py +0 -0
  188. {netket-3.11.4 → netket-3.12.0}/netket/models/fast_autoreg.py +0 -0
  189. {netket-3.11.4 → netket-3.12.0}/netket/models/gaussian.py +0 -0
  190. {netket-3.11.4 → netket-3.12.0}/netket/models/jastrow.py +0 -0
  191. {netket-3.11.4 → netket-3.12.0}/netket/models/mlp.py +0 -0
  192. {netket-3.11.4 → netket-3.12.0}/netket/models/ndm.py +0 -0
  193. {netket-3.11.4 → netket-3.12.0}/netket/models/rbm.py +0 -0
  194. {netket-3.11.4 → netket-3.12.0}/netket/models/utils.py +0 -0
  195. {netket-3.11.4 → netket-3.12.0}/netket/nn/activation.py +0 -0
  196. {netket-3.11.4 → netket-3.12.0}/netket/nn/blocks/__init__.py +0 -0
  197. {netket-3.11.4 → netket-3.12.0}/netket/nn/blocks/deepset.py +0 -0
  198. {netket-3.11.4 → netket-3.12.0}/netket/nn/blocks/mlp.py +0 -0
  199. {netket-3.11.4 → netket-3.12.0}/netket/nn/blocks/symmetry_sum.py +0 -0
  200. {netket-3.11.4 → netket-3.12.0}/netket/nn/deprecation.py +0 -0
  201. {netket-3.11.4 → netket-3.12.0}/netket/nn/fast_masked_linear.py +0 -0
  202. {netket-3.11.4 → netket-3.12.0}/netket/nn/initializers.py +0 -0
  203. {netket-3.11.4 → netket-3.12.0}/netket/nn/masked_linear.py +0 -0
  204. {netket-3.11.4 → netket-3.12.0}/netket/operator/_abstract_observable.py +0 -0
  205. {netket-3.11.4 → netket-3.12.0}/netket/operator/_abstract_operator.py +0 -0
  206. {netket-3.11.4 → netket-3.12.0}/netket/operator/_abstract_super_operator.py +0 -0
  207. {netket-3.11.4 → netket-3.12.0}/netket/operator/_continuous_operator.py +0 -0
  208. {netket-3.11.4 → netket-3.12.0}/netket/operator/_discrete_operator.py +0 -0
  209. {netket-3.11.4 → netket-3.12.0}/netket/operator/_hamiltonian.py +0 -0
  210. {netket-3.11.4 → netket-3.12.0}/netket/operator/_heisenberg.py +0 -0
  211. {netket-3.11.4 → netket-3.12.0}/netket/operator/_ising/__init__.py +0 -0
  212. {netket-3.11.4 → netket-3.12.0}/netket/operator/_ising/base.py +0 -0
  213. {netket-3.11.4 → netket-3.12.0}/netket/operator/_ising/numba.py +0 -0
  214. {netket-3.11.4 → netket-3.12.0}/netket/operator/_kinetic.py +0 -0
  215. {netket-3.11.4 → netket-3.12.0}/netket/operator/_lazy.py +0 -0
  216. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_liouvillian.py +0 -0
  217. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_operator/__init__.py +0 -0
  218. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_operator/compile_helpers.py +0 -0
  219. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_operator/helpers.py +0 -0
  220. {netket-3.11.4 → netket-3.12.0}/netket/operator/_local_operator/numba.py +0 -0
  221. {netket-3.11.4 → netket-3.12.0}/netket/operator/_pauli_strings/__init__.py +0 -0
  222. {netket-3.11.4 → netket-3.12.0}/netket/operator/_pauli_strings/base.py +0 -0
  223. {netket-3.11.4 → netket-3.12.0}/netket/operator/_pauli_strings/jax.py +0 -0
  224. {netket-3.11.4 → netket-3.12.0}/netket/operator/_pauli_strings/numba.py +0 -0
  225. {netket-3.11.4 → netket-3.12.0}/netket/operator/_potential.py +0 -0
  226. {netket-3.11.4 → netket-3.12.0}/netket/operator/_sumoperators.py +0 -0
  227. {netket-3.11.4 → netket-3.12.0}/netket/operator/boson.py +0 -0
  228. {netket-3.11.4 → netket-3.12.0}/netket/operator/spin.py +0 -0
  229. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/__init__.py +0 -0
  230. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/__init__.py +0 -0
  231. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/common.py +0 -0
  232. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/default.py +0 -0
  233. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/qgt_jacobian_common.py +0 -0
  234. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/qgt_jacobian_pytree_logic.py +0 -0
  235. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/qgt/qgt_onthefly_logic.py +0 -0
  236. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/solver/__init__.py +0 -0
  237. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/solver/solvers.py +0 -0
  238. {netket-3.11.4 → netket-3.12.0}/netket/optimizer/sr.py +0 -0
  239. {netket-3.11.4 → netket-3.12.0}/netket/sampler/autoreg.py +0 -0
  240. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/__init__.py +0 -0
  241. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/base.py +0 -0
  242. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/continuous_gaussian.py +0 -0
  243. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/custom_numpy.py +0 -0
  244. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/fixed.py +0 -0
  245. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/hamiltonian_numpy.py +0 -0
  246. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/langevin.py +0 -0
  247. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/local.py +0 -0
  248. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/local_numpy.py +0 -0
  249. {netket-3.11.4 → netket-3.12.0}/netket/sampler/rules/tensor.py +0 -0
  250. {netket-3.11.4 → netket-3.12.0}/netket/stats/__init__.py +0 -0
  251. {netket-3.11.4 → netket-3.12.0}/netket/stats/_autocorr.py +0 -0
  252. {netket-3.11.4 → netket-3.12.0}/netket/stats/mc_stats.py +0 -0
  253. {netket-3.11.4 → netket-3.12.0}/netket/stats/mc_stats_old.py +0 -0
  254. {netket-3.11.4 → netket-3.12.0}/netket/stats/mpi_stats.py +0 -0
  255. {netket-3.11.4 → netket-3.12.0}/netket/tools/__init__.py +0 -0
  256. {netket-3.11.4 → netket-3.12.0}/netket/tools/_common.py +0 -0
  257. {netket-3.11.4 → netket-3.12.0}/netket/tools/_cpu_info.py +0 -0
  258. {netket-3.11.4 → netket-3.12.0}/netket/tools/_mpi_info.py +0 -0
  259. {netket-3.11.4 → netket-3.12.0}/netket/tools/check_mpi.py +0 -0
  260. {netket-3.11.4 → netket-3.12.0}/netket/utils/array.py +0 -0
  261. {netket-3.11.4 → netket-3.12.0}/netket/utils/deprecation.py +0 -0
  262. {netket-3.11.4 → netket-3.12.0}/netket/utils/dispatch.py +0 -0
  263. {netket-3.11.4 → netket-3.12.0}/netket/utils/float.py +0 -0
  264. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/__init__.py +0 -0
  265. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/_group.py +0 -0
  266. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/_point_group.py +0 -0
  267. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/_semigroup.py +0 -0
  268. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/axial.py +0 -0
  269. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/cubic.py +0 -0
  270. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/icosa.py +0 -0
  271. {netket-3.11.4 → netket-3.12.0}/netket/utils/group/planar.py +0 -0
  272. {netket-3.11.4 → netket-3.12.0}/netket/utils/history.py +0 -0
  273. {netket-3.11.4 → netket-3.12.0}/netket/utils/holomorphic.py +0 -0
  274. {netket-3.11.4 → netket-3.12.0}/netket/utils/jax.py +0 -0
  275. {netket-3.11.4 → netket-3.12.0}/netket/utils/model_frameworks/__init__.py +0 -0
  276. {netket-3.11.4 → netket-3.12.0}/netket/utils/model_frameworks/base.py +0 -0
  277. {netket-3.11.4 → netket-3.12.0}/netket/utils/model_frameworks/flax.py +0 -0
  278. {netket-3.11.4 → netket-3.12.0}/netket/utils/model_frameworks/haiku.py +0 -0
  279. {netket-3.11.4 → netket-3.12.0}/netket/utils/model_frameworks/jax.py +0 -0
  280. {netket-3.11.4 → netket-3.12.0}/netket/utils/moduletools.py +0 -0
  281. {netket-3.11.4 → netket-3.12.0}/netket/utils/mpi/__init__.py +0 -0
  282. {netket-3.11.4 → netket-3.12.0}/netket/utils/mpi/primitives.py +0 -0
  283. {netket-3.11.4 → netket-3.12.0}/netket/utils/numbers.py +0 -0
  284. {netket-3.11.4 → netket-3.12.0}/netket/utils/optional_deps.py +0 -0
  285. {netket-3.11.4 → netket-3.12.0}/netket/utils/partial.py +0 -0
  286. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/__init__.py +0 -0
  287. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/_version.py +0 -0
  288. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/alias.py +0 -0
  289. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/autoreload.py +0 -0
  290. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/dispatcher.py +0 -0
  291. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/function.py +0 -0
  292. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/method.py +0 -0
  293. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/overload.py +0 -0
  294. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/parametric.py +0 -0
  295. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/promotion.py +0 -0
  296. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/py.typed +0 -0
  297. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/repr.py +0 -0
  298. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/resolver.py +0 -0
  299. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/signature.py +0 -0
  300. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/type.py +0 -0
  301. {netket-3.11.4 → netket-3.12.0}/netket/utils/plum/util.py +0 -0
  302. {netket-3.11.4 → netket-3.12.0}/netket/utils/seed.py +0 -0
  303. {netket-3.11.4 → netket-3.12.0}/netket/utils/static_number.py +0 -0
  304. {netket-3.11.4 → netket-3.12.0}/netket/utils/struct/__init__.py +0 -0
  305. {netket-3.11.4 → netket-3.12.0}/netket/utils/struct/dataclass.py +0 -0
  306. {netket-3.11.4 → netket-3.12.0}/netket/utils/struct/fields.py +0 -0
  307. {netket-3.11.4 → netket-3.12.0}/netket/utils/struct/pytree.py +0 -0
  308. {netket-3.11.4 → netket-3.12.0}/netket/utils/struct/utils.py +0 -0
  309. {netket-3.11.4 → netket-3.12.0}/netket/utils/summation.py +0 -0
  310. {netket-3.11.4 → netket-3.12.0}/netket/utils/types.py +0 -0
  311. {netket-3.11.4 → netket-3.12.0}/netket/utils/version_check.py +0 -0
  312. {netket-3.11.4 → netket-3.12.0}/netket/vqs/__init__.py +0 -0
  313. {netket-3.11.4 → netket-3.12.0}/netket/vqs/base.py +0 -0
  314. {netket-3.11.4 → netket-3.12.0}/netket/vqs/deprecated.py +0 -0
  315. {netket-3.11.4 → netket-3.12.0}/netket/vqs/experimental.py +0 -0
  316. {netket-3.11.4 → netket-3.12.0}/netket/vqs/full_summ/__init__.py +0 -0
  317. {netket-3.11.4 → netket-3.12.0}/netket/vqs/full_summ/expect.py +0 -0
  318. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/__init__.py +0 -0
  319. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/kernels.py +0 -0
  320. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_mixed_state/__init__.py +0 -0
  321. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_mixed_state/expect.py +0 -0
  322. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_mixed_state/expect_chunked.py +0 -0
  323. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_mixed_state/state.py +0 -0
  324. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/__init__.py +0 -0
  325. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/expect.py +0 -0
  326. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/expect_chunked.py +0 -0
  327. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/expect_forces.py +0 -0
  328. {netket-3.11.4 → netket-3.12.0}/netket/vqs/mc/mc_state/expect_grad_chunked.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: NetKet
3
- Version: 3.11.4
3
+ Version: 3.12.0
4
4
  Summary: Netket : Machine Learning toolbox for many-body quantum systems.
5
5
  Project-URL: homepage, https://www.netket.org
6
6
  Project-URL: documentation, https://netket.readthedocs.io/en/latest/#
@@ -19,10 +19,11 @@ Classifier: Programming Language :: Python :: 3
19
19
  Classifier: Topic :: Scientific/Engineering :: Physics
20
20
  Requires-Python: >=3.9
21
21
  Requires-Dist: beartype>=0.16.2
22
+ Requires-Dist: equinox<0.12,>=0.11.3
22
23
  Requires-Dist: flax<0.9,>=0.7.1
23
24
  Requires-Dist: igraph<0.12.0,>=0.10.0
24
- Requires-Dist: jax<0.5,>=0.4.3
25
- Requires-Dist: jaxlib<0.5,>=0.4.3
25
+ Requires-Dist: jax<0.5,>=0.4.16
26
+ Requires-Dist: jaxlib<0.5,>=0.4.16
26
27
  Requires-Dist: numba4jax<0.1,>=0.0.10.post1
27
28
  Requires-Dist: numba<0.60,>=0.52
28
29
  Requires-Dist: numpy~=1.20
@@ -45,15 +46,15 @@ Requires-Dist: pytest-json-report>=1.3; extra == 'dev'
45
46
  Requires-Dist: pytest-xdist[psutil]>=2; extra == 'dev'
46
47
  Requires-Dist: pytest>=6; extra == 'dev'
47
48
  Requires-Dist: qutip>=5; extra == 'dev'
48
- Requires-Dist: ruff==0.1.0; extra == 'dev'
49
+ Requires-Dist: ruff==0.4.2; extra == 'dev'
49
50
  Requires-Dist: wheel; extra == 'dev'
50
51
  Provides-Extra: docs
51
- Requires-Dist: myst-nb~=1.0.0; extra == 'docs'
52
- Requires-Dist: myst-parser<2.1.0,>=2.0.0; extra == 'docs'
52
+ Requires-Dist: myst-nb<1.2,>=1.0; extra == 'docs'
53
+ Requires-Dist: myst-parser<3.1.0,>=2.0.0; extra == 'docs'
53
54
  Requires-Dist: sphinx-autodoc-typehints<3.0,>=1.22; extra == 'docs'
54
55
  Requires-Dist: sphinx-book-theme~=1.1.0; extra == 'docs'
55
56
  Requires-Dist: sphinx-design>=0.4.0; extra == 'docs'
56
- Requires-Dist: sphinx<7.3,>=7.0; extra == 'docs'
57
+ Requires-Dist: sphinx<7.4,>=7.0; extra == 'docs'
57
58
  Requires-Dist: sphinxcontrib-fulltoc~=1.2.0; extra == 'docs'
58
59
  Requires-Dist: sphinxcontrib-jsmath~=1.0.1; extra == 'docs'
59
60
  Provides-Extra: extra
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '3.11.4'
16
- __version_tuple__ = version_tuple = (3, 11, 4)
15
+ __version__ = version = '3.12.0'
16
+ __version_tuple__ = version_tuple = (3, 12, 0)
@@ -12,33 +12,48 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from dataclasses import dataclass
16
-
17
15
  from collections import deque
18
16
 
19
17
  import numpy as np
20
18
 
19
+ from netket.utils import struct
20
+
21
21
 
22
- @dataclass
23
- class ConvergenceStopping:
22
+ class ConvergenceStopping(struct.Pytree, mutable=True):
24
23
  """A simple callback to stop the optimisation if the loss gets below a certain threshold.
25
24
  based on `driver._loss_name`."""
26
25
 
27
26
  target: float
28
27
  """Target value for the monitored quantity. Training will stop if the driver hits the baseline."""
29
- monitor: str = "mean"
28
+ monitor: str
30
29
  """Loss statistic to monitor. Should be one of 'mean', 'variance', 'sigma'."""
31
30
 
32
- smoothing_window: int = 10
31
+ smoothing_window: int
33
32
  """
34
33
  The loss is smoothed over the last `smoothing_window` iterations to reduce statistical fluctuations
35
34
  """
36
- patience: int = 10
35
+ patience: int
37
36
  """
38
37
  The loss must be consistently below this value for this number of iterations in order to stop the optimisation.
39
38
  """
40
39
 
41
- def __post_init__(self):
40
+ # caches
41
+ _loss_window: deque
42
+ _patience_counter: int
43
+
44
+ def __init__(
45
+ self,
46
+ target: float,
47
+ monitor: str = "mean",
48
+ *,
49
+ smoothing_window: int = 10,
50
+ patience: int = 10,
51
+ ):
52
+ self.target = target
53
+ self.monitor = monitor
54
+ self.smoothing_window = smoothing_window
55
+ self.patience = patience
56
+
42
57
  self._loss_window: deque = deque([], maxlen=self.smoothing_window)
43
58
  self._patience_counter: int = 0
44
59
 
@@ -19,26 +19,24 @@ import numpy as np
19
19
  from netket.utils import struct
20
20
 
21
21
 
22
- # Mark this class a NetKet dataclass so that it can automatically be serialized by Flax.
23
- @struct.dataclass(_frozen=False)
24
- class EarlyStopping:
22
+ class EarlyStopping(struct.Pytree, mutable=True):
25
23
  """A simple callback to stop NetKet if there are no more improvements in the training.
26
24
  based on `driver._loss_name`.
27
25
  """
28
26
 
29
- min_delta: float = 0.0
27
+ min_delta: float
30
28
  """Minimum change in the monitored quantity to qualify as an improvement."""
31
- min_reldelta: float = 0.0
29
+ min_reldelta: float
32
30
  """Minimum relative change in the monitored quantity to qualify as an improvement.
33
31
 
34
32
  This behaves similarly to `min_delta` but is more useful for intensive quantities that
35
33
  converge to 0, where absolute tolerances might not be effective.
36
34
  """
37
- patience: Union[int, float] = 0
35
+ patience: Union[int, float]
38
36
  """Number of epochs with no improvement after which training will be stopped."""
39
- baseline: Optional[float] = None
37
+ baseline: Optional[float]
40
38
  """Baseline value for the monitored quantity. Training will stop if the driver hits the baseline."""
41
- monitor: str = "mean"
39
+ monitor: str
42
40
  """Loss statistic to monitor. Should be one of 'mean', 'variance', 'sigma'."""
43
41
 
44
42
  # The quantities below are internal and should not be edited directly
@@ -46,11 +44,44 @@ class EarlyStopping:
46
44
 
47
45
  _best_val: float = np.inf
48
46
  """Best value of the loss observed up to this iteration. """
49
- _best_iter: int = 0
47
+ _best_iter: int
50
48
  """Iteration at which the `_best_val` was observed."""
51
- _best_patience_counter: int = 0
49
+ _best_patience_counter: int
52
50
  """Stores the iteration at which we've seen the best loss so far"""
53
51
 
52
+ def __init__(
53
+ self,
54
+ min_delta: float = 0.0,
55
+ min_reldelta: float = 0.0,
56
+ patience: Union[int, float] = 0,
57
+ baseline: Optional[float] = None,
58
+ monitor: str = "mean",
59
+ ):
60
+ """
61
+ Construct an early stopping callback.
62
+
63
+ Args:
64
+ min_delta: Minimum change in the monitored quantity to
65
+ qualify as an improvement.
66
+ min_reldelta: Minimum relative change in the monitored
67
+ quantity to qualify as an improvement.
68
+ patience: Number of epochs with no improvement after which
69
+ training will be stopped.
70
+ baseline: Baseline value for the monitored quantity. Training
71
+ will stop if the driver hits the baseline.
72
+ monitor: Loss statistic to monitor. Should be one of
73
+ `mean`, `variance`, `sigma`.
74
+ """
75
+ self.min_delta = min_delta
76
+ self.min_reldelta = min_reldelta
77
+ self.patience = patience
78
+ self.baseline = baseline
79
+ self.monitor = monitor
80
+
81
+ self._best_val = np.infty
82
+ self._best_iter = 0
83
+ self._best_patience_counter = 0
84
+
54
85
  def __call__(self, step, log_data, driver):
55
86
  """
56
87
  A boolean function that determines whether or not to stop training.
@@ -19,19 +19,38 @@ from netket.utils import struct
19
19
 
20
20
 
21
21
  # Mark this class a NetKet dataclass so that it can automatically be serialized by Flax.
22
- @struct.dataclass(_frozen=False)
23
- class InvalidLossStopping:
22
+ class InvalidLossStopping(struct.Pytree, mutable=True):
24
23
  """A simple callback to stop NetKet if there are no more improvements in the training.
25
24
  based on `driver._loss_name`."""
26
25
 
27
- monitor: str = "mean"
26
+ monitor: str
28
27
  """Loss statistic to monitor. Should be one of 'mean', 'variance', 'sigma'."""
29
- patience: Union[int, float] = 0
28
+ patience: Union[int, float]
30
29
  """Number of epochs with invalid loss after which training will be stopped."""
31
30
 
32
- _last_valid_iter: int = 0
31
+ # caches
32
+ _last_valid_iter: int
33
33
  """Last valid iteration, to check against patience"""
34
34
 
35
+ def __init__(self, monitor: str = "mean", patience: Union[int, float] = 0):
36
+ """
37
+ Construct a callback stopping theoptimisation when the monitored quantity
38
+ becaomes invalid for at least `patience` steps.
39
+
40
+ Args:
41
+ monitor: a string with the name of the quantity to be monitored. This
42
+ is applied to the standard loss optimised by a driver, such as the
43
+ Energy for the VMC driver (default: 'mean').
44
+ patience: Number of steps to wait before stopping the execution after
45
+ the tracked quantity becomes invalid (default 0, meaning that it
46
+ stops immediately).
47
+ """
48
+ self.monitor = monitor
49
+ self.patience = patience
50
+
51
+ # caches
52
+ self._last_valid_iter = 0
53
+
35
54
  def __call__(self, step, log_data, driver):
36
55
  """
37
56
  A boolean function that determines whether or not to stop training.
@@ -18,9 +18,7 @@ import time
18
18
  from netket.utils import struct
19
19
 
20
20
 
21
- # Mark this class a NetKet dataclass so that it can automatically be serialized by Flax.
22
- @struct.dataclass(_frozen=False)
23
- class Timeout:
21
+ class Timeout(struct.Pytree, mutable=True):
24
22
  """A simple callback to stop NetKet after some time has passed.
25
23
 
26
24
  This callback monitors whether a driver has been training for more
@@ -30,19 +28,26 @@ class Timeout:
30
28
  timeout: float
31
29
  """Number of seconds to wait before the training will be stopped."""
32
30
 
33
- _init_time: Optional[float] = None
31
+ # caches
32
+ _init_time: Optional[float]
34
33
  """
35
34
  Internal field storing the time at which the first iteration has been
36
35
  performed.
37
36
  """
38
37
 
39
- def __post_init__(self):
40
- if not self.timeout > 0:
38
+ def __init__(self, timeout: float):
39
+ """
40
+ Stops the optimisation after a certain time itnerval.
41
+
42
+ Args:
43
+ timeout: number of seconds after which the optimisation will
44
+ be stopped.
45
+ """
46
+ if not timeout > 0:
41
47
  raise ValueError("`timeout` must be larger than 0.")
48
+ self.timeout = timeout
42
49
 
43
- def reset(self):
44
- """Resets the initial time of the training"""
45
- self.__init_time = None
50
+ self._init_time = None
46
51
 
47
52
  def __call__(self, step, log_data, driver):
48
53
  """
@@ -19,13 +19,13 @@ import abc
19
19
  import numbers
20
20
  from functools import partial
21
21
 
22
- from tqdm import tqdm
22
+ from tqdm.auto import tqdm
23
23
 
24
24
  import jax
25
25
 
26
26
  from netket.logging import AbstractLog, JsonLog
27
27
  from netket.operator._abstract_observable import AbstractObservable
28
- from netket.utils import mpi
28
+ from netket.utils import mpi, timing
29
29
  from netket.utils.types import Optimizer, PyTree
30
30
  from netket.vqs import VariationalState
31
31
 
@@ -104,6 +104,7 @@ class AbstractVariationalDriver(abc.ABC):
104
104
  self._loss_stats = None
105
105
  self._loss_name = minimized_quantity_name
106
106
  self._step_count = 0
107
+ self._timer = None
107
108
 
108
109
  self._variational_state = variational_state
109
110
  self.optimizer = optimizer
@@ -245,6 +246,7 @@ class AbstractVariationalDriver(abc.ABC):
245
246
  callback: Callable[
246
247
  [int, dict, "AbstractVariationalDriver"], bool
247
248
  ] = lambda *x: True,
249
+ timeit: bool = False,
248
250
  ):
249
251
  """
250
252
  Runs this variational driver, updating the weights of the network stored in
@@ -287,6 +289,7 @@ class AbstractVariationalDriver(abc.ABC):
287
289
  serialized to disk (ignored if logger is provided)
288
290
  write_every: Every how many steps the json data should be flushed to disk (ignored if
289
291
  logger is provided)
292
+ timeit: If True, provide timing information.
290
293
  """
291
294
 
292
295
  if not isinstance(n_iter, numbers.Number):
@@ -313,52 +316,62 @@ class AbstractVariationalDriver(abc.ABC):
313
316
  callbacks = _to_iterable(callback)
314
317
  callback_stop = False
315
318
 
316
- with tqdm(
317
- total=n_iter,
318
- disable=not show_progress,
319
- dynamic_ncols=True,
320
- ) as pbar:
321
- old_step = self.step_count
322
- first_step = True
323
-
324
- for step in self.iter(n_iter, step_size):
325
- log_data = self.estimate(obs)
326
- self._log_additional_data(log_data, step)
327
-
328
- # if the cost-function is defined then report it in the progress bar
329
- if self._loss_stats is not None:
330
- pbar.set_postfix_str(self._loss_name + "=" + str(self._loss_stats))
331
- log_data[self._loss_name] = self._loss_stats
332
-
333
- # Execute callbacks before loggers because they can append to log_data
334
- for callback in callbacks:
335
- if not callback(step, log_data, self):
336
- callback_stop = True
337
-
338
- for logger in loggers:
339
- logger(self.step_count, log_data, self.state)
340
-
341
- if len(callbacks) > 0:
342
- if mpi.mpi_any(callback_stop):
343
- break
344
-
345
- # Reset the timing of tqdm after the first step, to ignore compilation time
346
- if first_step:
347
- first_step = False
348
- pbar.unpause()
349
-
350
- # Update the progress bar
351
- pbar.update(self.step_count - old_step)
319
+ with timing.timed_scope(force=timeit) as timer:
320
+ with tqdm(
321
+ total=n_iter,
322
+ disable=not show_progress,
323
+ dynamic_ncols=True,
324
+ ) as pbar:
352
325
  old_step = self.step_count
353
-
354
- # Final update so that it shows up filled.
355
- pbar.update(self.step_count - old_step)
326
+ first_step = True
327
+
328
+ for step in self.iter(n_iter, step_size):
329
+ with timing.timed_scope(name="observables"):
330
+ log_data = self.estimate(obs)
331
+ self._log_additional_data(log_data, step)
332
+
333
+ # if the cost-function is defined then report it in the progress bar
334
+ if self._loss_stats is not None:
335
+ pbar.set_postfix_str(
336
+ self._loss_name + "=" + str(self._loss_stats)
337
+ )
338
+ log_data[self._loss_name] = self._loss_stats
339
+
340
+ # Execute callbacks before loggers because they can append to log_data
341
+ for callback in callbacks:
342
+ if not callback(step, log_data, self):
343
+ callback_stop = True
344
+
345
+ with timing.timed_scope(name="loggers"):
346
+ for logger in loggers:
347
+ logger(self.step_count, log_data, self.state)
348
+
349
+ if len(callbacks) > 0:
350
+ if mpi.mpi_any(callback_stop):
351
+ break
352
+
353
+ # Reset the timing of tqdm after the first step, to ignore compilation time
354
+ if first_step:
355
+ first_step = False
356
+ pbar.unpause()
357
+
358
+ # Update the progress bar
359
+ pbar.update(self.step_count - old_step)
360
+ old_step = self.step_count
361
+
362
+ # Final update so that it shows up filled.
363
+ pbar.update(self.step_count - old_step)
356
364
 
357
365
  # flush at the end of the evolution so that final values are saved to
358
366
  # file
359
367
  for logger in loggers:
360
368
  logger.flush(self.state)
361
369
 
370
+ if timeit:
371
+ self._timer = timer
372
+ if self._is_root:
373
+ print(timer)
374
+
362
375
  return loggers
363
376
 
364
377
  def estimate(self, observables):
@@ -19,7 +19,7 @@ import warnings
19
19
  import jax
20
20
  import jax.numpy as jnp
21
21
  import numpy as np
22
- from tqdm import tqdm
22
+ from tqdm.auto import tqdm
23
23
 
24
24
  import netket as nk
25
25
  from netket import config
@@ -28,7 +28,7 @@ from netket.driver.abstract_variational_driver import _to_iterable
28
28
  from netket.jax import HashablePartial
29
29
  from netket.logging.json_log import JsonLog
30
30
  from netket.operator import AbstractOperator
31
- from netket.utils import mpi
31
+ from netket.utils import mpi, timing
32
32
  from netket.utils.dispatch import dispatch
33
33
  from netket.utils.types import PyTree
34
34
  from netket.vqs import VariationalState
@@ -275,12 +275,13 @@ class TDVPBaseDriver(AbstractVariationalDriver):
275
275
  def run(
276
276
  self,
277
277
  T,
278
- out=None,
278
+ out=(),
279
279
  obs=None,
280
280
  *,
281
281
  tstops=None,
282
282
  show_progress=True,
283
283
  callback=None,
284
+ timeit: bool = False,
284
285
  ):
285
286
  """
286
287
  Runs the time evolution.
@@ -301,6 +302,7 @@ class TDVPBaseDriver(AbstractVariationalDriver):
301
302
  show_progress: If true displays a progress bar (default=True)
302
303
  callback: Callable or list of callable callback functions to be executed at each
303
304
  stopping time.
305
+ timeit: If True, provide timing information.
304
306
  """
305
307
  if obs is None:
306
308
  obs = {}
@@ -308,15 +310,15 @@ class TDVPBaseDriver(AbstractVariationalDriver):
308
310
  if callback is None:
309
311
  callback = lambda *_args, **_kwargs: True
310
312
 
313
+ # if out is a path, create an overwriting Json Log for output
314
+ if isinstance(out, str):
315
+ out = JsonLog(out, "w")
316
+ elif out is None:
317
+ out = ()
318
+
311
319
  # Log only non-root nodes
312
- if self._mynode == 0:
313
- if out is None:
314
- loggers = ()
315
- # if out is a path, create an overwriting Json Log for output
316
- elif isinstance(out, str):
317
- loggers = (JsonLog(out, "w"),)
318
- else:
319
- loggers = _to_iterable(out)
320
+ if self._is_root:
321
+ loggers = _to_iterable(out)
320
322
  else:
321
323
  loggers = tuple()
322
324
  show_progress = False
@@ -325,6 +327,7 @@ class TDVPBaseDriver(AbstractVariationalDriver):
325
327
  callback_stop = False
326
328
 
327
329
  t_end = np.asarray(self.t + T)
330
+
328
331
  with tqdm(
329
332
  total=t_end,
330
333
  disable=not show_progress,
@@ -353,33 +356,35 @@ class TDVPBaseDriver(AbstractVariationalDriver):
353
356
  pbar.set_postfix(self._postfix)
354
357
  pbar.refresh()
355
358
 
356
- for step in self._iter(T, tstops=tstops, callback=update_progress_bar):
357
- log_data = self.estimate(obs)
358
- self._log_additional_data(log_data, step)
359
-
360
- self._postfix = {"n": self.step_count}
361
- # if the cost-function is defined then report it in the progress bar
362
- if self._loss_stats is not None:
363
- self._postfix.update(
364
- {
365
- self._loss_name: str(self._loss_stats),
366
- }
367
- )
368
- log_data[self._loss_name] = self._loss_stats
369
- pbar.set_postfix(self._postfix)
370
-
371
- # Execute callbacks before loggers because they can append to log_data
372
- for callback in callbacks:
373
- if not callback(step, log_data, self):
374
- callback_stop = True
375
-
376
- for logger in loggers:
377
- logger(self.step_value, log_data, self.state)
378
-
379
- if len(callbacks) > 0:
380
- if mpi.mpi_any(callback_stop):
381
- break
382
- update_progress_bar()
359
+ with timing.timed_scope(force=timeit) as timer:
360
+ for step in self._iter(T, tstops=tstops, callback=update_progress_bar):
361
+ with timing.timed_scope(name="observables"):
362
+ log_data = self.estimate(obs)
363
+ self._log_additional_data(log_data, step)
364
+
365
+ self._postfix = {"n": self.step_count}
366
+ # if the cost-function is defined then report it in the progress bar
367
+ if self._loss_stats is not None:
368
+ self._postfix.update(
369
+ {
370
+ self._loss_name: str(self._loss_stats),
371
+ }
372
+ )
373
+ log_data[self._loss_name] = self._loss_stats
374
+ pbar.set_postfix(self._postfix)
375
+
376
+ # Execute callbacks before loggers because they can append to log_data
377
+ for callback in callbacks:
378
+ if not callback(step, log_data, self):
379
+ callback_stop = True
380
+
381
+ for logger in loggers:
382
+ logger(self.step_value, log_data, self.state)
383
+
384
+ if len(callbacks) > 0:
385
+ if mpi.mpi_any(callback_stop):
386
+ break
387
+ update_progress_bar()
383
388
 
384
389
  # Final update so that it shows up filled.
385
390
  update_progress_bar()
@@ -389,6 +394,10 @@ class TDVPBaseDriver(AbstractVariationalDriver):
389
394
  for logger in loggers:
390
395
  logger.flush(self.state)
391
396
 
397
+ if timeit:
398
+ self._timer = timer
399
+ if self._is_root:
400
+ print(timer)
392
401
  return loggers
393
402
 
394
403
  def _log_additional_data(self, log_dict, step):
@@ -25,6 +25,7 @@ from netket.optimizer.qgt import QGTJacobianDense
25
25
  from netket.optimizer.qgt.qgt_jacobian_dense import convert_tree_to_dense_format
26
26
  from netket.vqs import VariationalState, VariationalMixedState, MCState
27
27
  from netket.jax import tree_cast
28
+ from netket.utils import timing
28
29
 
29
30
  from netket.experimental.dynamics import RKIntegratorConfig
30
31
 
@@ -190,6 +191,7 @@ class TDVPSchmitt(TDVPBaseDriver):
190
191
  # MIT License, Copyright (c) 2021 Markus Schmitt
191
192
 
192
193
 
194
+ @timing.timed
193
195
  @partial(jax.jit, static_argnames=("n_samples"))
194
196
  def _impl(parameters, n_samples, E_loc, S, rhs_coeff, rcond, rcond_smooth, snr_atol):
195
197
  E = stats.statistics(E_loc)
@@ -28,13 +28,14 @@ from netket.driver import AbstractVariationalDriver
28
28
  from netket.errors import UnoptimalSRtWarning
29
29
  from netket.jax import sharding
30
30
  from netket.operator import AbstractOperator
31
- from netket.utils import mpi
31
+ from netket.utils import mpi, timing
32
32
  from netket.utils.types import ScalarOrSchedule, Optimizer, PyTree
33
33
  from netket.vqs import MCState
34
34
 
35
35
  from jax.flatten_util import ravel_pytree
36
36
 
37
37
 
38
+ @timing.timed
38
39
  @partial(jax.jit, static_argnames=("mode", "solver_fn"))
39
40
  def SRt(
40
41
  O_L, local_energies, diag_shift, *, mode, solver_fn, e_mean=None, params_structure
@@ -49,7 +50,7 @@ def SRt(
49
50
  local_energies = local_energies.flatten()
50
51
 
51
52
  if e_mean is None:
52
- e_mean = mpi.mean(local_energies)
53
+ e_mean = nkstats.mean(local_energies)
53
54
  de = jnp.conj(local_energies - e_mean).squeeze()
54
55
 
55
56
  # * in this case O_L should be padded with zeros
@@ -102,7 +103,7 @@ def SRt(
102
103
  # To repack the real coefficients in order to get complex updates
103
104
  if mode == "complex" and nkjax.tree_leaf_iscomplex(params_structure):
104
105
  np = updates.shape[-1] // 2
105
- updates = (updates[:np] + 1j * updates[np:]) / 2
106
+ updates = updates[:np] + 1j * updates[np:]
106
107
 
107
108
  return -updates
108
109
 
@@ -278,6 +279,7 @@ class VMC_SRt(AbstractVariationalDriver):
278
279
  mode=self.jacobian_mode,
279
280
  dense=True,
280
281
  center=True,
282
+ chunk_size=self.state.chunk_size,
281
283
  ) # jacobians is centered
282
284
 
283
285
  diag_shift = self.diag_shift
@@ -153,14 +153,7 @@ class RungeKuttaState:
153
153
  last_norm = f"{self.last_norm}"
154
154
  accepted = f"{SolverFlags.INFO_STEP_ACCEPTED}"
155
155
 
156
- return "RKState(step_no(total)={}({}), t={}, dt={}{}{})".format(
157
- self.step_no,
158
- self.step_no_total,
159
- self.t.value,
160
- dt,
161
- last_norm,
162
- accepted,
163
- )
156
+ return f"RKState(step_no(total)={self.step_no}({self.step_no_total}), t={self.t.value}, dt={dt}{last_norm}{accepted})"
164
157
 
165
158
  @property
166
159
  def accepted(self):
@@ -23,6 +23,7 @@ from netket.hilbert.fock import Fock
23
23
  from netket.hilbert.tensor_hilbert_discrete import TensorDiscreteHilbert
24
24
  from netket.hilbert.homogeneous import HomogeneousHilbert
25
25
  from netket.utils.dispatch import dispatch
26
+ from netket.utils import StaticRange
26
27
 
27
28
 
28
29
  class SpinOrbitalFermions(HomogeneousHilbert):
@@ -156,7 +157,7 @@ class SpinOrbitalFermions(HomogeneousHilbert):
156
157
  self._fock = hilbert
157
158
  """Internal representation of this Hilbert space (Fock or TensorHilbert)."""
158
159
  # local states are the occupation numbers (0, 1)
159
- local_states = np.array((0.0, 1.0))
160
+ local_states = StaticRange(0.0, 1.0, 2, dtype=np.int8)
160
161
 
161
162
  # we use the constraints from the Fock spaces, and override `constrained`
162
163
  super().__init__(local_states, N=total_size, constraint_fn=None)
@@ -302,6 +303,11 @@ class SpinOrbitalFermions(HomogeneousHilbert):
302
303
  _str += ")"
303
304
  return _str
304
305
 
306
+ @property
307
+ def is_indexable(self) -> bool:
308
+ """Whether the space can be indexed with an integer"""
309
+ return self._fock.is_indexable
310
+
305
311
 
306
312
  @dispatch
307
313
  def random_state(hilb: SpinOrbitalFermions, key, batches: int, *, dtype):