feat: 277 feature update modelcard to include a snippet and base model#282
Merged
davidberenstein1957 merged 16 commits intomainfrom Aug 8, 2025
Conversation
johannaSommer
requested changes
Jul 28, 2025
sharpenb
requested changes
Aug 1, 2025
Member
sharpenb
left a comment
There was a problem hiding this comment.
Faire renaming of functions. I left some comments. We should make sure that it does not increase maintenant needs.
johannaSommer
approved these changes
Aug 7, 2025
Member
johannaSommer
left a comment
There was a problem hiding this comment.
Thanks for addressing my comments David, LGTM!
552b9b2 to
7e00587
Compare
sharpenb
requested changes
Aug 8, 2025
Member
sharpenb
left a comment
There was a problem hiding this comment.
Thanks for the answers to my comment. I reopen the unaddressed comments and gave some more concrete suggestions to help solving them :)
- Updated `get_diffusers_unet_models` to use dynamic import for better module handling. - Added `push_to_hub` method in `PrunaModel` for streamlined model repository uploads. - Enhanced `from_pretrained` method to support loading from both local paths and Hugging Face Hub, with deprecation warning for `model_path`. - Improved README generation in `save_pruna_model_to_hub` by utilizing `ModelCard` for better metadata handling. - Updated model card template for improved documentation and flexibility in model usage instructions.
- Changed the tags in the model card to include "safetensors" alongside the dynamically generated library tag for improved clarity and categorization.
- Updated test functions to accept a parameter for the model loading method, allowing for more flexible testing of `from_hub` and `from_pretrained`. - Adjusted assertions to utilize the selected method dynamically, improving code maintainability and readability.
- Introduced a `token` parameter in `push_to_hub` and `save_pruna_model_to_hub` methods to facilitate authentication when pushing models to the Hugging Face Hub. - Updated model card generation to include the token for loading existing model cards. - Enhanced the model card template to reference the base repository ID for improved documentation clarity.
- Modified the test case in `test_load.py` to include the `from_pretrained` method for the non-existent model, ensuring consistency in testing model loading methods.
…l_to_hub` - Updated the `save_pruna_model_to_hub` function to ensure `model_name_or_path` is validated before checking repository existence. - Improved the model card template to conditionally display inference instructions based on the presence of `base_repo_id` and `library_name`, enhancing documentation clarity.
- Changed the documentation link in the model card template to point to the updated Pruna documentation site for improved accessibility and accuracy.
- Updated the `PrunaModel` and `save_pruna_model_to_hub` functions to replace the `token` parameter with `hf_token`, enhancing clarity regarding its purpose for Hugging Face authentication. - Adjusted related documentation to reflect the parameter name change, ensuring consistency across the codebase.
- Renamed `save_to_hub` to `push_to_hub` in the `PrunaModel` class and related functions to standardize terminology across the codebase. - Updated documentation and tutorial notebooks to reflect the new method names, ensuring clarity in model saving and loading processes. - Adjusted test cases to utilize the updated method names, enhancing consistency in testing model interactions with the Hugging Face Hub.
…utorials - Consolidated device selection logic in `image_generation.ipynb` and `llms.ipynb` to a single line for clarity. - Streamlined the calculation of percentage differences in both notebooks, enhancing code readability. - Ensured consistent formatting and structure across tutorial notebooks.
- Enhanced the formatting of code snippets in various tutorial notebooks for better readability, including consistent use of line breaks and indentation. - Consolidated multiple lines into single lines where appropriate, particularly in model loading and configuration sections. - Updated markdown cells to maintain clarity and consistency across tutorials, ensuring a smoother learning experience for users.
- Updated comments in the `save_pruna_model_to_hub` function to enhance clarity regarding the retrieval of the pruna library version, ensuring better understanding of the code's purpose and functionality.
- Bumped versions for `accelerate` (1.7.0 to 1.9.0), `aiohttp` (3.12.4 to 3.12.14), `yaspin` (3.1.0 to 2.2.0), and `zipp` (3.22.0 to 3.23.0). - Adjusted dependency URLs and hashes for updated packages. - Refined resolution markers for Python version compatibility.
…unctions - Added a ValueError in the `PrunaModel` class to ensure a valid `pretrained_model_name_or_path` is provided, enhancing robustness. - Updated the documentation in `save_load.rst` for clarity on loading the smashed model, correcting capitalization for consistency.
- Added new package `aenum` (version 3.1.16) and `kernels` (version 0.9.0) with their respective dependencies. - Updated `hqq` version from 0.2.6 to 0.2.7.post1 and adjusted its source URL. - Introduced `opencv-python` (version 4.11.0.86) with dependencies. - Refined resolution markers for Python version compatibility across various packages, enhancing support for different platforms.
a88e4c4 to
ece5a2d
Compare
sharpenb
approved these changes
Aug 8, 2025
Member
sharpenb
left a comment
There was a problem hiding this comment.
Thanks for incorporating all my comments! Let's go :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added multiple updates for better HF/transformers compatibility.
push_to_hubinstead ofsave_to_hubfrom_pretrainedinstead offrom_hubModelCardto copy base model card info from the original loaded model and added nuance on running inference.RENAMING
UPDATED MODEL CARD

Related Issue
Fixes #277
Fixes #278
Type of Change
How Has This Been Tested?
Checklist
Additional Notes