class_docstr: The main entry point for any training or feature extraction workflows in VISSL.
  
  The trainer constructs a train_task which prepares all the components of the
  training (optimizer, loss, meters, model etc) using the settings specified by user
  in the yaml config file. See the vissl/trainer/train_task.py for more details.
  
  Args:
      cfg (AttrDict): user specified input config that has optimizer, loss, meters etc
                      settings relevant to the training
      dist_run_id (str): For multi-gpu training with PyTorch, we have to specify
                         how the gpus are going to rendezvous. This requires specifying
                         the communication method: file, tcp and the unique rendezvous
                         run_id that is specific to 1 run.
                         We recommend:
                              1) for 1node: use init_method=tcp and run_id=auto
                              2) for multi-node, use init_method=tcp and specify
                              run_id={master_node}:{port}
      checkpoint_path (str): if the training is being resumed from a checkpoint, path to
                        the checkpoint. The tools/run_distributed_engines.py automatically
                        looks for the checkpoint in the checkpoint directory.
      checkpoint_folder (str): what directory to use for checkpointing. The
                        tools/run_distributed_engines.py creates the directory based on user
                        input in the yaml config file.
      hooks (List[ClassyHooks]): the list of hooks to use during the training. The hooks
                        vissl/engines/{train, extract_features}.py determine the hooks.
code: def _extract_split_label_predictions(
      self,
      feat_names: List[str],
      task: ClassyTask,
      split_name: str,
      output_folder: str,
  ):
      task.model.eval()
      logging.info(
          "Model set to eval mode during feature extraction..."
      )
      dist_rank = torch.distributed.get_rank()
  
      feat_names = self._to_unique_feature_names(feat_names)
      out_predictions, out_targets, out_scores = {}, {}, {}
      for feat_name in feat_names:
          out_predictions[feat_name] = {}
          out_scores[feat_name] = {}
          out_targets[feat_name] = {}
  
      assert (
          len(task.meters) > 0
      ), "Please specify one meter to extract predictions"
      assert (
          len(task.meters) == 1
      ), "Please use only one meter to extract predictions"
      for meter in task.meters:
          assert hasattr(
              meter, "get_predictions"
          ), f"Meter {meter.name} doesn't implement get_predictions function"
  
      dataset = task.datasets[split_name.lower()]
      all_image_paths = dataset.get_image_paths()
      assert (
          len(all_image_paths) == 1
      ), "Multi-dataset not supported yet for label predictions."
      all_image_paths = all_image_paths[0]
  
      for count in itertools.count(start=0, step=1):
          try:
              if count % 100 == 0:
                  logging.info(
                      f"Label prediction extraction iteration: {count}"
                  )
              sample = next(task.data_iterator)
              assert isinstance(sample, dict)
              assert "data_idx" in sample, "Indices not passed"
              input_sample = {
                  "input": torch.cat(sample["data"]).cuda(
                      non_blocking=True
                  ),
                  "target": torch.cat(sample["label"]).cpu().numpy(),
                  "inds": torch.cat(sample["data_idx"]).cpu().numpy(),
              }
              with torch.no_grad():
                  # Send the input sample to the model, tracking also the
                  # last batch for the hooks to refer to
                  task.last_batch = SimpleNamespace()
                  model_output = task.model(input_sample["input"])
                  task.last_batch.sample = input_sample
                  task.last_batch.model_output = model_output
  
                  # Run hooks on forward pass
                  task.run_hooks(SSLClassyHookFunctions.on_forward.name)
  
                  # get the model predictions using the meter
                  if isinstance(model_output, list):
                      model_output_cpu = [x.cpu() for x in model_output]
                  else:
                      model_output_cpu = model_output.cpu()
                  for meter in task.meters:
                      meter.update(
                          model_output_cpu,
                          sample["label"][0].detach().cpu(),
                      )
                  predictions, pred_scores = task.meters[
                      0
                  ].get_predictions(model_output_cpu)
                  num_images = input_sample["inds"].shape[0]
                  for num, layer_name in enumerate(feat_names):
                      pred = predictions[num]
                      score = pred_scores[num]
                      targets = input_sample["target"]
                      for idx in range(num_images):
                          index = input_sample["inds"][idx]
                          if not (index in out_predictions[layer_name]):
                              out_targets[layer_name][index] = targets[
                                  idx
                              ].reshape(-1)
                              out_predictions[layer_name][index] = pred[
                                  idx
                              ]
                              out_scores[layer_name][index] = score[idx]
          except StopIteration:
              break
  
      # print the meters results. This can offer a validation
      # of the extracted predictions.
      self._sync_and_print_meters(task)
      # save the predictions, targets and image indices now
      self._save_extracted_label_predictions(
          all_image_paths=all_image_paths,
          predictions=out_predictions,
          confidence_scores=out_scores,
          targets=out_targets,
          dist_rank=dist_rank,
          split=split_name,
          output_folder=output_folder,
      )
  
imports: import gc
  import itertools
  import logging
  import os
  import socket
  import time
  from types import SimpleNamespace
  from typing import Any, Dict, List, Tuple
  import numpy
  import torch
  import torch.distributed
  from classy_vision.generic.distributed_util import barrier, is_primary, set_cpu_device, set_cuda_device_index
  from classy_vision.hooks.classy_hook import ClassyHook
  from classy_vision.tasks import ClassyTask, TASK_REGISTRY
  from vissl.config import AttrDict
  from vissl.hooks import SSLClassyHookFunctions
  from vissl.models.model_helpers import get_trunk_output_feature_names
  from vissl.trainer.train_steps import get_train_step
  from vissl.utils.distributed_utils import all_gather_heterogeneous, all_gather_sizes
  from vissl.utils.env import get_machine_local_and_dist_rank
  from vissl.utils.io import save_file
label_desc: Use image node_id 8 for calling the SelfSupervisionTrainer obj's underlying member method code with example usage: obj._extract_split_label_predictions(feat_names, task, split_name, output_folder) without return types