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

Adding some quality of life for pipeline function. #14322

Merged
merged 4 commits into from
Nov 10, 2021

Conversation

Narsil
Copy link
Contributor

@Narsil Narsil commented Nov 8, 2021

What does this PR do?

Adds two quality of life things on pipeline function.

  • Make task optional pipeline(model="gpt2") should not be enough (will rely on the hub).
  • Make pipeline_class overridable to ease override for users of the pipeline function.
    pipeline(model="gpt2", pipeline_class=MyPipeline) should enable you to use whatever
    pipeline you want.

Related to #14278

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@LysandreJik

@Narsil Narsil force-pushed the qol_pipeline_magic branch from f62f1c5 to 3cfcdf3 Compare November 8, 2021 14:52
@Narsil Narsil force-pushed the qol_pipeline_magic branch from 3cfcdf3 to f13cf26 Compare November 8, 2021 15:34
@Narsil Narsil requested review from LysandreJik and sgugger and removed request for LysandreJik November 9, 2021 17:01
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Those look like great improvements, thanks for adding support!

docs/source/main_classes/pipelines.rst Outdated Show resolved Hide resolved
src/transformers/pipelines/__init__.py Outdated Show resolved Hide resolved
@require_torch
def test_check_task_auto_inference(self):
pipeline(model="Narsil/tiny-distilbert-sequence-classification")

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we check that the result has the right type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done it, thanks !

Narsil and others added 3 commits November 10, 2021 09:31
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
@Narsil
Copy link
Contributor Author

Narsil commented Nov 10, 2021

I'll merge ahead.

@Narsil Narsil merged commit 5c15307 into huggingface:master Nov 10, 2021
@Narsil Narsil deleted the qol_pipeline_magic branch November 10, 2021 09:18
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