class_docstr: An abstract class for knowledge graph embedding models (KGEMs).
  
  The only function that needs to be implemented for a given subclass is
  :meth:`Model.forward`. The job of the :meth:`Model.forward` function, as
  opposed to the completely general :meth:`torch.nn.Module.forward` is
  to take indices for the head, relation, and tails' respective representation(s)
  and to determine a score.
  
  Subclasses of Model can decide however they want on how to store entities' and
  relations' representations, how they want to be looked up, and how they should
  be scored. The :class:`ERModel` provides a commonly useful implementation
  which allows for the specification of one or more entity representations and
  one or more relation representations in the form of :class:`pykeen.nn.Embedding`
  as well as a matching instance of a :class:`pykeen.nn.Interaction`.
docstr: Instantiate a regularizer using the default if None is provided.
  
  The following precedence order is used:
  
  1. If the passed regularizer is not None, use it
  2. If the regularizer is None, use the default regularizer. In this case, the
     default kwargs will be used in favor of provided ones.
  3. If both, the regularizer and the default regularizer are None, return None.
  
  :param regularizer:
      the regularizer, or a hint thereof
  :param regularizer_kwargs:
      additional keyword-based parameters passed to the regularizer upon instantiation
  
  :return:
      the regularizer instance.
docstr_tok: ["Instantiate","a","regularizer","using","the","default","if","None","is","provided",".","The","following","precedence","order","is","used",":","1",".","If","the","passed","regularizer","is","not","None",",","use","it","2",".","If","the","regularizer","is","None",",","use","the","default","regularizer",".","In","this","case",",","the","default","kwargs","will","be","used","in","favor","of","provided","ones",".","3",".","If","both",",","the","regularizer","and","the","default","regularizer","are","None",",","return","None",".",":","param","regularizer",":","the","regularizer",",","or","a","hint","thereof",":","param","regularizer_kwargs",":","additional","keyword-based","parameters","passed","to","the","regularizer","upon","instantiation",":","return",":","the","regularizer","instance","."]
code: def _instantiate_regularizer(
      self,
      regularizer: HintOrType[Regularizer],
      regularizer_kwargs: OptionalKwargs = None,
  ) -> Optional[Regularizer]:
      """
      Instantiate a regularizer using the default if None is provided.
  
      The following precedence order is used:
  
      1. If the passed regularizer is not None, use it
      2. If the regularizer is None, use the default regularizer. In this case, the
         default kwargs will be used in favor of provided ones.
      3. If both, the regularizer and the default regularizer are None, return None.
  
      :param regularizer:
          the regularizer, or a hint thereof
      :param regularizer_kwargs:
          additional keyword-based parameters passed to the regularizer upon instantiation
  
      :return:
          the regularizer instance.
      """
      regularizer, regularizer_kwargs = normalize_with_default(
          choice=regularizer,
          kwargs=regularizer_kwargs,
          default=self.regularizer_default,
          default_kwargs=self.regularizer_default_kwargs,
      )
      return regularizer_resolver.make_safe(
          regularizer, regularizer_kwargs
      )
  
imports: from __future__ import annotations
  import logging
  from abc import ABC
  from collections import defaultdict
  from operator import itemgetter
  from typing import Any, ClassVar, Generic, Iterable, List, Literal, Mapping, Optional, Sequence, Tuple, Type, Union, cast
  import torch
  from class_resolver import HintOrType, OptionalKwargs
  from class_resolver.utils import OneOrManyHintOrType, OneOrManyOptionalKwargs, normalize_with_default
  from torch import nn
  from .base import Model
  from ..nn import representation_resolver
  from ..nn.modules import Interaction, interaction_resolver, parallel_unsqueeze
  from ..nn.representation import Representation
  from ..regularizers import Regularizer, regularizer_resolver
  from ..triples import KGInfo
  from ..typing import HeadRepresentation, InductiveMode, RelationRepresentation, TailRepresentation
  from ..utils import check_shapes, get_batchnorm_modules
label_desc: Use image node_id 2 for calling the _NewAbstractModel obj's underlying member method code with example usage: obj._instantiate_regularizer(regularizer, regularizer_kwargs) and returns: regularizer_resolver