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

use max sequence length for tokenization #1166

Merged
merged 1 commit into from
Aug 9, 2023
Merged

Conversation

horheynm
Copy link
Member

@horheynm horheynm commented Aug 4, 2023

Fix bug for https://neuralmagic.slack.com/archives/C0592FX3215/p1687210067995879

Example:

from deepsparse import Pipeline


path = "path"

pipeline = Pipeline.create(
    task = "text-classification",
    model_path = path,
    batch_size=8,
    num_cores=None,
    sequence_length = [2, 128],
)

text = "We are flying from Texas to California"
pipeline(text)

Before:

(.venv) ubuntu@quad-mle-2:~/george/nm/deepsparse$ python3 scratch/_p.py 
...
2023-08-04 01:19:39 __main__     INFO     Overwriting in-place the input shapes of the transformer model at /home/ubuntu/.cache/sparsezoo/bert-large-squad_wikipedia_bookcorpus-pruned80.4block_quantized/bert-large-squad_wikipedia_bookcorpus-pruned80.4block_quantized/model.onnx
Token indices sequence length is longer than the specified maximum sequence length for this model (9 > 2). Running this sequence through the model will result in indexing errors

After"

(.venv) ubuntu@quad-mle-2:~/george/nm/deepsparse$ python3 scratch/_p.py 
...
2023-08-04 01:25:44 __main__     INFO     Overwriting in-place the input shapes of the transformer model at /home/ubuntu/.cache/sparsezoo/bert-large-squad_wikipedia_bookcorpus-pruned80.4block_quantized/bert-large-squad_wikipedia_bookcorpus-pruned80.4block_quantized/model.onnx

@horheynm horheynm marked this pull request as ready for review August 4, 2023 02:21
mgoin
mgoin previously requested changes Aug 4, 2023
src/deepsparse/transformers/pipelines/pipeline.py Outdated Show resolved Hide resolved
Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@mgoin mgoin merged commit cf9864b into main Aug 9, 2023
7 checks passed
@mgoin mgoin deleted the max-bucket-tokenization branch August 9, 2023 13:42
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

Successfully merging this pull request may close these issues.

None yet

3 participants