class_docstr: Common superclass for SAC runners, implementing the main training controls.
docstr: Load the given trajectories as a dataset and fill the buffer with these trajectories.
  
  :param replay_buffer: The replay buffer to fill.
  :param cfg: The dict config of the experiment.
docstr_tok: ["Load","the","given","trajectories","as","a","dataset","and","fill","the","buffer","with","these","trajectories",".",":","param","replay_buffer",":","The","replay","buffer","to","fill",".",":","param","cfg",":","The","dict","config","of","the","experiment","."]
code: def load_replay_buffer(
      self, replay_buffer: BaseReplayBuffer, cfg: DictConfig
  ) -> None:
      """Load the given trajectories as a dataset and fill the buffer with these trajectories.
  
      :param replay_buffer: The replay buffer to fill.
      :param cfg: The dict config of the experiment.
      """
  
      print(
          f"******* Starting to fill the replay buffer with trajectories from path: "
          f"{self.initial_demonstration_trajectories.input_data} *******"
      )
      with SwitchWorkingDirectoryToInput(cfg.input_dir):
          dataset = Factory(base_type=Dataset).instantiate(
              self.initial_demonstration_trajectories,
              conversion_env_factory=self.env_factory,
          )
      assert isinstance(
          dataset, InMemoryDataset
      ), "Only in memory dataset supported at this point"
  
      if cfg.algorithm.split_rollouts_into_transitions:
          for step_record in dataset.step_records:
              assert (
                  step_record.next_observations is not None
              ), "Next observations are required for sac"
              assert all(
                  map(
                      lambda x: x is not None,
                      step_record.next_observations,
                  )
              ), "Next observations are required for sac"
              replay_buffer.add_transition(step_record)
      else:
          for idx, trajectory_reference in enumerate(
              dataset.trajectory_references
          ):
              traj = SpacesTrajectoryRecord(id=idx)
              traj.step_records = dataset.step_records[
                  trajectory_reference
              ]
              replay_buffer.add_transition(traj)
  
imports: import copy
  from abc import abstractmethod
  from dataclasses import dataclass
  from typing import Callable, List, Union
  from omegaconf import DictConfig
  from torch.utils.data import Dataset
  from maze.core.agent.policy import Policy
  from maze.core.agent.torch_actor_critic import TorchActorCritic
  from maze.core.agent.torch_policy import TorchPolicy
  from maze.core.agent.torch_state_action_critic import TorchStateActionCritic
  from maze.core.annotations import override
  from maze.core.env.maze_env import MazeEnv
  from maze.core.log_stats.log_stats import LogStatsAggregator, LogStatsLevel, get_stats_logger
  from maze.core.rollout.rollout_generator import RolloutGenerator
  from maze.core.trajectory_recording.datasets.in_memory_dataset import InMemoryDataset
  from maze.core.trajectory_recording.records.trajectory_record import SpacesTrajectoryRecord
  from maze.core.utils.config_utils import SwitchWorkingDirectoryToInput
  from maze.core.utils.factory import Factory
  from maze.train.parallelization.distributed_actors.base_distributed_workers_with_buffer import BaseDistributedWorkersWithBuffer
  from maze.train.parallelization.distributed_actors.dummy_distributed_workers_with_buffer import DummyDistributedWorkersWithBuffer
  from maze.train.parallelization.vector_env.sequential_vector_env import SequentialVectorEnv
  from maze.train.parallelization.vector_env.structured_vector_env import StructuredVectorEnv
  from maze.train.trainers.common.evaluators.rollout_evaluator import RolloutEvaluator
  from maze.train.trainers.common.model_selection.best_model_selection import BestModelSelection
  from maze.train.trainers.common.replay_buffer.replay_buffer import BaseReplayBuffer
  from maze.train.trainers.common.replay_buffer.uniform_replay_buffer import UniformReplayBuffer
  from maze.train.trainers.common.training_runner import TrainingRunner
  from maze.train.trainers.sac.sac_trainer import SAC
  from maze.utils.process import query_cpu
label_desc: Use image node_id 3 for calling the SACRunner obj's underlying member method code with example usage: obj.load_replay_buffer(replay_buffer, cfg) without return types