You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Model conversion succeeds but inputs and outputs are not recognized.
Information
Model I am using (Bert, XLNet ...): BERT (bert-base-uncased)
Language I am using the model on (English, Chinese ...): English
The problem arises when using:
TensorFlow 2.1.0 + Transformers 2.8.0 - has no problem converting bert-base-uncased model to tflite version.
TensorFlow 2.2.0rc3 + Transformers 2.8.0 - has issues with interoperability.
The tasks I am working on is:
Convert BERT models to TF-Lite format to use it in mobile apps.
Trying to use the latest TF-Lite package version for Android in the place of TF-Lite package provided in the repo huggingface/tflite-android-transformers.
To reproduce
Please execute the following code with TensorFlow versions 2.1.0 and 2.2.0-rc3
import transformers
from transformers import TFBertModel, BertConfig
import tensorflow as tf
print('TensorFlow version =', tf.__version__)
print('Transformers version =', transformers.__version__)
MODEL_DIR = 'bert-base-uncased'
MAX_SEQ_LEN = 50
# Read the model
config = BertConfig.from_pretrained(MODEL_DIR)
model = TFBertModel(config)
# Set input Spec
input_spec = [
tf.TensorSpec([1, MAX_SEQ_LEN], tf.int32),
tf.TensorSpec([1, MAX_SEQ_LEN], tf.int32),
tf.TensorSpec([1, MAX_SEQ_LEN], tf.int32)
]
model._set_inputs(input_spec, training=False)
print(model.inputs)
print(model.outputs)
For TensorFlow 2.2.0-rc3: Model outputs and inputs are None
TensorFlow version = 2.2.0-rc3
Transformers version = 2.8.0
None
None
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
🐛 Bug
Model conversion succeeds but inputs and outputs are not recognized.
Information
Model I am using (Bert, XLNet ...): BERT (
bert-base-uncased
)Language I am using the model on (English, Chinese ...): English
The problem arises when using:
bert-base-uncased
model to tflite version.The tasks I am working on is:
huggingface/tflite-android-transformers
.To reproduce
Please execute the following code with TensorFlow versions 2.1.0 and 2.2.0-rc3
Expected behavior
Environment info
transformers
version: 2.8.0The text was updated successfully, but these errors were encountered: