code: def build_experiment_config():
      """Builds R2D2 experiment config which can be executed in different ways."""
      batch_size = 32
  
      # The env_name must be dereferenced outside the environment factory as FLAGS
      # cannot be pickled and pickling is necessary when launching distributed
      # experiments via Launchpad.
      env_name = FLAGS.env_name
  
      # Create an environment factory.
      def environment_factory(seed: int) -> dm_env.Environment:
          del seed
          return helpers.make_atari_environment(
              level=env_name,
              sticky_actions=True,
              zero_discount_on_life_loss=False,
              oar_wrapper=True,
              num_stacked_frames=1,
              flatten_frame_stack=True,
              grayscaling=False,
          )
  
      # Configure the agent.
      config = r2d2.R2D2Config(
          burn_in_length=8,
          trace_length=40,
          sequence_period=20,
          min_replay_size=10_000,
          batch_size=batch_size,
          prefetch_size=1,
          samples_per_insert=1.0,
          evaluation_epsilon=1e-3,
          learning_rate=1e-4,
          target_update_period=1200,
          variable_update_period=100,
      )
  
      return experiments.ExperimentConfig(
          builder=r2d2.R2D2Builder(config),
          network_factory=r2d2.make_atari_networks,
          environment_factory=environment_factory,
          seed=FLAGS.seed,
          max_num_actor_steps=FLAGS.num_steps,
      )
  
file_path: acme/examples/baselines/rl_discrete/run_r2d2.py
imports: from absl import flags
  from acme.agents.jax import r2d2
  import helpers
  from absl import app
  from acme.jax import experiments
  from acme.utils import lp_utils
  import dm_env
  import launchpad
label_desc: Use image node_id 1 for calling a global function with example usage: build_experiment_config() and returns: experiments, helpers