---
title: "🔳 <code>l2hmc-qcd</code> Example: 4D SU(3)"
date: 2023-12-06
jupyter:
jupytext:
formats: 'ipynb,py,qmd'
text_representation:
extension: .qmd
format_name: quarto
format_version: '1.0'
jupytext_version: 1.16.2
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---
## Imports
```python
# %load_ext autoreload
# %autoreload 2
# %matplotlib inline
import os
from pathlib import Path
from typing import Optional
import logging
import matplotlib_inline
import matplotlib.pyplot as plt
import torch
import yaml
import ambivalent
import numpy as np
import lovely_tensors as lt
lt.monkey_patch()
matplotlib_inline.backend_inline.set_matplotlib_formats('svg' )
os.environ['CUDA_VISIBLE_DEVICES' ] = '6'
os.environ['COLORTERM' ] = 'truecolor;'
port = np.random.randint(5000 , 6000 )
os.environ['MASTER_PORT' ] = f" { port} "
log_config = get_logging_config()
log = logging.getLogger('name' )
log.setLevel("INFO" )
from l2hmc.utils.dist import setup_torch
RANK = setup_torch(precision= 'float64' , backend= 'DDP' , seed= 4351 )
plt.style.use(ambivalent.STYLES["ambivalent" ])
plt.rcParams['figure.figsize' ] = plt.rcParamsDefault['figure.figsize' ]
```
<!-- ```{python} -->
<!-- import ezpz as ez -->
<!-- ``` -->
<!-- ::: {.callout-tip icon="false" title="output:", style="style="width:100%; background-color: var(--bg-transparent)!important; border-color: var(--collapsed-border-color)!important;"} -->
::: {.callout-tip icon=false aria-title="output" title='[ `output`: ] {.dim-text}' collapse="true" style="text-align: left!important; width:100%; background-color:rgba(131,131,131,0.05)!important; border: 1px solid rgba(131,131,131,0.3)!important; opacity:100%;"}
::: {.cell-output .cell-output-display}
[ Sams-MacBook-Pro.local:56401 ] shmem: mmap: an error occurred while determining whether or not /var/folders/53/5t2nv83136j76rld14vgfh2h0000gq/T//ompi.Sams-MacBook-Pro.503/jf.0/226820096/sm_segment.Sams-MacBook-Pro.503.d850000.0 could be created.
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:34</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">__init__</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">136</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Setting logging level to <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'INFO'</span> on <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'RANK == 0'</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:34</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">__init__</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">137</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Setting logging level to <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'CRITICAL'</span> on <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'RANK != 0'</span><br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:34</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">__init__</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">138</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>To disable this behavior, and log from ALL ranks <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>not recommended<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">)</span>, set: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'export LOG_FROM_ALL_RANKS=1'</span> in your environment, and re-run.<br>
Using device: cpu
[ 2024-07-04 11:44:38,445 ] [INFO] [ real_accelerator.py:203:get_accelerator ] Setting ds_accelerator to mps (auto detect)
W0704 11:44:39.287000 8461388800 torch/distributed/elastic/multiprocessing/redirects.py:27] NOTE: Redirects are currently not supported in Windows or MacOs.
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #F4511E; text-decoration-color: #F4511E">WARNING</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">dist</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">332</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Setting default dtype: float64
<br>
:::
:::
```python
def savefig(fig: plt.Figure, fname: str , outdir: os.PathLike):
pngfile = Path(outdir).joinpath(f"pngs/ { fname} .png" )
svgfile = Path(outdir).joinpath(f"svgs/ { fname} .svg" )
pngfile.parent.mkdir(exist_ok= True , parents= True )
svgfile.parent.mkdir(exist_ok= True , parents= True )
fig.savefig(svgfile, transparent= True , bbox_inches= 'tight' )
fig.savefig(pngfile, transparent= True , bbox_inches= 'tight' , dpi= 300 )
```
```python
def plot_metrics(metrics: dict , title: Optional[str ] = None , ** kwargs):
from l2hmc.utils.rich import is_interactive
from l2hmc.configs import QUARTO_OUTPUTS_DIR
outdir = Path(f" { QUARTO_OUTPUTS_DIR} /plots-4dSU3/ { title} " )
outdir.mkdir(exist_ok= True , parents= True )
for key, val in metrics.items():
fig, ax = plot_metric(val, name= key, ** kwargs)
if title is not None :
ax.set_title(title)
log.info(f"Saving { key} to { outdir} " )
savefig(fig, f" { key} " , outdir= outdir)
if not is_interactive():
plt.show()
```
```python
def plot_metric(
metric: torch.Tensor,
name: Optional[str ] = None ,
** kwargs,
):
assert len (metric) > 0
if isinstance (metric[0 ], (int , float , bool , np.floating)):
y = np.stack(metric)
return plot_scalar(y, ylabel= name, ** kwargs)
element_shape = metric[0 ].shape
if len (element_shape) == 2 :
if isinstance (metric, torch.Tensor):
y = grab_tensor(torch.stack(metric))
else :
y = np.stack(metric)
return plot_leapfrogs(y, ylabel= name)
if len (element_shape) == 1 :
if isinstance (metric, torch.Tensor):
y = grab_tensor(torch.stack(metric))
else :
y = np.stack(metric)
return plot_chains(y, ylabel= name, ** kwargs)
if len (element_shape) == 0 :
if isinstance (metric, torch.Tensor):
y = grab_tensor(torch.stack(metric))
else :
y = np.stack(metric)
return plot_scalar(y, ylabel= name, ** kwargs)
raise ValueError
```
```python
def main():
from l2hmc.experiment.pytorch.experiment import train_step
from l2hmc.configs import CONF_DIR
su3conf = Path(CONF_DIR).joinpath('su3-min-cpu.yaml' )
assert su3conf.is_file()
# su3conf = Path('su3-min-cpu.yaml')
with su3conf.open ('r' ) as stream:
conf = dict (yaml.safe_load(stream))
log.info(conf)
overrides = dict_to_list_of_overrides(conf)
ptExpSU3 = get_experiment(overrides= [* overrides], build_networks= True )
state = ptExpSU3.trainer.dynamics.random_state(6.0 )
assert isinstance (state.x, torch.Tensor)
assert isinstance (state.beta, torch.Tensor)
assert isinstance (ptExpSU3, Experiment)
xhmc, history_hmc = evaluate(
nsteps= 100 ,
exp= ptExpSU3,
beta= state.beta,
x= state.x,
eps= 0.1 ,
nleapfrog= 1 ,
job_type= 'hmc' ,
nlog= 1 ,
nprint= 2 ,
grab= True
)
xhmc = ptExpSU3.trainer.dynamics.unflatten(xhmc)
log.info(f"checkSU(x_hmc): { g. checkSU(xhmc)} " )
plot_metrics(history_hmc.history, title= 'HMC' , marker= '.' )
# ptExpSU3.trainer.dynamics.init_weights(
# method='uniform',
# min=-1e-16,
# max=1e-16,
# bias=True,
# # xeps=0.001,
# # veps=0.001,
# )
xeval, history_eval = evaluate(
nsteps= 10 ,
exp= ptExpSU3,
beta= 6.0 ,
x= state.x,
job_type= 'eval' ,
nlog= 1 ,
nprint= 2 ,
grab= True ,
)
xeval = ptExpSU3.trainer.dynamics.unflatten(xeval)
log.info(f"checkSU(x_eval): { g. checkSU(xeval)} " )
plot_metrics(history_eval.history, title= 'Evaluate' , marker= '.' )
history = {}
x = state.x
for step in range (20 ):
log.info(f'TRAIN STEP: { step} ' )
x, metrics = ptExpSU3.trainer.train_step((x, state.beta))
if (step > 0 and step % 2 == 0 ):
print_dict(metrics, grab= True )
if (step > 0 and step % 1 == 0 ):
for key, val in metrics.items():
try :
history[key].append(val)
except KeyError :
history[key] = [val]
x = ptExpSU3.trainer.dynamics.unflatten(x)
log.info(f"checkSU(x_train): { g. checkSU(x)} " )
plot_metrics(history, title= 'train' , marker= '.' )
#
# for step in range(20):
# log.info(f"train step: {step}")
# x, metrics = ptExpSU3.trainer.train_step((x, state.beta))
# if step % 5 == 0:
# print_dict(metrics, grab=True)
return x, history
```
```python
# main()
from l2hmc.experiment.pytorch.experiment import train_step
from l2hmc.configs import CONF_DIR
su3conf = Path(CONF_DIR).joinpath('su3-min-cpu.yaml' )
assert su3conf.is_file()
# su3conf = Path('./conf/su3-min-cpu.yaml')
with su3conf.open ('r' ) as stream:
conf = dict (yaml.safe_load(stream))
log.info(conf)
overrides = dict_to_list_of_overrides(conf)
ptExpSU3 = get_experiment(overrides= [* overrides], build_networks= True )
```
::: {.callout-tip icon=false aria-title="output" title='[ `output`: ] {.dim-text}' collapse="true" style="text-align: left!important; width:100%; background-color:rgba(131,131,131,0.05)!important; border: 1px solid rgba(131,131,131,0.3)!important; opacity:100%;"}
::: {.cell-output .cell-output-display}
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1705502108</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">11</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'annealing_schedule'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'beta_final'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">6.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'beta_init'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">6.0</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'backend'</span>: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'DDP'</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'conv'</span>: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'none'</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'dynamics'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'eps'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.1</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'eps_fixed'</span>: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">True</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'group'</span>: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'SU3'</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'latvolume'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'nchains'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'nleapfrog'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'use_separate_networks'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'use_split_xnets'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'verbose'</span>: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">True</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'framework'</span>: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'pytorch'</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'init_aim'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'init_wandb'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'learning_rate'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'clip_norm'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'lr_init'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1e-05</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'loss'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'charge_weight'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'plaq_weight'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'rmse_weight'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'use_mixed_loss'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'net_weights'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'v'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'q'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'s'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'t'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1.0</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'x'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'q'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'s'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'t'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.0</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'network'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'activation_fn'</span>: <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'tanh'</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'dropout_prob'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.0</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'units'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'use_batch_norm'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'restore'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'save'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'steps'</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">{</span><span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'log'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'nepoch'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">10</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'nera'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'print'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'test'</span>: <span style="color: #ff00ff; text-decoration-color: #ff00ff">50</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'use_tb'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>, <span style="color: #2196F3; text-decoration-color: #2196F3; font-style: italic">'use_wandb'</span>: <span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">}</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #F4511E; text-decoration-color: #F4511E">WARNING</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">trainer</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">467</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Using torch.float32 on cpu!
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #F4511E; text-decoration-color: #F4511E">WARNING</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">trainer</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">467</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Using `torch.optim.Adam` optimizer
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #F4511E; text-decoration-color: #F4511E">WARNING</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">trainer</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">271</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>logging with freq <span style="color: #ff00ff; text-decoration-color: #ff00ff">1</span> for wandb.watch
<br>
:::
:::
```python
state = ptExpSU3.trainer.dynamics.random_state(6.0 )
assert isinstance (state.x, torch.Tensor)
assert isinstance (state.beta, torch.Tensor)
assert isinstance (ptExpSU3, Experiment)
```
```python
log.info(f"checkSU(x): { g. checkSU(state.x)} " )
```
::: {.callout-tip icon=false aria-title="output" title='[ `output`: ] {.dim-text}' collapse="true" style="text-align: left!important; width:100%; background-color:rgba(131,131,131,0.05)!important; border: 1px solid rgba(131,131,131,0.3)!important; opacity:100%;"}
::: {.cell-output .cell-output-display}
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">2027559912</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">1</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">checkSU</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>x<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">)</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">3.013e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">2.845e-07</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">9.867e-08</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">1.240e-07</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">3.862e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">4.138e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">2.845e-07</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">3.013e-08</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span>, tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">5.401e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.683e-07</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">1.875e-07</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">2.539e-07</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">6.819e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.958e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.683e-07</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.401e-08</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] )</span>
<br>
:::
:::
```python
xhmc, history_hmc = evaluate(
nsteps= 10 ,
exp= ptExpSU3,
beta= state.beta,
x= state.x,
eps= 0.1 ,
nleapfrog= 1 ,
job_type= 'hmc' ,
nlog= 1 ,
nprint= 2 ,
grab= True
)
xhmc = ptExpSU3.trainer.dynamics.unflatten(xhmc)
log.info(f"checkSU(x_hmc): { g. checkSU(xhmc)} " )
plot_metrics(history_hmc.history, title= 'HMC' , marker= '.' )
```
::: {.callout-tip icon=false aria-title="output" title='[ `output`: ] {.dim-text}' collapse="true" style="text-align: left!important; width:100%; background-color:rgba(131,131,131,0.05)!important; border: 1px solid rgba(131,131,131,0.3)!important; opacity:100%;"}
::: {.cell-output .cell-output-display}
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">2419635544</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">14</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">checkSU</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>x_hmc<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">)</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">2.341e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">3.604e-16</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">2.931e-16</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">5.613e-17</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">2.341e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">3.604e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">2.624e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">3.153e-16</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span>, tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">3.575e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.398e-16</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">4.280e-16</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">8.496e-17</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">3.575e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">4.483e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">3.665e-16</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.398e-16</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] )</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:39</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving energy to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:40</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving logprob to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:40</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving logdet to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:40</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving acc to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:40</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving sumlogdet to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:41</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving acc_mask to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:41</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving plaqs to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:41</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving sinQ to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:41</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving intQ to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:42</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving dQint to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:42</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving dQsin to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:42</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving loss to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">HMC</span>
<br>
![](./assets/cell-11-output-14.svg)
![](./assets/cell-11-output-15.svg)
![](./assets/cell-11-output-16.svg)
![](./assets/cell-11-output-17.svg)
![](./assets/cell-11-output-18.svg)
![](./assets/cell-11-output-19.svg)
![](./assets/cell-11-output-20.svg)
![](./assets/cell-11-output-21.svg)
![](./assets/cell-11-output-22.svg)
![](./assets/cell-11-output-23.svg)
![](./assets/cell-11-output-24.svg)
![](./assets/cell-11-output-25.svg)
<!-- ![](output_9_13.png) -->
<!---->
<!-- ![](output_9_14.png) -->
<!---->
<!-- ![](output_9_15.png) -->
<!---->
<!-- ![](output_9_16.png) -->
<!---->
<!-- ![](output_9_17.png) -->
<!---->
<!-- ![](output_9_18.png) -->
<!---->
<!-- ![](output_9_19.png) -->
<!---->
<!-- ![](output_9_20.png) -->
<!---->
<!-- ![](output_9_21.png) -->
<!---->
<!-- ![](output_9_22.png) -->
<!---->
<!-- ![](output_9_23.png) -->
<!---->
<!-- ![](output_9_24.png) -->
:::
:::
```python
# ptExpSU3.trainer.dynamics.init_weights(
# method='uniform',
# min=-1e-16,
# max=1e-16,
# bias=True,
# # xeps=0.001,
# # veps=0.001,
# )
xeval, history_eval = evaluate(
nsteps= 500 ,
exp= ptExpSU3,
beta= 6.0 ,
x= state.x,
job_type= 'eval' ,
nlog= 2 ,
nprint= 5 ,
grab= True ,
)
xeval = ptExpSU3.trainer.dynamics.unflatten(xeval)
log.info(f"checkSU(x_eval): { g. checkSU(xeval)} " )
plot_metrics(history_eval.history, title= 'Evaluate' , marker= '.' )
```
::: {.callout-tip icon=false aria-title="output" title='[ `output`: ] {.dim-text}' collapse="true" style="text-align: left!important; width:100%; background-color:rgba(131,131,131,0.05)!important; border: 1px solid rgba(131,131,131,0.3)!important; opacity:100%;"}
::: {.cell-output .cell-output-display}
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:43</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1629827420</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">20</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">checkSU</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>x_eval<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">)</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">9.602e-14</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.024</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">0.009</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">0.012</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">0.024</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">2.063e-13</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.014</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">9.602e-14</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span>, tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">1.796e-13</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.034</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">0.013</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">0.016</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">0.034</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">3.935e-13</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">0.016</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">1.796e-13</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] )</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:43</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving energy to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:43</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving logprob to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:44</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving logdet to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:44</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving sldf to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:44</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving sldb to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:44</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving sld to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:45</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving xeps to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:45</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving veps to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:45</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving acc to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:45</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving sumlogdet to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:45</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving beta to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:46</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving acc_mask to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:46</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving plaqs to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:46</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving sinQ to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:46</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving intQ to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:47</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving dQint to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:47</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving dQsin to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
<span style="color:#333333;">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:47</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">1984252221</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">10</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span>Saving loss to <span style="color: #008000; text-decoration-color: #008000">/Users/samforeman/projects/saforem2/l2hmc-qcd/qmd/outputs/plots-4dSU3/</span><span style="color: #800080; text-decoration-color: #800080">Evaluate</span>
<br>
![](./assets/cell-12-output-20.svg)
![](./assets/cell-12-output-21.svg)
![](./assets/cell-12-output-22.svg)
![](./assets/cell-12-output-23.svg)
![](./assets/cell-12-output-24.svg)
![](./assets/cell-12-output-25.svg)
![](./assets/cell-12-output-26.svg)
![](./assets/cell-12-output-27.svg)
![](./assets/cell-12-output-28.svg)
![](./assets/cell-12-output-29.svg)
![](./assets/cell-12-output-30.svg)
![](./assets/cell-12-output-31.svg)
![](./assets/cell-12-output-32.svg)
![](./assets/cell-12-output-33.svg)
![](./assets/cell-12-output-34.svg)
![](./assets/cell-12-output-35.svg)
![](./assets/cell-12-output-36.svg)
![](./assets/cell-12-output-37.svg)
<!---->
<!-- ![](output_10_19.png) -->
<!---->
<!-- ![](output_10_20.png) -->
<!---->
<!-- ![](output_10_21.png) -->
<!---->
<!-- ![](output_10_22.png) -->
<!---->
<!-- ![](output_10_23.png) -->
<!---->
<!-- ![](output_10_24.png) -->
<!---->
<!-- ![](output_10_25.png) -->
<!---->
<!-- ![](output_10_26.png) -->
<!---->
<!-- ![](output_10_27.png) -->
<!---->
<!-- ![](output_10_28.png) -->
<!---->
<!-- ![](output_10_29.png) -->
<!---->
<!-- ![](output_10_30.png) -->
<!---->
<!-- ![](output_10_31.png) -->
<!---->
<!-- ![](output_10_32.png) -->
<!---->
<!-- ![](output_10_33.png) -->
<!---->
<!-- ![](output_10_34.png) -->
<!---->
<!-- ![](output_10_35.png) -->
<!---->
<!-- ![](output_10_36.png) -->
:::
:::
```python
x = ptExpSU3.trainer.dynamics.unflatten(state.x)
log.info(f"checkSU(x_train): { g. checkSU(x)} " )
# plot_metrics(history, title='train', marker='.')
```
::: {.callout-tip icon=false aria-title="output" title='[ `output`: ] {.dim-text}' collapse="true" style="text-align: left!important; width:100%; background-color:rgba(131,131,131,0.05)!important; border: 1px solid rgba(131,131,131,0.3)!important; opacity:100%;"}
::: {.cell-output .cell-output-display}
<span style="color: #-000001; text-decoration-color: #000000">[ </span><span style="color: #808080; text-decoration-color: #808080">2024-07-04 11:44:49</span><span style="color:#333333;"> ][</span><span style="color: #008000; text-decoration-color: #008000; font-weight: bold">INFO</span><span style="color:#333333;">][ </span><span style="color: #008080; text-decoration-color: #008080; font-style: italic">3331171632</span><span style="color: #2196F3; text-decoration-color: #2196F3">:</span><span style="color:#333333;">2</span><span style="color:#333333;"> ] </span><span style="color: #333333; text-decoration-color: #333333; font-weight: bold"> - </span><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">checkSU</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>x_train<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">)</span>: <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">(</span>tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">3.013e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">2.845e-07</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">9.867e-08</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">1.240e-07</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">3.862e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">4.138e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">2.845e-07</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">3.013e-08</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span>, tensor<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">4</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> f64 x∈<span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">5.401e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.683e-07</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] </span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">μ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">1.875e-07</span> <span style="color: #0000ff; text-decoration-color: #0000ff; font-style: italic">σ</span>=<span style="color: #ff00ff; text-decoration-color: #ff00ff">2.539e-07</span> <span style="color: #666666; text-decoration-color: #666666; font-weight: bold">[ </span><span style="color: #ff00ff; text-decoration-color: #ff00ff">6.819e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.958e-08</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.683e-07</span>, <span style="color: #ff00ff; text-decoration-color: #ff00ff">5.401e-08</span><span style="color: #666666; text-decoration-color: #666666; font-weight: bold"> ] )</span>
:::
:::