class_docstr: Trainer based on (R)ecorder.
  It will train a list of tasks and return a list of model recorders in a linear way.
  
  Assumption: models were defined by `task` and the results will be saved to `Recorder`.
class_docstr_tok: ["Trainer","based","on","(","R",")","ecorder",".","It","will","train","a","list","of","tasks","and","return","a","list","of","model","recorders","in","a","linear","way",".","Assumption",":","models","were","defined","by","`","task","`","and","the","results","will","be","saved","to","`","Recorder","`","."]
docstr: Given a list of `tasks` and return a list of trained Recorder. The order can be guaranteed.
  
  Args:
      tasks (list): a list of definitions based on `task` dict
      train_func (Callable): the training method which needs at least `tasks` and `experiment_name`. None for the default training method.
      experiment_name (str): the experiment name, None for use default name.
      kwargs: the params for train_func.
  
  Returns:
      List[Recorder]: a list of Recorders
docstr_tok: ["Given","a","list","of","`","tasks","`","and","return","a","list","of","trained","Recorder",".","The","order","can","be","guaranteed",".","Args",":","tasks","(","list",")",":","a","list","of","definitions","based","on","`","task","`","dict","train_func","(","Callable",")",":","the","training","method","which","needs","at","least","`","tasks","`","and","`","experiment_name","`",".","None","for","the","default","training","method",".","experiment_name","(","str",")",":","the","experiment","name",",","None","for","use","default","name",".","kwargs",":","the","params","for","train_func",".","Returns",":","List","[","Recorder","]",":","a","list","of","Recorders"]
code: def train(
      self,
      tasks: list,
      train_func: Callable = None,
      experiment_name: str = None,
      **kwargs,
  ) -> List[Recorder]:
      """
      Given a list of `tasks` and return a list of trained Recorder. The order can be guaranteed.
  
      Args:
          tasks (list): a list of definitions based on `task` dict
          train_func (Callable): the training method which needs at least `tasks` and `experiment_name`. None for the default training method.
          experiment_name (str): the experiment name, None for use default name.
          kwargs: the params for train_func.
  
      Returns:
          List[Recorder]: a list of Recorders
      """
      if isinstance(tasks, dict):
          tasks = [tasks]
      if len(tasks) == 0:
          return []
      if train_func is None:
          train_func = self.train_func
      if experiment_name is None:
          experiment_name = self.experiment_name
      recs = []
      for task in tqdm(tasks, desc="train tasks"):
          if self._call_in_subproc:
              get_module_logger("TrainerR").info(
                  "running models in sub process (for forcing release memroy)."
              )
              train_func = call_in_subproc(train_func, C)
          rec = train_func(
              task,
              experiment_name,
              recorder_name=self.default_rec_name,
              **kwargs,
          )
          rec.set_tags(**{self.STATUS_KEY: self.STATUS_BEGIN})
          recs.append(rec)
      return recs
  
imports: import socket
  from typing import Callable, List, Optional
  from tqdm.auto import tqdm
  from qlib.config import C
  from qlib.data.dataset import Dataset
  from qlib.data.dataset.weight import Reweighter
  from qlib.log import get_module_logger
  from qlib.model.base import Model
  from qlib.utils import auto_filter_kwargs, fill_placeholder, flatten_dict, init_instance_by_config
  from qlib.utils.paral import call_in_subproc
  from qlib.workflow import R
  from qlib.workflow.recorder import Recorder
  from qlib.workflow.task.manage import TaskManager, run_task
label_desc: Use image node_id 2 for calling the TrainerR obj's underlying member method code with example usage: obj.train(tasks, train_func, experiment_name) and returns: recs, list