-
Notifications
You must be signed in to change notification settings - Fork 500
Add Pruna AI library snippets and integration #1684
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
base: main
Are you sure you want to change the base?
Add Pruna AI library snippets and integration #1684
Conversation
- Introduced a new library entry for Pruna AI in model-libraries. - Added main entry point and specific snippet generation functions for diffusers and transformers models. - Cleaned up whitespace inconsistencies in existing snippets. This update enhances support for Pruna AI, providing users with tailored code snippets for model integration.
This is super cool :) It looks good from the Pruna side. Loading models with this snippet would facilitate their compression to make them more efficient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot, it's nice to see you here! interestingly this adds a lot of newlines, would be great to run linter
I think no need for a lot of comments to keep the code minimal :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @davidberenstein1957 - let's wait for @Wauplin to give it a review, since this PR is a bit more involved!
- Added a new function `pruna_pro` for generating tailored code snippets for Pruna AI models. - Updated the model libraries to include Pruna AI with appropriate repository details and snippet references. - Improved code readability by standardizing function syntax and cleaning up whitespace. This update further supports the integration of Pruna AI, providing users with enhanced code generation capabilities.
- Introduced a new entry for PXIA in the model-libraries, including repository details and snippet references. - Enhanced the library structure to support additional model integrations. This update expands the capabilities of the model-libraries, providing users with access to PXIA resources.
@Vaibhavs10 @merveenoyan, thanks for the review. :) I've resolved the formatting. I realised that the formatting commands in the Readme were merely checking and not applying the formatting directly. @Wauplin, feel free to give it a go. I can remove all comments if needed, but given that it is a bit more involved, I think they help with clarity around the formatting steps. Let me know what you prefer :) |
"pruna_pro-ai": { | ||
prettyLabel: "Pruna AI", | ||
repoName: "Pruna AI", | ||
repoUrl: "https://github.com/Pruna-AI/pruna-ai", | ||
snippets: snippets.pruna_pro, | ||
docsUrl: "https://docs.pruna.ai", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit weird to me that two different "libraries" would show up with the same name. In addition, there are only two test models on the Hub that use library pruna_pro-ai
.
return pruna_default(model); | ||
}; | ||
|
||
export const pruna_diffusers = (model: ModelData): string[] => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the snippets always be forward-compatible with new pipelines? As an alternative, we could provide some specific snippets here instead of doing replacements.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, not a fan of unrelated formatting changes, but I'll let @Wauplin or @hanouticelina comment on best practices in this regard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. Happy to revert these changes if you feel it is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best would be to revert these changes from this PR and open a new one with only the formatting changes 🙏 Would make the discussion cleaner to follow :)
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
@Wauplin @hanouticelina , ping :) |
"pruna_pro-ai": { | ||
prettyLabel: "Pruna AI (pro)", | ||
repoName: "Pruna AI (pro)", | ||
repoUrl: "https://github.com/Pruna-AI/pruna-ai", | ||
snippets: snippets.pruna_pro, | ||
docsUrl: "https://docs.pruna.ai", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a fan of having two ≠ libraries. IMO this should always be Pruna (and you can prompt users to upgrade to a "pro" version from inside your library/error-messages/documentation/etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Since https://github.com/PrunaAI/pruna is a single library, it should be linked to a single tag and then handle the "pro" models separately.
Note that in the pruna snippet above you receive ModelData
as input:
export const pruna = (model: ModelData): string[] => {
this means you can return a different snippet based on model name or tags. For instance, you could choose that all "pro" pruna models have a name ending by -pro
and return a different snippet in that case.
"pruna-ai": { | ||
prettyLabel: "Pruna AI", | ||
repoName: "Pruna AI", | ||
repoUrl: "https://github.com/Pruna-AI/pruna-ai", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting a 404 on this link. Shouldn't it be https://github.com/PrunaAI/pruna instead?
repoUrl: "https://github.com/Pruna-AI/pruna-ai", | |
repoUrl: "https://github.com/PrunaAI/pruna", |
This update enhances support for Pruna AI, providing users with tailored code snippets for model integrations with Transformers and Diffusers.
TLDR: Pruna API normally mimics the Transformers and Diffusers API, so we can use
PrunaModel.from_pretrained
on top of pipelines or specific models. We re-use the underlying snippets for both the library and do some greedy replacements of certain part of the code snippets.example
becomes