class_docstr: Compute context insensitive token representation using pretrained biLM.
  
  This embedder has input character ids of size (batch_size, sequence_length, 50)
  and returns (batch_size, sequence_length + 2, embedding_dim), where embedding_dim
  is specified in the options file (typically 512).
  
  We add special entries at the beginning and end of each sequence corresponding
  to <S> and </S>, the beginning and end of sentence tokens.
  
  Note: this is a lower level class useful for advanced usage.  Most users should
  use `ElmoTokenEmbedder` or `allennlp.modules.Elmo` instead.
  
  # Parameters
  
  options_file : `str`
      ELMo JSON options file
  weight_file : `str`
      ELMo hdf5 weight file
  requires_grad : `bool`, optional, (default = `False`).
      If True, compute gradient of ELMo parameters for fine tuning.
  
  
  The relevant section of the options file is something like:
  
  ```
  {'char_cnn': {
      'activation': 'relu',
      'embedding': {'dim': 4},
      'filters': [[1, 4], [2, 8], [3, 16], [4, 32], [5, 64]],
      'max_characters_per_token': 50,
      'n_characters': 262,
      'n_highway': 2
      }
  }
  ```
class_docstr_tok: ["Compute","context","insensitive","token","representation","using","pretrained","biLM",".","This","embedder","has","input","character","ids","of","size","(","batch_size",",","sequence_length",",","50",")","and","returns","(","batch_size",",","sequence_length","+","2",",","embedding_dim",")",",","where","embedding_dim","is","specified","in","the","options","file","(","typically","512",")",".","We","add","special","entries","at","the","beginning","and","end","of","each","sequence","corresponding","to","<","S",">","and","<","\/S",">",",","the","beginning","and","end","of","sentence","tokens",".","Note",":","this","is","a","lower","level","class","useful","for","advanced","usage",".","Most","users","should","use","`","ElmoTokenEmbedder","`","or","`","allennlp.modules.Elmo","`","instead",".","#","Parameters","options_file",":","`","str","`","ELMo","JSON","options","file","weight_file",":","`","str","`","ELMo","hdf5","weight","file","requires_grad",":","`","bool","`",",","optional",",","(","default","=","`","False","`",")",".","If","True",",","compute","gradient","of","ELMo","parameters","for","fine","tuning",".","The","relevant","section","of","the","options","file","is","something","like",":","``","`","{","'char_cnn","'",":","{","'activation","'",":","'relu","'",",","'embedding","'",":","{","'dim","'",":","4","}",",","'filters","'",":","[","[","1",",","4","]",",","[","2",",","8","]",",","[","3",",","16","]",",","[","4",",","32","]",",","[","5",",","64","]","]",",","'max_characters_per_token","'",":","50",",","'n_characters","'",":","262",",","'n_highway","'",":","2","}","}","``","`"]
code: def __init__(
      self,
      options_file: str,
      weight_file: str,
      requires_grad: bool = False,
  ) -> None:
      super().__init__()
  
      with open(cached_path(options_file), "r") as fin:
          self._options = json.load(fin)
      self._weight_file = weight_file
  
      self.output_dim = self._options["lstm"]["projection_dim"]
      self.requires_grad = requires_grad
  
      self._load_weights()
  
      # Cache the arrays for use in forward -- +1 due to masking.
      self._beginning_of_sentence_characters = torch.from_numpy(
          numpy.array(
              ELMoCharacterMapper.beginning_of_sentence_characters
          )
          + 1
      )
      self._end_of_sentence_characters = torch.from_numpy(
          numpy.array(ELMoCharacterMapper.end_of_sentence_characters)
          + 1
      )
  
imports: import json
  import logging
  import warnings
  from typing import Any, Dict, List, Union
  import numpy
  import torch
  from torch.nn.modules import Dropout
  from allennlp.common import FromParams
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.file_utils import cached_path
  from allennlp.common.util import lazy_groups_of
  from allennlp.data.instance import Instance
  from allennlp.data.tokenizers.token_class import Token
  from allennlp.data.vocabulary import Vocabulary
  from allennlp.data.batch import Batch
  from allennlp.data.fields import TextField
  from allennlp.data.token_indexers.elmo_indexer import ELMoCharacterMapper, ELMoTokenCharactersIndexer
  from allennlp.modules.elmo_lstm import ElmoLstm
  from allennlp.modules.highway import Highway
  from allennlp.modules.scalar_mix import ScalarMix
  from allennlp.nn.util import add_sentence_boundary_token_ids, get_device_of, remove_sentence_boundaries
label_desc: Use image node_id 1 to create a new _ElmoCharacterEncoder object from inherited base classes: torch.nn with example: obj = _ElmoCharacterEncoder(options_file, weight_file, requires_grad)