class_docstr:     Base class for detached rlhf trainers.
      'detach' means that the experience maker is detached compared to a normal Trainer.
      Please set name attribute during init:
          >>> trainer = DetachedTrainer.options(..., name = "xxx", ...).remote()
          So an ExperienceMakerHolder can reach the detached_replay_buffer by Actor's name.
  Args:
      detached_strategy (DetachedStrategy): the strategy to use for training
      detached_replay_buffer_ref (ObjectRef[DetachedReplayBuffer]): the replay buffer to use for training
      data_loader_pin_memory (bool, defaults to True): whether to pin memory for data loader
      callbacks (List[Callback], defaults to []): the callbacks to call during training process
      generate_kwargs (dict, optional): the kwargs to use while model generating
class_docstr_tok: ["Base","class","for","detached","rlhf","trainers",".","'detach","'","means","that","the","experience","maker","is","detached","compared","to","a","normal","Trainer",".","Please","set","name","attribute","during","init",":",">",">",">","trainer","=","DetachedTrainer.options","(","...",",","name","=","``","xxx","''",",","...",")",".remote","(",")","So","an","ExperienceMakerHolder","can","reach","the","detached_replay_buffer","by","Actor","'s","name",".","Args",":","detached_strategy","(","DetachedStrategy",")",":","the","strategy","to","use","for","training","detached_replay_buffer_ref","(","ObjectRef","[","DetachedReplayBuffer","]",")",":","the","replay","buffer","to","use","for","training","data_loader_pin_memory","(","bool",",","defaults","to","True",")",":","whether","to","pin","memory","for","data","loader","callbacks","(","List","[","Callback","]",",","defaults","to","[","]",")",":","the","callbacks","to","call","during","training","process","generate_kwargs","(","dict",",","optional",")",":","the","kwargs","to","use","while","model","generating"]
code: def _on_episode_end(self, episode: int) -> None:
      for callback in self.callbacks:
          callback.on_episode_end(episode)
  
imports: import os
  from abc import ABC, abstractmethod
  from typing import Any, Dict, List
  import ray
  import torch
  from coati.experience_buffer.utils import BufferItem
  from coati.experience_maker import Experience
  from torch.utils.data import DataLoader
  from tqdm import tqdm
  from .callbacks import TrainerCallback
  from .detached_replay_buffer import DetachedReplayBuffer
  from .utils import is_rank_0
label_desc: Use image node_id 16 for calling the DetachedTrainer obj's underlying member method code with example usage: obj._on_episode_end(episode) without return types