laurinbrunner / jvmc_utilities

Utility functions for the jVMC package.
MIT License
0 stars 1 forks source link

Library compatibilities #27

Open glagnese opened 9 months ago

glagnese commented 9 months ago

Hi. I am sorry to bother you.

I am trying to install your library, but I am getting incompatibility issues since it requires an older version of jax and jaxlib.

Could you help me to build the right environment for your library?

This is my nvcc --version output:

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Thu_Nov_18_09:45:30_PST_2021 Cuda compilation tools, release 11.5, V11.5.119 Build cuda_11.5.r11.5/compiler.30672275_0

My machine runs on ubuntu.

Kind regards,

Gianluca

laurinbrunner commented 9 months ago

Hey, sure I would be glad to help you.

Just for clarification, did you install the required versions of jax and jaxlib and they were incompatible with your CUDA version or did you try to use newer jax version with jvmc_utilities? In the first case it might be that just installing jvmc_utilites installs you a wrong or CUDA incompatibel jax version. To make sure it installs the correct CUDA-compatible jax version, I installed jax again separately after installing jvmc_utilities using the following command:

pip install --upgrade "jax[cuda11_pip]==0.4.11" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

Maybe this already solves it. Just for completeness I write below the entire procedure I used to install a (for me) working environment.

I am using CUDA version 11.8 (using the nvidia-smi command), is it possible for you to upgrade to this version?

I hope this helps you, if you still have some problems please share them.

conda create -n NAME python=3.8 conda activate NAME pip install --upgrade "jax[cuda11_pip]==0.4.11" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html pip install jVMC pip install git+https://github.com/laurinbrunner/jvmc_utilities.git@0.9.9 pip install --upgrade "jax[cuda11_pip]==0.4.11" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

glagnese commented 9 months ago

Dear Laurin,

Thanks a lot for your help.

I think this works : pip install --upgrade "jax[cuda11_pip]==0.4.11" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

I figured out I had to install the 0.4.11 jax version, but I think I have been using the wrong syntax.

I also checked with Nvidia-smi, my cuda version is actually 12. So I have modified the command to “jax[cuda12_pip]==0.4.11”, I hope this is correct.

So now I don’t get anymore incompatibility issues. However, I am trying to run a code and I get and error from XLA: XlaRuntimeError: INTERNAL: Failed to execute XLA Runtime executable: run time error: custom call 'xla.gpu.func.launch' failed: Failed to load PTX text as a module: CUDA_ERROR_INVALID_IMAGE: device kernel image is invalid; current tracing scope: fusion; current profiling annotation: XlaModule:#hlo_module=jit_fn,program_id=2#.

Do you have any idea?

By the way, I am new Zala Lenarčić postdoc. I have inherited the code from Vladimir. You should know him, don’t you?

Thanks a lot again for your help!

All the best, Gianluca

Il giorno 27 dic 2023, alle ore 16:27, Laurin Brunner @.***> ha scritto:

pip install @.***

laurinbrunner commented 9 months ago

Hi Gianluca,

at which point exactly do you get this error? At the import or later in the code?

I suggest to first try if jax runs correctly. Usually I just open a python console, import jax and create a jax array using a = jax.numpy.zeros(10000). You can then see if jax is using your GPU with nvidia-smi. In the next step I would try to import jVMC and maybe run an exercise code that can be found on the jVMC github.

If all of this works fine, than maybe try to find out at which point in jvmc_utilities this error appears and let me know.

Best, Laurin

glagnese commented 9 months ago

Hi Laurin,

Thanks again for your help.

Sorry forget about the last email.

I actually get an error when I am importing jvmc_utilities:

