<jupyter_start><jupyter_text>Settings<jupyter_code>params = TrainerParameters()
params.folder = 'results/'
params.comment = 'BasicIllustration'
params.debug = False
params.Iterations = 15000
params.identifier = 'highres32'
params.trainer['lr_init'] = 1e-2
params.trainer['N_PE_updates'] = 3 
params.trainer['N_monte_carlo_analysis'] = 64  
params.trainer['N_monte_carlo_analysis_final'] = 1024 
params.trainer['N_monitor_interval'] = 1000
params.trainer['N_PE_updates_final'] = 250  
params.trainer['N_tensorboard_logging_interval'] = 1000

params.margs['dim_latent'] = 16
params.margs['ptype'] = 'NDP'
params.margs['device'] = 'best'

params.trainer['N_vo_update_interval'] = 250
params.trainer['N_vo_holdoff'] = 250  # 1000
params.trainer['N_monte_carlo_vo'] = 128

params.scheduler['milestones'] = [250, 1500]
params.scheduler['factor'] = math.sqrt(0.1)

########### DATA AND VO ##############
params.data['N_u'] = 1024
params.data['N_s'] = 128
params.data['N_u_max'] = 2048
params.data['N_s_max'] = 128
params.data['N_vo_max'] = 128
params.data['N_vo'] = 0
params.data['N_val'] = 128
params.data['armortized_bs'] = 64
params.data['vo_spec'] = dict()<jupyter_output><empty_output><jupyter_text>Create trainerLoad data, and create trainer (with the generative model being created in the background). Use stochastic variational inference for optimization of the ELBO.<jupyter_code># get data for training and validation
df = DataFactory.FromIdentifier(params.identifier)
dl, dlu = df.setup()

# create trainer
trainer = CreateTrainer(params, dl, dlu)
# run trainer
trainer.run(params.Iterations, verbose=False)<jupyter_output>100%|██████████| 15000/15000 [07:01<00:00, 35.57it/s]<jupyter_text>Training<jupyter_code>trainer.plot_elbo(figsize=(6,4))
print("Achieved relative error: {}".format(trainer.results()['r2_y']))
print("Achieved predictive logscore: {}".format(trainer.results()['logscore_y']))<jupyter_output>Achieved relative error: 0.9799582958221436
Achieved predictive logscore: 2.329190492630005<jupyter_text>Examples: Mean prediction vs. reference (on validation dataset)<jupyter_code>Plot2D(trainer, [0,7,8])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1583836507199257, 'fraction_numerical': 0.06456107756618672, 'mean_word_length': 8.127118644067796, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '419818', 'license': 'MIT', 'n_tokens_mistral': 896, 'n_tokens_neox': 771, 'n_words': 135, 'path': 'example.ipynb', 'repo_name': 'bdevl/PGMCPC', 'size': '2153'}