class_docstr: An LSTM architecture for named entity recognition.
  Uses a character embedding layer followed by an LSTM to generate vector 
  representation from characters for each token.
  Then the character vector is concatenated with token embedding vector, 
  which is input to another LSTM  followed by a CRF layer.
docstr_tok: []
code: def load_embeddings_from_pretrained_model(
      self,
      sess,
      dataset,
      pretraining_dataset,
      pretrained_embedding_weights,
      embedding_type="token",
  ):
      """ """
      if embedding_type == "token":
          embedding_weights = self.token_embedding_weights
          index_to_string = dataset.index_to_token
          pretraining_string_to_index = (
              pretraining_dataset.token_to_index
          )
      elif embedding_type == "character":
          embedding_weights = self.character_embedding_weights
          index_to_string = dataset.index_to_character
          pretraining_string_to_index = (
              pretraining_dataset.character_to_index
          )
      # Load embeddings
      start_time = time.time()
      print(
          "Load {0} embeddings from pretrained model... ".format(
              embedding_type
          ),
          end="",
          flush=True,
      )
      initial_weights = sess.run(embedding_weights.read_value())
  
      if embedding_type == "token":
          initial_weights[
              dataset.UNK_TOKEN_INDEX
          ] = pretrained_embedding_weights[
              pretraining_dataset.UNK_TOKEN_INDEX
          ]
      elif embedding_type == "character":
          initial_weights[
              dataset.PADDING_CHARACTER_INDEX
          ] = pretrained_embedding_weights[
              pretraining_dataset.PADDING_CHARACTER_INDEX
          ]
  
      number_of_loaded_vectors = 1
      for index, string in index_to_string.items():
          if index == dataset.UNK_TOKEN_INDEX:
              continue
          if string in pretraining_string_to_index.keys():
              initial_weights[index] = pretrained_embedding_weights[
                  pretraining_string_to_index[string]
              ]
              number_of_loaded_vectors += 1
      elapsed_time = time.time() - start_time
  
      print("done ({0:.2f} seconds)".format(elapsed_time))
      print(
          "number_of_loaded_vectors: {0}".format(
              number_of_loaded_vectors
          )
      )
  
      if embedding_type == "token":
          print(
              "dataset.vocabulary_size: {0}".format(
                  dataset.vocabulary_size
              )
          )
      elif embedding_type == "character":
          print(
              "dataset.alphabet_size: {0}".format(dataset.alphabet_size)
          )
  
      sess.run(embedding_weights.assign(initial_weights))
  
file_path: NeuroNER/neuroner/entity_lstm.py
imports: import os
  import pickle
  import re
  import time
  import tensorflow
  from neuroner import utils
  from neuroner import utils_tf
  from neuroner import utils_nlp
label_desc: Use image node_id 4 for calling the EntityLSTM obj's underlying member method code with example usage: obj.load_embeddings_from_pretrained_model(sess, dataset, pretraining_dataset, pretrained_embedding_weights, embedding_type) without return types