Cell In[7], line 9 7 import jax 8 import jVMC ----> 9 import jvmc_utilities 10 from functools import partial 11 config.update("jax_enable_x64", True)

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/jvmc_utilities/init.py:3 1 from .operators import initialisation_operators, higher_order_M_T_inv, aqi_model_operators, EfficientPOVMOperator 2 from .measurement import Measurement ----> 3 from .time_evolve import Initializer, copy_state 4 from . import nets 5 from . import plotting

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/jvmc_utilities/time_evolve.py:8 6 import warnings 7 import time ----> 8 from clu import metric_writers 9 import h5py 10 import os

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/init.py:53 51 from clu.metric_writers.logging_writer import LoggingWriter 52 from clu.metric_writers.multi_writer import MultiWriter ---> 53 from clu.metric_writers.summary_writer import SummaryWriter 54 from clu.metric_writers.utils import create_default_writer 55 from clu.metric_writers.utils import write_values

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/summary_writer.py:18 15 """MetricWriter for writing to TF summary files.""" 16 # pylint: disable=unused-import ---> 18 from .tf.summary_writer import SummaryWriter

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/tf/summary_writer.py:37 33 Array = interface.Array 34 Scalar = interface.Scalar ---> 37 class SummaryWriter(interface.MetricWriter): 38 """MetricWriter that writes TF summary files.""" 40 def init(self, logdir: str):

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/tf/summary_writer.py:48, in SummaryWriter() 41 super().init() 42 self._summary_writer = tf.summary.create_file_writer(logdir) 45 def write_summaries( 46 self, 47 step: int, ---> 48 values: Mapping[str, Array], 49 metadata: Optional[Mapping[str, Any]] = None, 50 ): 51 with self._summary_writer.as_default(): 52 for key, value in values.items():

TypeError: 'ABCMeta' object is not subscriptable

Do you have any idea?

Il giorno 28 dic 2023, alle ore 13:56, Laurin Brunner @.***> ha scritto:

Hi Gianluca,

at which point exactly do you get this error? At the import or later in the code?

I suggest to first try if jax runs correctly. Usually I just open a python console, import jax and create a jax array using a = jax.numpy.zeros(10000). You can then see if jax is using your GPU with nvidia-smi. In the next step I would try to import jVMC and maybe run an exercise code that can be found on the jVMC github https://github.com/markusschmitt/vmc_jax.

If all of this works fine, than maybe try to find out at which point in jvmc_utilities this error appears and let me know.

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1871143163, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDP4C45P4767MHOKSQ3LYLVUBPAVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGE2DGMJWGM. You are receiving this because you authored the thread.

glagnese commented 8 months ago

By the way, I am sorry I have bothered you in the holidays.

Thanks again for your help and happy new year!

Best, Gianluca

Il Ven 29 Dic 2023, 14:30 gianluca lagnese @.***> ha scritto:

Hi Laurin,

Thanks again for your help.

Sorry forget about the last email.

I actually get an error when I am importing jvmc_utilities:

Cell In[7], line 9 7 import jax 8 import jVMC----> 9 import jvmc_utilities 10 from functools import partial 11 config.update("jax_enable_x64", True)

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/jvmc_utilities/init.py:3 1 from .operators import initialisation_operators, higher_order_M_T_inv, aqi_model_operators, EfficientPOVMOperator 2 from .measurement import Measurement----> 3 from .time_evolve import Initializer, copy_state 4 from . import nets 5 from . import plotting

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/jvmc_utilities/time_evolve.py:8 6 import warnings 7 import time----> 8 from clu import metric_writers 9 import h5py 10 import os

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/init.py:53 51 from clu.metric_writers.logging_writer import LoggingWriter 52 from clu.metric_writers.multi_writer import MultiWriter---> 53 from clu.metric_writers.summary_writer import SummaryWriter 54 from clu.metric_writers.utils import create_default_writer 55 from clu.metric_writers.utils import write_values

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/summary_writer.py:18 15 """MetricWriter for writing to TF summary files.""" 16 # pylint: disable=unused-import---> 18 from .tf.summary_writer import SummaryWriter

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/tf/summary_writer.py:37 33 Array = interface.Array 34 Scalar = interface.Scalar---> 37 class SummaryWriter(interface.MetricWriter): 38 """MetricWriter that writes TF summary files.""" 40 def init(self, logdir: str):

