tutorials.examples.train_bitsequence_non_autoregressive¶
Train a GFlowNet on the non-autoregressive BitSequence environment.
This example trains a Trajectory Balance GFlowNet on the non-autoregressive BitSequence environment, where actions encode (position, word) pairs and positions can be filled in any order.
The environment generates binary sequences and rewards those close (in Hamming distance) to a set of target “mode” sequences. The non-autoregressive formulation creates a richer DAG structure compared to the standard autoregressive (left-to-right) version, since the same terminal state can be reached via multiple orderings of position fills.
- Usage:
python tutorials/examples/train_bitsequence_non_autoregressive.py python tutorials/examples/train_bitsequence_non_autoregressive.py –seq_size 8 –word_size 2 –n_modes 4
Attributes¶
Functions¶
|
Compute L1 distance between learned and true distributions. |
|
Module Contents¶
- tutorials.examples.train_bitsequence_non_autoregressive.DEFAULT_SEED = 4444¶
- tutorials.examples.train_bitsequence_non_autoregressive.evaluate_l1(gflownet, env)¶
Compute L1 distance between learned and true distributions.
Only feasible for small environments (seq_size <= ~12).
- Parameters:
gflownet (gfn.gflownet.PFBasedGFlowNet) – Trained GFlowNet.
env (gfn.gym.NonAutoregressiveBitSequence) – The environment.
- Returns:
Mean absolute difference between estimated and true distributions.
- Return type:
float
- tutorials.examples.train_bitsequence_non_autoregressive.main(args)¶
- tutorials.examples.train_bitsequence_non_autoregressive.parser¶