tutorials.examples.train_hypergrid_exploration_examples

A simplified version of GFlowNet training on the HyperGrid environment, focusing on the core concepts. This script implements Trajectory Balance (TB) training with minimal features to aid understanding.

Example usage: python train_hypergrid_simple.py –ndim 2 –height 8 –epsilon 0.1

Key differences from the full version: - Only implements TB loss - No wandb integration - Simpler architecture with shared trunks - Basic command line options

Attributes

parser

Functions

_print_mode_stats(env)

build_gflownet(preprocessor, env[, uniform_pb, ...])

main(args)

print_final_results(all_results[, width])

Print final results in a pretty formatted table.

train(env, preprocessor, device, lr, lr_logz, ...)

Module Contents

tutorials.examples.train_hypergrid_exploration_examples._print_mode_stats(env)
Parameters:

env (gfn.env.Env)

tutorials.examples.train_hypergrid_exploration_examples.build_gflownet(preprocessor, env, uniform_pb=False, n_hidden_layers=3, n_noisy_layers=0, std_init=0.5)
Parameters:
tutorials.examples.train_hypergrid_exploration_examples.main(args)
tutorials.examples.train_hypergrid_exploration_examples.parser
tutorials.examples.train_hypergrid_exploration_examples.print_final_results(all_results, width=80)

Print final results in a pretty formatted table.

Parameters:
  • all_results (pandas.DataFrame)

  • width (int)

tutorials.examples.train_hypergrid_exploration_examples.train(env, preprocessor, device, lr, lr_logz, batch_size, n_iterations, epsilon, temperature, use_noisy_layers, use_replay_buffer, seed, uniform_pb, validation_interval, validation_samples)
Parameters:
  • env (gfn.env.Env)

  • preprocessor (gfn.preprocessors.KHotPreprocessor)

  • device (torch.device)

  • lr (float)

  • lr_logz (float)

  • batch_size (int)

  • n_iterations (int)

  • epsilon (float)

  • temperature (float)

  • use_noisy_layers (bool)

  • use_replay_buffer (bool)

  • seed (int)

  • uniform_pb (bool)

  • validation_interval (int)

  • validation_samples (int)