File ~/anaconda3/envs/jvmc/lib/python3.8/site-packages/clu/metric_writers/tf/summary_writer.py:48, in SummaryWriter() 41 super().init() 42 self._summary_writer = tf.summary.create_file_writer(logdir) 45 def write_summaries( 46 self, 47 step: int,---> 48 values: Mapping[str, Array], 49 metadata: Optional[Mapping[str, Any]] = None, 50 ): 51 with self._summary_writer.as_default(): 52 for key, value in values.items(): TypeError: 'ABCMeta' object is not subscriptable

Do you have any idea?

Il giorno 28 dic 2023, alle ore 13:56, Laurin Brunner < @.***> ha scritto:

Hi Gianluca,

at which point exactly do you get this error? At the import or later in the code?

I suggest to first try if jax runs correctly. Usually I just open a python console, import jax and create a jax array using a = jax.numpy.zeros(10000). You can then see if jax is using your GPU with nvidia-smi. In the next step I would try to import jVMC and maybe run an exercise code that can be found on the jVMC github https://github.com/markusschmitt/vmc_jax.

If all of this works fine, than maybe try to find out at which point in jvmc_utilities this error appears and let me know.

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1871143163, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDP4C45P4767MHOKSQ3LYLVUBPAVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGE2DGMJWGM . You are receiving this because you authored the thread.Message ID: @.***>

laurinbrunner commented 8 months ago

Hey, no problem.

This last error looks like a problem inside tensorboard/clu which I only use for saving results. Since the structure of these results is highly dependent on the specific physical problem I investigate it might not be useful to you anyway. In that case you could do a fork of this github repository and rewrite the code to not use clu.

Otherwise the only idea I have is to look if our package versions differ at one of these packages. I think the following packages are the relevant ones:
clu 0.0.9
tensorflow 2.9.1
tensorboard 2.9.1

The abc module is buitlin in python, so it should just depend on the python version. I am using python version 3.8.16. If this error persists even with the same versions, consider modifying my code for your needs.

I hope this helps you and happy new year.

Best, Laurin

glagnese commented 8 months ago

Hi Laurin,

Thanks again for your help.

I had clu 0.010, now I installed the 0.0.9 version and this solved the last issue. However, I am still getting that XLA error.

I am trying to check what happens with a = jax.numpy.zeros(10000) and I get the following:

2024-01-08 15:27:41.414719: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:439] Could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED 2024-01-08 15:27:41.414764: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:443] Memory usage: 5373952 bytes free, 25393692672 bytes total. 2024-01-08 15:27:41.414797: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:453] Possibly insufficient driver version: 525.147.5

I am not sure, It could be an issue due to the incorrect driver version. I will see what I can do.

Best,

Gianluca

Il giorno 31 dic 2023, alle ore 12:05, Laurin Brunner @.***> ha scritto:

Hey, no problem.

This last error looks like a problem inside tensorboard/clu which I only use for saving results. Since the structure of these results is highly dependent on the specific physical problem I investigate it might not be useful to you anyway. In that case you could do a fork of this github repository and rewrite the code to not use clu.

Otherwise the only idea I have is to look if our package versions differ at one of these packages. I think the following packages are the relevant ones:

clu 0.0.9 tensorflow 2.9.1 tensorboard 2.9.1 The abc module is buitlin in python, so it should just depend on the python version. I am using python version 3.8.16. If this error persists even with the same versions, consider modifying my code for your needs.

I hope this helps you and happy new year.

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1872921498, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDPYTLS3XDPUWPVFC5FDYMFBF5AVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSHEZDCNBZHA. You are receiving this because you authored the thread.

glagnese commented 8 months ago

Hi!

I hope to find you well.

I have installed a different version of the driver, it seems that the problem is solved. I hope not to have other issues.

Thanks again for your help and your patience!

Best, Gianluca

Il giorno 8 gen 2024, alle ore 15:39, gianluca lagnese @.***> ha scritto:

