Commit add0620a authored by George Karpenkov's avatar George Karpenkov Committed by A. Unique TensorFlower
Browse files

Remove @tf.function(experimental_compile=True) annotation

Removed with plans to re-add later once the feature stabilizes more.

PiperOrigin-RevId: 298486867
parent 533d1e6b
...@@ -23,7 +23,6 @@ import tensorflow as tf ...@@ -23,7 +23,6 @@ import tensorflow as tf
from official.nlp.modeling.layers import attention from official.nlp.modeling.layers import attention
from official.nlp.modeling.layers import dense_einsum from official.nlp.modeling.layers import dense_einsum
from official.nlp.modeling.layers.util import tf_function_if_eager
@tf.keras.utils.register_keras_serializable(package="Text") @tf.keras.utils.register_keras_serializable(package="Text")
...@@ -194,7 +193,6 @@ class Transformer(tf.keras.layers.Layer): ...@@ -194,7 +193,6 @@ class Transformer(tf.keras.layers.Layer):
base_config = super(Transformer, self).get_config() base_config = super(Transformer, self).get_config()
return dict(list(base_config.items()) + list(config.items())) return dict(list(base_config.items()) + list(config.items()))
@tf_function_if_eager(experimental_compile=True)
def call(self, inputs): def call(self, inputs):
if isinstance(inputs, (list, tuple)) and len(inputs) == 2: if isinstance(inputs, (list, tuple)) and len(inputs) == 2:
input_tensor, attention_mask = inputs input_tensor, attention_mask = inputs
...@@ -206,7 +204,6 @@ class Transformer(tf.keras.layers.Layer): ...@@ -206,7 +204,6 @@ class Transformer(tf.keras.layers.Layer):
if attention_mask is not None: if attention_mask is not None:
attention_inputs.append(attention_mask) attention_inputs.append(attention_mask)
with tf.name_scope(self.name):
attention_output = self._attention_layer(attention_inputs) attention_output = self._attention_layer(attention_inputs)
attention_output = self._attention_output_dense(attention_output) attention_output = self._attention_output_dense(attention_output)
attention_output = self._attention_dropout(attention_output) attention_output = self._attention_dropout(attention_output)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment