tutorials.examples.train_bitsequence_non_autoregressive ======================================================= .. py:module:: tutorials.examples.train_bitsequence_non_autoregressive .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: tutorials.examples.train_bitsequence_non_autoregressive.DEFAULT_SEED tutorials.examples.train_bitsequence_non_autoregressive.parser Functions --------- .. autoapisummary:: tutorials.examples.train_bitsequence_non_autoregressive.evaluate_l1 tutorials.examples.train_bitsequence_non_autoregressive.main Module Contents --------------- .. py:data:: DEFAULT_SEED :value: 4444 .. py:function:: evaluate_l1(gflownet, env) Compute L1 distance between learned and true distributions. Only feasible for small environments (seq_size <= ~12). :param gflownet: Trained GFlowNet. :param env: The environment. :returns: Mean absolute difference between estimated and true distributions. .. py:function:: main(args) .. py:data:: parser