Hi Laurin,

Thanks again for your help.

I had clu 0.010, now I installed the 0.0.9 version and this solved the last issue. However, I am still getting that XLA error.

I am trying to check what happens with a = jax.numpy.zeros(10000) and I get the following:

2024-01-08 15:27:41.414719: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:439] Could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED 2024-01-08 15:27:41.414764: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:443] Memory usage: 5373952 bytes free, 25393692672 bytes total. 2024-01-08 15:27:41.414797: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:453] Possibly insufficient driver version: 525.147.5

I am not sure, It could be an issue due to the incorrect driver version. I will see what I can do.

Best,

Gianluca

Il giorno 31 dic 2023, alle ore 12:05, Laurin Brunner @.***> ha scritto:

Hey, no problem.

This last error looks like a problem inside tensorboard/clu which I only use for saving results. Since the structure of these results is highly dependent on the specific physical problem I investigate it might not be useful to you anyway. In that case you could do a fork of this github repository and rewrite the code to not use clu.

Otherwise the only idea I have is to look if our package versions differ at one of these packages. I think the following packages are the relevant ones:

clu 0.0.9 tensorflow 2.9.1 tensorboard 2.9.1 The abc module is buitlin in python, so it should just depend on the python version. I am using python version 3.8.16. If this error persists even with the same versions, consider modifying my code for your needs.

I hope this helps you and happy new year.

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1872921498, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDPYTLS3XDPUWPVFC5FDYMFBF5AVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSHEZDCNBZHA. You are receiving this because you authored the thread.

glagnese commented 6 months ago

Hi Laurin,

I hope you are doing good.

I would like to ask you something, have you ever thought how to extend your library to 2D?

More precisely, I might have to extend you method jvmc.nets.POVMCNN to 2D. It shouldn’t be too tricky, isn't it?

Thanks for your help.

Best, Gianluca

Il giorno 10 gen 2024, alle ore 10:22, gianluca lagnese @.***> ha scritto:

Hi!

I hope to find you well.

I have installed a different version of the driver, it seems that the problem is solved. I hope not to have other issues.

Thanks again for your help and your patience!

Best, Gianluca

Il giorno 8 gen 2024, alle ore 15:39, gianluca lagnese @.***> ha scritto:

Hi Laurin,

Thanks again for your help.

I had clu 0.010, now I installed the 0.0.9 version and this solved the last issue. However, I am still getting that XLA error.

I am trying to check what happens with a = jax.numpy.zeros(10000) and I get the following:

2024-01-08 15:27:41.414719: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:439] Could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED 2024-01-08 15:27:41.414764: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:443] Memory usage: 5373952 bytes free, 25393692672 bytes total. 2024-01-08 15:27:41.414797: E external/xla/xla/stream_executor/cuda/cuda_dnn.cc:453] Possibly insufficient driver version: 525.147.5

I am not sure, It could be an issue due to the incorrect driver version. I will see what I can do.

Best,

Gianluca

Il giorno 31 dic 2023, alle ore 12:05, Laurin Brunner @.***> ha scritto:

Hey, no problem.

This last error looks like a problem inside tensorboard/clu which I only use for saving results. Since the structure of these results is highly dependent on the specific physical problem I investigate it might not be useful to you anyway. In that case you could do a fork of this github repository and rewrite the code to not use clu.

Otherwise the only idea I have is to look if our package versions differ at one of these packages. I think the following packages are the relevant ones:

clu 0.0.9 tensorflow 2.9.1 tensorboard 2.9.1 The abc module is buitlin in python, so it should just depend on the python version. I am using python version 3.8.16. If this error persists even with the same versions, consider modifying my code for your needs.

I hope this helps you and happy new year.

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1872921498, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDPYTLS3XDPUWPVFC5FDYMFBF5AVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSHEZDCNBZHA. You are receiving this because you authored the thread.

laurinbrunner commented 6 months ago

Hi Gianluca,

