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] Support for GPU usage #907

Open
AbhiPawar5 opened this issue Jul 11, 2024 · 3 comments
Open

[feat] Support for GPU usage #907

AbhiPawar5 opened this issue Jul 11, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@AbhiPawar5
Copy link

Description
For Profanity and NSFW detection, the code uses a transformer pipeline under the hood. However, the device argument should be passed to use the best hardware accelerator.

Why is this needed
This is a general feature to speedup the pipeline inference significantly

Implementation details
Adding device with proper integer should solve the problem. More details here - https://huggingface.co/transformers/v3.0.2/main_classes/pipelines.html#transformers.Pipeline

End result
Across multiple pipelines and use cases.

@AbhiPawar5 AbhiPawar5 added the enhancement New feature or request label Jul 11, 2024
@wylansford
Copy link
Contributor

wylansford commented Jul 11, 2024

Good catch!

I've added GPU support for nsfw text here:
https://github.com/guardrails-ai/nsfw_text

For the profanity check, did you mean
https://github.com/guardrails-ai/profanity_free
?

I believe this validator runs off of sci-kit on the backend, so I am not sure if it provides GPU support natively.

@AbhiPawar5
Copy link
Author

AbhiPawar5 commented Jul 11, 2024 via email

@wylansford
Copy link
Contributor

wylansford commented Jul 11, 2024

Can you provide the logs? From what I can tell it uses,

https://github.com/vzhou842/profanity-check

Which is just an SVM on the backend. There shouldn't be any huggingface calls made for it

here is the code:
https://github.com/guardrails-ai/profanity_free/blob/main/validator/main.py

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

No branches or pull requests

2 participants