We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformers
@Rocketknight1 @gante
examples
from transformers import TapasTokenizer, TFTapasModel import pandas as pd tokenizer = TapasTokenizer.from_pretrained("google/tapas-base") model = TFTapasModel.from_pretrained("google/tapas-base") data = { "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Age": ["56", "45", "59"], "Number of movies": ["87", "53", "69"], } table = pd.DataFrame.from_dict(data) queries = ["How many movies has George Clooney played in?", "How old is Brad Pitt?"] inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="tf") outputs = model(**inputs) last_hidden_states = outputs.last_hidden_state model.save_pretrained("test",saved_model=True)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) [<ipython-input-11-637c488e6341>](https://localhost:8080/#) in <module>() ----> 1 model.save_pretrained("test",saved_model=True) 2 frames [/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py](https://localhost:8080/#) in autograph_handler(*args, **kwargs) 1145 except Exception as e: # pylint:disable=broad-except 1146 if hasattr(e, "ag_error_metadata"): -> 1147 raise e.ag_error_metadata.to_exception(e) 1148 else: 1149 raise ValueError: in user code: File "/usr/local/lib/python3.7/dist-packages/transformers/modeling_tf_utils.py", line 806, in serving * output = self.call(inputs) File "/usr/local/lib/python3.7/dist-packages/transformers/modeling_tf_utils.py", line 981, in run_call_with_unpacked_inputs * return func(self, **unpacked_inputs) File "/usr/local/lib/python3.7/dist-packages/transformers/models/tapas/modeling_tf_tapas.py", line 1008, in call * outputs = self.tapas( File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler ** raise e.with_traceback(filtered_tb) from None ValueError: Exception encountered when calling layer "tapas" (type TFTapasMainLayer). in user code: File "/usr/local/lib/python3.7/dist-packages/transformers/modeling_tf_utils.py", line 981, in run_call_with_unpacked_inputs * return func(self, **unpacked_inputs) File "/usr/local/lib/python3.7/dist-packages/transformers/models/tapas/modeling_tf_tapas.py", line 790, in call * embedding_output = self.embeddings( File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler ** raise e.with_traceback(filtered_tb) from None ValueError: Exception encountered when calling layer "embeddings" (type TFTapasEmbeddings). in user code: File "/usr/local/lib/python3.7/dist-packages/transformers/models/tapas/modeling_tf_tapas.py", line 223, in call * col_index = IndexMap(token_type_ids[:, :, 1], self.type_vocab_sizes[1], batch_dims=1) ValueError: Index out of range using input dim 2; input has only 2 dims for '{{node tapas/embeddings/strided_slice_2}} = StridedSlice[Index=DT_INT32, T=DT_INT32, begin_mask=3, ellipsis_mask=0, end_mask=3, new_axis_mask=0, shrink_axis_mask=4](token_type_ids, tapas/embeddings/strided_slice_2/stack, tapas/embeddings/strided_slice_2/stack_1, tapas/embeddings/strided_slice_2/stack_2)' with input shapes: [?,?], [3], [3], [3] and with computed input tensors: input[3] = <1 1 1>. Call arguments received: • input_ids=tf.Tensor(shape=(None, None), dtype=int32) • position_ids=None • token_type_ids=tf.Tensor(shape=(None, None), dtype=int32) • inputs_embeds=None • training=False Call arguments received: • self=tf.Tensor(shape=(None, None), dtype=int32) • input_ids=None • attention_mask=tf.Tensor(shape=(None, None), dtype=int32) • token_type_ids=tf.Tensor(shape=(None, None), dtype=int32) • position_ids=None • head_mask=None • inputs_embeds=None • output_attentions=False • output_hidden_states=False • return_dict=True • training=False
It is supposed to make a SavedModel but instead, I get this error mentioned above. The SavedModel is needed for TensorFlow Serving .
The text was updated successfully, but these errors were encountered:
saved_model=True
Following merging of #18153 the reproduction snippet runs on main without error.
Sorry, something went wrong.
No branches or pull requests
System Info
transformers
version: 4.20.1Who can help?
@Rocketknight1 @gante
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Expected behavior
It is supposed to make a SavedModel but instead, I get this error mentioned above. The SavedModel is needed for TensorFlow Serving .
The text was updated successfully, but these errors were encountered: