Skip to content
New issue

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

keras_nlp RuntimeError: Exception encountered when calling MultiSegmentPacker.call(). #38

Open
dsbyprateekg opened this issue Aug 18, 2023 · 6 comments
Assignees

Comments

@dsbyprateekg
Copy link

Please go to TF Forum for help and support:

https://discuss.tensorflow.org/tag/keras

If you open a GitHub issue, here is our policy:

It must be a bug, a feature request, or a significant problem with the documentation (for small docs fixes please send a PR instead).
The form below must be filled out.

Here's why we have that policy:.

Keras developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.

System information.

  • Have I written custom code (as opposed to using a stock example script provided in Keras): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Colab
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below): 2.13.0
  • Python version: 3.10.12
  • Bazel version (if compiling from source):
  • GPU model and memory: TPU
  • Exact command to reproduce:

You can collect some of this information using our environment capture script:

https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh

You can obtain the TensorFlow version with:
python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the problem.

Describe the problem clearly here. Be sure to convey here why it's a bug in Keras or why the requested feature is needed.

preprocessor = keras_nlp.models.BertPreprocessor.from_preset(
preset="bert_large_en", # Name of the model
sequence_length=200, # Max sequence length, will be padded if shorter
)

outs = preprocessor(df.options.iloc[0])

Source code / logs.
RuntimeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 outs = preprocessor(df.options.iloc[0]) # Process options for the first row
2
3 # Display the shape of each processed output
4 for k, v in outs.items():
5 print(k, ":", v.shape)

7 frames
/usr/local/lib/python3.10/dist-packages/tensorflow_text/python/ops/trimmer_ops.py in (.0)
345 )
346 return [
--> 347 ragged_tensor.RaggedTensor.from_row_splits(m, s)
348 for m, s in zip(o_values, o_splits)
349 ]
RuntimeError: Exception encountered when calling MultiSegmentPacker.call().

Arguments received by MultiSegmentPacker.call():
• inputs=[[['5979', '1104', '1103', '1378', '8477', '14702', '4856', '1103', '3772', '1104', '12556', '22293', '8102', '1811', '25082', '113', '150', '11414', '2137', '114', '1113', '1103', '4379', '107', '3764', '2927', '15136', '1596', '3367', '107', '6187', '1874', '10224', '3457', '1107', '15593', '13687', '136', '150', '11414', '2137', '1110', '170', '2749', '1115', '13822', '1103', '4379', '3764', '2927', '15136', '1596', '3367', '1107', '15593', '13687', '1118', '2112', '10164', '1103', '3796', '1104', '170', '1207', '1532', '1104', '2187', '1270', '107', '22520', '1843', '2187', '119', '107'], ['5979', '1104', '1103', '1378', '8477', '14702', '4856', '1103', '3772', '1104', '12556', '22293', '8102', '1811', '25082', '113', '150', '11414', '2137', '114', '1113', '1103', '4379', '107', '3764', '2927', '15136', '1596', '3367', '107', '6187', '1874', '10224', '3457', '1107', '15593', '13687', '136', '150', '11414', '2137', '1110', '170', '2749', '1115', '6986', '1103', '6187', '1874', '10224', '3457', '1206', '1103', '4379', '3764', '2927', '15136', '1596', '3367', '1107', '15593', '13687', '1105', '1103', '7140', '10537', '4267', '20623', '14971', '1121', '170', '5318', '1104', '1213', '1275', '1106', '170', '5318', '1104', '1164', '1406', '119'], ['5979', '1104', '1103', '1378', '8477', '14702', '4856', '1103', '3772', '1104', '12556', '22293', '8102', '1811', '25082', '113', '150', '11414', '2137', '114', '1113', '1103', '4379', '107', '3764', '2927', '15136', '15...

@tilakrayal
Copy link
Collaborator

@dsbyprateekg,
Could you please provide the complete standalone code to reproduce the issue which helps us to analyse the issue in an effective way. Thank you!

@dsbyprateekg
Copy link
Author

@tilakrayal I am getting a new error after changing the preset model. Please find below the link of my colab norebook-
`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in <cell line: 1>()
5
6 # Get train and validation datasets
----> 7 (train_ds, train_df), (valid_ds, valid_df) = get_datasets(fold)
8
9 # Get callback functions for training

11 frames
/usr/local/lib/python3.10/dist-packages/numexpr/necompiler.py in stringToExpression(s, types, context)
272 no_whitespace = re.sub(r'\s+', '', s)
273 if _forbidden_re.search(no_whitespace) is not None:
--> 274 raise ValueError(f'Expression {s} has forbidden control characters.')
275
276 old_ctx = expressions._context.get_current_context()

ValueError: Expression (fold) != (__pd_eval_local_fold) has forbidden control characters.`

https://colab.research.google.com/drive/1EF0nsa__mEgoq6D1uHeqnANTdSksa7dF?usp=sharing

@tilakrayal
Copy link
Collaborator

https://colab.research.google.com/drive/1EF0nsa__mEgoq6D1uHeqnANTdSksa7dF?usp=sharing

The colab link which was provided above redirects the another page where the code was not available to reproduce. Could you please re-check and provide the code. Thank you!

@dsbyprateekg
Copy link
Author

@tilakrayal
Copy link
Collaborator

@dsbyprateekg,
Apologies. AFAIK you are trying to provide the colab link from the drive, which I was not able to access and redirect to the different page. Could you please try to make the colab gist from the FILE options(Save a copy as a colab gist). Thank you!

@sachinprasadhs sachinprasadhs transferred this issue from keras-team/keras Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants