From a5327c6a9a2c47a9e0c0f5707e54d2cdf39c12ca Mon Sep 17 00:00:00 2001 From: Susnato Dhar Date: Mon, 16 Jan 2023 19:36:35 +0530 Subject: [PATCH] Fixed issue #21053 (#21065) Co-authored-by: susnato --- src/transformers/models/gpt2/modeling_tf_gpt2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/models/gpt2/modeling_tf_gpt2.py b/src/transformers/models/gpt2/modeling_tf_gpt2.py index 8e29fd734b2..457c477fc9c 100644 --- a/src/transformers/models/gpt2/modeling_tf_gpt2.py +++ b/src/transformers/models/gpt2/modeling_tf_gpt2.py @@ -446,7 +446,7 @@ class TFGPT2MainLayer(tf.keras.layers.Layer): # indices on GPU, returning zeros instead. This is a dangerous silent behavior. tf.debugging.assert_less( input_ids, - tf.cast(self.vocab_size, dtype=input_ids.dtype), + tf.cast(self.config.vocab_size, dtype=input_ids.dtype), message=( "input_ids must be smaller than the embedding layer's input dimension (got" f" {tf.math.reduce_max(input_ids)} >= {self.vocab_size})"