no I have not tried to go to 2D but I think it should be relatively easy. For autoregressive networks (such as POVMCNN) you need to define an ordering of the sites through your lattice. You could do this using a 2D filter with masks, see for example the PixelCNN architecture.

Best, Laurin

glagnese commented 6 months ago

Hi Laurin,

Thanks a lot for your help.

Ok, so I will try to understand a bit deeper the implementation. I guess I have to modify class POVMCNN.

But, the philosophy of your code is still the same as described here https://journals.aps.org/prresearch/pdf/10.1103/PhysRevResearch.2.023358. Am I correct? Only you have implemented a different architecture?

Thanks again,

Gianluca

Il giorno 14 mar 2024, alle ore 12:04, Laurin Brunner @.***> ha scritto:

Hi Gianluca,

no I have not tried to go to 2D but I think it should be relatively easy. For autoregressive networks (such as POVMCNN) you need to define an ordering of the sites through your lattice. You could do this using a 2D filter with masks, see for example the PixelCNN architecture.

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1997185282, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDP2SWERRWMT7YXDWZVDYYF745AVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJXGE4DKMRYGI. You are receiving this because you authored the thread.

laurinbrunner commented 6 months ago

Hi Gianluca,

no, I would say that there is a deeper difference between the cited paper and my code, than just the difference in network architecture. For one the paper works on wavefunction where I work on density matrices, which adds further complications and is here done by utilizing POVMs. Furthermore this code can calculate the time evolution of an open quantum system instead of just the ground-state properties. To do time evolution jVMC relies on a TDVP equation.

For further information I suggest the papers by the creators of the jVMC package: https://arxiv.org/pdf/1912.08828.pdf https://arxiv.org/pdf/2104.00013.pdf

Best, Laurin

glagnese commented 6 months ago

Hi Laurin,

Sorry for the delay.

I am aware of such difference. I am actually using the jVMC library to simulate open system dynamics, I know your code provides an ansatz for the POVM, so essentially works in the operator space.

I was just trying to understand the logic behind the ansatz, as I don’t have previous experience with autoregressive networks.

Thanks again for your help.

Take care,

Gianluca

Il giorno 14 mar 2024, alle ore 17:32, Laurin Brunner @.***> ha scritto:

Hi Gianluca,

no, I would say that there is a deeper difference between the cited paper and my code, than just the difference in network architecture. For one the paper works on wavefunction where I work on density matrices, which adds further complications and is here done by utilizing POVMs. Furthermore this code can calculate the time evolution of an open quantum system instead of just the ground-state properties. To do time evolution jVMC relies on a TDVP equation.

For further information I suggest the papers by the creators of the jVMC package: https://arxiv.org/pdf/1912.08828.pdf https://arxiv.org/pdf/2104.00013.pdf

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1997860976, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDP6F3L5HDOLAEUXXPALYYHGJJAVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJXHA3DAOJXGY. You are receiving this because you authored the thread.

glagnese commented 2 months ago

Dear Laurin,

I hope to find you well.

I noticed that your code is predisposed to implement symmetries. I mean this part:

    if self.orbit is not None:
        # Symmetry case
        x = jax.vmap(lambda o, s: jnp.dot(o, s), in_axes=(0, None))(self.orbit.orbit, x)

        res = jnp.mean(jnp.exp(jax.vmap(evaluate)(x) / self.logProbFactor), axis=0)

        return self.logProbFactor * jnp.log(res)

I am sorry to bother you again. In my case I would like to implement reflection symmetry. Can I ask you to give me a hint of how this self.orbit should be defined to introduce the symmetry?

All the best,

Gianluca

Il giorno 20 mar 2024, alle ore 11:25, gianluca lagnese @.***> ha scritto:

Hi Laurin,

Sorry for the delay.

I am aware of such difference. I am actually using the jVMC library to simulate open system dynamics, I know your code provides an ansatz for the POVM, so essentially works in the operator space.

