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

fix(transformers): check for task aliases #3337

Merged
merged 1 commit into from
Dec 9, 2022

Conversation

jeffthebear
Copy link
Contributor

Bug Fix: add task aliases of transformers pipeline supported tasks

What does this PR address?

I ran into an issue today trying to load a Huggingface pipeline after it was saved via:

nlp = pipeline('ner', model=model, tokenizer=tokenizer)
bentoml.transformers.save_model(name="ner", pipeline=nlp)
runner = bentoml.transformers.get("ner:latest").to_runner()  # fails here

The "ner" task is one of the [TASK_ALIASES](https://github.com/huggingface/transformers/blob/main/src/transformers/pipelines/__init__.py#L150) in transformers pipeline which maps to a SUPPORTED_TASK. Funny thing is save_model() has TASK_ALIASES support but maybe it was forgotten in load_model().

@jeffthebear jeffthebear requested a review from a team as a code owner December 9, 2022 03:57
@jeffthebear jeffthebear requested review from parano and removed request for a team December 9, 2022 03:57
@codecov
Copy link

codecov bot commented Dec 9, 2022

Codecov Report

Merging #3337 (6aa0442) into main (d7254c0) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3337      +/-   ##
==========================================
- Coverage   33.12%   33.12%   -0.01%     
==========================================
  Files         132      132              
  Lines       10626    10627       +1     
  Branches     1776     1776              
==========================================
  Hits         3520     3520              
- Misses       6869     6870       +1     
  Partials      237      237              
Impacted Files Coverage Δ
src/bentoml/_internal/frameworks/transformers.py 0.00% <0.00%> (ø)

Copy link
Contributor

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

LGTM

@aarnphm aarnphm changed the title fix: add task aliases of supported tasks fix(transformers): check for task aliases Dec 9, 2022
@aarnphm aarnphm merged commit bedfe4a into bentoml:main Dec 9, 2022
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.

2 participants