title: Problems with variable_scope in ELMo Embedding layer with Keras
body: <p>I'm trying to use a custom ElmoEmbeddingLayer for my model in Keras with tensorflow-gpu==2.0.0-rc0.</p>
  
  <p><strong>This is the class:</strong></p>
  
  <pre><code>class ElmoEmbeddingLayer(Layer):
      def __init__(self, trainable=True, output_mode="default", **kwargs):
          assert output_mode in ["default", "word_emb", "lstm_outputs1", "lstm_outputs2", "elmo"]
          assert trainable in [True, False]
          self.output_mode = output_mode
          self.trainable = trainable
          super(ElmoEmbeddingLayer, self).__init__(**kwargs)
  
      def build(self, input_shape):
          self.elmo = hub.Module('https://tfhub.dev/google/elmo/2', trainable=self.trainable,
                                 name="{}_module".format(self.name))
  
          self.trainable_weights += K.tf.trainable_variables(scope="^{}_module/.*".format(self.name))
          super(ElmoEmbeddingLayer, self).build(input_shape)
  
      def call(self, x, mask=None):
          result = self.elmo(
              K.squeeze(K.cast(x, tf.string), axis=1),
              as_dict=True,
              signature='default',                      
              )['elmo']
          return result
  
      def compute_mask(self, inputs, mask=None):
          return K.not_equal(inputs, '--PAD--')
  
      def compute_output_shape(self, input_shape):
          if self.output_mode == "default":
              return (input_shape[0], 1024)
          if self.output_mode == "word_emb":
              return (input_shape[0], self.max_length, 512)
          if self.output_mode == "lstm_outputs1":
              return (input_shape[0], self.max_length, 1024)
          if self.output_mode == "lstm_outputs2":
              return (input_shape[0], self.max_length, 1024)
          if self.output_mode == "elmo":
              return (input_shape[0], self.max_length, 1024)
  
      def get_config(self):
          config = {
              'output_mode': self.output_mode 
          }
          return list(config.items()) 
  </code></pre>
  
  <p><strong>And this is my model:</strong></p>
  
  <pre><code>def train_model(lstm_layers = 300, dropout_rate = 0.1, learning_rate = 0.01,
                  batch_s = 25, verbose = 0, save_model = bool(0), epchs = 10):  
  
  
    model = tf.keras.Sequential([
      tf.keras.layers.Input(shape=(max_lenght,), dtype="string"),
      ElmoEmbeddingLayer(output_mode="default", trainable=True),                           
      #tf.keras.layers.Embedding(max_lenght+1 , embedding_dim, input_length=max_lenght), 
      #tf.keras.layers.Reshape((max_lenght, embedding_dim)),            
      #tf.keras.layers.Bidirectional(LSTM(int(lstm_layers))),
      tf.keras.layers.Dropout(dropout_rate),   
      tf.keras.layers.Dense(1, activation='sigmoid')
    ])
  
    model.summary()
  
    adam=Adam(lr=learning_rate)
    model.compile(loss='binary_crossentropy', optimizer=adam, metrics=['accuracy'])
    history = model.fit(np.array(data_train), np.array(labels_train), epochs=epchs,
                      batch_size = int(batch_s), validation_data=(np.array(data_test), np.array(labels_test)), verbose = verbose)
  </code></pre>
  
  <p><strong>However, when i try to fit my model i'm getting this error, how could i fix it?</strong></p>
  
  <p><strong>RuntimeError: variable_scope elmo_embedding_layer_14_module/ was unused but the corresponding name_scope was already taken.</strong></p>