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

feat(transformers): api(image processor/feature extractor/automodel/pipelines) #802

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

wcrzlh
Copy link
Contributor

@wcrzlh wcrzlh commented Dec 25, 2024

What does this PR do?

This PR(based on #748) contains following features:

  • image processor
  • feature extractor
  • automodel
  • pipelines

Image processor and feature extractor would be served as part of VLLM. It could be tested based on PR749 and test scripts

AutoModel could be used to call model existed on mindone.transformers or could be integrated in Pipelines api:

from mindone.transformers import AutoModel

model = AutoModel.from_pretrained("google-bert/bert-base-uncased")
print(model)

Pipelines part could tested based on following codes:

from mindone.transformers.pipelines import pipeline

generator = pipeline(model="google-bert/bert-base-uncased")
outputs = generator("This is a simple [MASK]")
print(outputs)

Expected output:

[{'score': 0.041297122836112976, 'token':3291, 'token_str': 'problem', 'sequence': 'this is a simple problem.'},
{'score': 0.03821507468819618, 'token':8522, 'token_str': 'equation', 'sequence': 'this is a simple equation'},
{'score': 0.029827609658241272, 'token':3160, 'token_str': 'question', 'sequence': 'this is a simple question'},
{'score': 0.027154073119163513, 'token':7709, 'token_str': 'procedure', 'sequence': 'this is a simple procedure'},
{'score': 0.025617485865950584, 'token':7577, 'token_str': 'trick', 'sequence': 'this is a simple trick'}]

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?
  • Did you make sure to update the documentation with your changes? E.g. record bug fixes or new features in What's New. Here are the
    documentation guidelines
  • Did you build and run the code without any errors?
  • Did you report the running environment (NPU type/MS version) and performance in the doc? (better record it for data loading, model inference, or training tasks)
  • 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.

@xxx

@wcrzlh wcrzlh requested a review from vigo999 as a code owner December 25, 2024 04:49
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.

1 participant