code: def run(
      model,
      dataset,
      config_file_list=None,
      config_dict=None,
      saved=True,
      nproc=1,
      world_size=-1,
      ip="localhost",
      port="5678",
      group_offset=0,
  ):
      if nproc == 1 and world_size <= 0:
          res = run_recbole(
              model=model,
              dataset=dataset,
              config_file_list=config_file_list,
              config_dict=config_dict,
              saved=saved,
          )
      else:
          if world_size == -1:
              world_size = nproc
          import torch.multiprocessing as mp
  
          # Refer to https://discuss.pytorch.org/t/problems-with-torch-multiprocess-spawn-and-simplequeue/69674/2
          # https://discuss.pytorch.org/t/return-from-mp-spawn/94302/2
          queue = mp.get_context("spawn").SimpleQueue()
  
          config_dict = config_dict or {}
          config_dict.update(
              {
                  "world_size": world_size,
                  "ip": ip,
                  "port": port,
                  "nproc": nproc,
                  "offset": group_offset,
              }
          )
          kwargs = {
              "config_dict": config_dict,
              "queue": queue,
          }
  
          mp.spawn(
              run_recboles,
              args=(model, dataset, config_file_list, kwargs),
              nprocs=nproc,
              join=True,
          )
  
          # Normally, there should be only one item in the queue
          res = None if queue.empty() else queue.get()
      return res
  
file_path: RecBole/recbole/quick_start/quick_start.py
imports: import logging
  import sys
  import torch.distributed
  from collections.abc import MutableMapping
  from logging import getLogger
  from ray import tune
  from recbole.config import Config
  from recbole.data import create_dataset, data_preparation
  from recbole.data.transform import construct_transform
  from recbole.utils import init_logger, get_model, get_trainer, init_seed, set_color, get_flops, get_environment
label_desc: Use image node_id 1 for calling a global function with example usage: run(model, dataset, config_file_list, config_dict, saved, nproc, world_size, ip, port, group_offset) and returns: res