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

Update numpy version to latest #1094

Merged
merged 2 commits into from
Jun 26, 2023
Merged

Update numpy version to latest #1094

merged 2 commits into from
Jun 26, 2023

Conversation

rahul-tuli
Copy link
Member

@rahul-tuli rahul-tuli commented Jun 26, 2023

Updates numpy support to latest

Needs the following pieces from sparsezoo and sparseml

Tested locally using the following code and numpy 1.24, including the changes from above two diffs:

from deepsparse import Pipeline

task = "question-answering"
dense_qa_pipeline = Pipeline.create(
    task=task,
    model_path="zoo:nlp/question_answering/distilbert-none/pytorch/huggingface/squad/base-none",
)

question = "DeepSparse is sparsity-aware inference runtime offering GPU-class"
q_context = "What is DeepSparse?"

print(dense_qa_pipeline(question=question, context=q_context))

Also ran all pipeline and transformer tests! They are green.

The problem only arises in question-answering pipeline due to computation of span_extra_info which involved a ragged sequence, supplying a dtype=object solves this; this also seems feasible because earlier numpy versions(<=1.21) automatically converted a ragged sequence into an array of objects, which entails our codebase is already built to handle that case.

@rahul-tuli rahul-tuli marked this pull request as draft June 26, 2023 13:40
@rahul-tuli rahul-tuli self-assigned this Jun 26, 2023
…ValueErrors when trying to convert ragged sequences
@rahul-tuli rahul-tuli marked this pull request as ready for review June 26, 2023 18:51
@rahul-tuli rahul-tuli added the enhancement New feature or request label Jun 26, 2023
@rahul-tuli rahul-tuli changed the title [WIP] Update numpy version to latest Update numpy version to latest Jun 26, 2023
@bfineran bfineran merged commit a4b311d into main Jun 26, 2023
7 checks passed
@bfineran bfineran deleted the numpy-version-upgrade branch June 26, 2023 19:30
@mgoin mgoin linked an issue Jun 27, 2023 that may be closed by this pull request
horheynm pushed a commit that referenced this pull request Jul 6, 2023
* Update numpy version to latest

* Update problem line to use a helper that takes care of numpy raising ValueErrors when trying to convert ragged sequences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support numpy > 1.21.6
2 participants