class_docstr: Pipeline for value-guided sampling from a diffusion model trained to predict sequences of states.
  
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
  implemented for all pipelines (downloading, saving, running on a particular device, etc.).
  
  Parameters:
      value_function ([`UNet1DModel`]):
          A specialized UNet for fine-tuning trajectories base on reward.
      unet ([`UNet1DModel`]):
          UNet architecture to denoise the encoded trajectories.
      scheduler ([`SchedulerMixin`]):
          A scheduler to be used in combination with `unet` to denoise the encoded trajectories. Default for this
          application is [`DDPMScheduler`].
      env ():
          An environment following the OpenAI gym API to act in. For now only Hopper has pretrained models.
code: def __call__(
      self,
      obs,
      batch_size=64,
      planning_horizon=32,
      n_guide_steps=2,
      scale=0.1,
  ):
      # normalize the observations and create  batch dimension
      obs = self.normalize(obs, "observations")
      obs = obs[None].repeat(batch_size, axis=0)
  
      conditions = {0: self.to_torch(obs)}
      shape = (
          batch_size,
          planning_horizon,
          self.state_dim + self.action_dim,
      )
  
      # generate initial noise and apply our conditions (to make the trajectories start at current state)
      x1 = randn_tensor(shape, device=self.unet.device)
      x = self.reset_x0(x1, conditions, self.action_dim)
      x = self.to_torch(x)
  
      # run the diffusion process
      x, y = self.run_diffusion(x, conditions, n_guide_steps, scale)
  
      # sort output trajectories by value
      sorted_idx = y.argsort(0, descending=True).squeeze()
      sorted_values = x[sorted_idx]
      actions = sorted_values[:, :, : self.action_dim]
      actions = actions.detach().cpu().numpy()
      denorm_actions = self.de_normalize(actions, key="actions")
  
      # select the action with the highest value
      if y is not None:
          selected_index = 0
      else:
          # if we didn't run value guiding, select a random action
          selected_index = np.random.randint(0, batch_size)
  
      denorm_actions = denorm_actions[selected_index, 0]
      return denorm_actions
  
file_path: llmga/llmga/diffusers/src/diffusers/experimental/rl/value_guided_sampling.py
imports: import numpy
  import torch
  import tqdm
  from ...models.unet_1d import UNet1DModel
  from ...pipelines import DiffusionPipeline
  from ...utils.dummy_pt_objects import DDPMScheduler
  from ...utils.torch_utils import randn_tensor
label_desc: Use image node_id 7 for calling the ValueGuidedRLPipeline obj's underlying member method code with example usage: obj.__call__(obs, batch_size, planning_horizon, n_guide_steps, scale) and returns: denorm_actions