code: def recipe(device="cpu", yaml_file="hyperparams.yaml", run_opts=None):
      experiment_dir = pathlib.Path(__file__).resolve().parent
      hparams_file = os.path.join(experiment_dir, yaml_file)
      data_folder = "../../samples/"
      data_folder = (experiment_dir / data_folder).resolve()
      with open(hparams_file) as fin:
          hparams = load_hyperpyyaml(fin)
  
      # usually here: sb.utils.distributed.ddp_init_group(run_opts)
  
      # Data IO creation
      train_data, valid_data = data_prep(data_folder, hparams)
  
      # Trainer initialization
      if run_opts is None:
          run_opts = {}
      else:
          hparams["rank"] = os.environ["RANK"]
      run_opts["device"] = device
  
      ctc_brain = SamplingBrain(
          hparams["modules"],
          hparams["opt_class"],
          hparams,
          run_opts=run_opts,
      )
  
      # Training/validation loop
      ctc_brain.fit(
          range(hparams["N_epochs"]),
          train_data,
          valid_data,
          train_loader_kwargs=hparams["dataloader_options"],
          valid_loader_kwargs=hparams["dataloader_options"],
      )
  
file_path: speechbrain/tests/integration/sampling/example_sorting.py
imports: import os
  import torch
  import pickle
  import pathlib
  import itertools
  import speechbrain
  import torch.multiprocessing
  from hyperpyyaml import load_hyperpyyaml
label_desc: Use image node_id 2 for calling a global function with example usage: recipe(device, yaml_file, run_opts) without return types