I was just trying to understand the logic behind the ansatz, as I don’t have previous experience with autoregressive networks.

Thanks again for your help.

Take care,

Gianluca

Il giorno 14 mar 2024, alle ore 17:32, Laurin Brunner @.***> ha scritto:

Hi Gianluca,

no, I would say that there is a deeper difference between the cited paper and my code, than just the difference in network architecture. For one the paper works on wavefunction where I work on density matrices, which adds further complications and is here done by utilizing POVMs. Furthermore this code can calculate the time evolution of an open quantum system instead of just the ground-state properties. To do time evolution jVMC relies on a TDVP equation.

For further information I suggest the papers by the creators of the jVMC package: https://arxiv.org/pdf/1912.08828.pdf https://arxiv.org/pdf/2104.00013.pdf

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-1997860976, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDP6F3L5HDOLAEUXXPALYYHGJJAVCNFSM6AAAAABBENWSTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJXHA3DAOJXGY. You are receiving this because you authored the thread.

laurinbrunner commented 2 months ago

Hello Gianluca,

using a LatticeSymmetry object is the way I chose to implement symmetries for autoregressive networks, where it is hard to build them into the architecture of the network itself. The idea behind this is that the output of the network is the averaged output for all conifgurations that are connected by the symmetries. It is easiest to do with spacial symmetries (e.g. translational or reflection) but maybe there is a way to do others aswell. I create self.orbit with the function get_orbit_aqi_translation in symmetry.py. As you can see I constructed a translational symmetry that moves all particles by increments of two sites. The main thing that the LatticeSymmetry object want is a matrix that transforms a configuration into all other configurations connected via the symmetry. So you need to build a matrix that does all possible reflections on a configuration. The second argument for LatticeSymmetry is a matrix of weighting factors, if for some physical reason you want to weight some of the resulting configurations differently.

In jVMC a reflection in the 1D case is already implemented (see function get_orbit_1D in jVMC/util/symmetry.py ). Maybe this is enough already or at least a good starting point for you.

Best, Laurin

glagnese commented 2 months ago

Hi Laurin,

Thanks for the clear explanation!

It actually looks very linear then, I have implemented it. Now I am doing some test.

Thanks again for your help.

Best,

Gianluca

Il giorno 22 lug 2024, alle ore 11:08, Laurin Brunner @.***> ha scritto:

Hello Gianluca,

using a LatticeSymmetry object is the way I chose to implement symmetries for autoregressive networks, where it is hard to build them into the architecture of the network itself. The idea behind this is that the output of the network is the averaged output for all conifgurations that are connected by the symmetries. It is easiest to do with spacial symmetries (e.g. translational or reflection) but maybe there is a way to do others aswell. I create self.orbit with the function get_orbit_aqi_translation in symmetry.py. As you can see I constructed a translational symmetry that moves all particles by increments of two sites. The main thing that the LatticeSymmetry object want is a matrix that transforms a configuration into all other configurations connected via the symmetry. So you need to build a matrix that does all possible reflections on a configuration. The second argument for LatticeSymmetry is a matrix of weighting factors, if for some physical reason you want to weight some of the resulting configurations differently.

In jVMC https://github.com/markusschmitt/vmc_jax/ a reflection in the 1D case is already implemented (see function get_orbit_1D in jVMC https://github.com/markusschmitt/vmc_jax/tree/v1.2.5/jVMC/util https://github.com/markusschmitt/vmc_jax/tree/v1.2.5/jVMC/util//symmetry.py https://github.com/markusschmitt/vmc_jax/tree/v1.2.5/jVMC/util/symmetries.py ). Maybe this is enough already or at least a good starting point for you.

Best, Laurin

— Reply to this email directly, view it on GitHub https://github.com/laurinbrunner/jvmc_utilities/issues/27#issuecomment-2242462514, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OGDP2FOLRH7TNK6FUDPP3ZNTDX5AVCNFSM6AAAAABLHYNJ5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBSGQ3DENJRGQ. You are receiving this because you authored the thread.