class_docstr: UNITER wrapper for pretraining
class_docstr_tok: ["UNITER","wrapper","for","pretraining"]
code: def init_losses(self):
      self.losses = nn.ModuleDict()
      for task in self.tasks:
          if task not in self.loss_configs:
              logger.warning(
                  f"No loss defined for {task}. Head is expected "
                  + "to return dict with 'losses'"
              )
              continue
          loss_config = self.loss_configs[task]
          self.losses[task] = MMFLoss(loss_config)
  
imports: import copy
  import logging
  import random
  from collections import namedtuple
  from collections.abc import MutableMapping
  from dataclasses import asdict, dataclass, field
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from mmf.common.registry import registry
  from mmf.models import BaseModel
  from mmf.modules.losses import MMFLoss
  from mmf.utils.general import retry_n
  from omegaconf import DictConfig, MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 2 for calling the UNITERForPretraining obj's underlying member method code with example usage: obj.init_losses() without return types