docstr: Adds values as postfix string to progressbar.
  
  Args:
      prog_bar: a progressbar (on global rank zero) or an iterable (every other rank).
      candidates: the values to add as postfix strings to the progressbar.
      prefix: the prefix to add to each of these values.
docstr_tok: ["Adds","values","as","postfix","string","to","progressbar",".","Args",":","prog_bar",":","a","progressbar","(","on","global","rank","zero",")","or","an","iterable","(","every","other","rank",")",".","candidates",":","the","values","to","add","as","postfix","strings","to","the","progressbar",".","prefix",":","the","prefix","to","add","to","each","of","these","values","."]
code: def _format_iterable(
      prog_bar,
      candidates: Optional[
          Union[
              torch.Tensor,
              Mapping[str, Union[torch.Tensor, float, int]],
          ]
      ],
      prefix: str,
  ):
      """Adds values as postfix string to progressbar.
  
      Args:
          prog_bar: a progressbar (on global rank zero) or an iterable (every other rank).
          candidates: the values to add as postfix strings to the progressbar.
          prefix: the prefix to add to each of these values.
  
      """
      if isinstance(prog_bar, tqdm) and candidates is not None:
          postfix_str = ""
          float_candidates = apply_to_collection(
              candidates, torch.Tensor, lambda x: x.item()
          )
          if isinstance(candidates, torch.Tensor):
              postfix_str += f" {prefix}_loss: {float_candidates:.3f}"
          elif isinstance(candidates, Mapping):
              for k, v in float_candidates.items():
                  postfix_str += f" {prefix}_{k}: {v:.3f}"
  
          if postfix_str:
              prog_bar.set_postfix_str(postfix_str)
  
imports: import os
  from collections.abc import Mapping
  from functools import partial
  from typing import Any, Iterable, List, Literal, Optional, Tuple, Union, cast
  import lightning
  import torch
  from lightning.fabric.accelerators import Accelerator
  from lightning.fabric.loggers import Logger
  from lightning.fabric.strategies import Strategy
  from lightning.fabric.wrappers import _unwrap_objects
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning_utilities import apply_to_collection
  from tqdm import tqdm
label_desc: Use image node_id 13 for calling the MyCustomTrainer obj's underlying member method code with example usage: obj._format_iterable(prog_bar, candidates, prefix) without return types