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

Enforce parameters as a List of Dictionaries in modelinfo.safetensors #2585

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

adiaholic
Copy link
Contributor

@adiaholic adiaholic commented Oct 1, 2024

This PR modifies the model_info method to ensure that the SafeTensorsInfo instance is initialized with a list of dictionaries for the parameters attribute, as intended by the class definition.

This PR changes the type definition of parameters attribute in SafeTensorsInfo to be a Dict instead of List[Dict[str, int]]

The model_info response for repo_id = allenai/Molmo-72B-0924 is of the form:

"safetensors": {
            "parameters": {
                "F32": 73308285952
            },
            "total": 73308285952
        },

which is not expected since parameters should be of type List[Dict[str, int]] Dict[str, int]

This PR might serve as an extension for #2190

@hanouticelina
Copy link
Contributor

Hi @adiaholic, thanks for spotting the mismatch! the issue is actually in the type definition: The parameters field in SafeTensorsInfo should be Dict[str, int], not List[Dict[str, int]].
We should update the type annotation instead as it is defined here : huggingface/huggingface.js/packages/tasks/src/model-data.ts .

@adiaholic
Copy link
Contributor Author

Hi @adiaholic, thanks for spotting the mismatch! the issue is actually in the type definition: The parameters field in SafeTensorsInfo should be Dict[str, int], not List[Dict[str, int]]. We should update the type annotation instead as it is defined here : huggingface/huggingface.js/packages/tasks/src/model-data.ts .

Thank you for reviewing this and providing clarification. I've made some updates to SafeTensorsInfo, and I hope they meet the requirements. Please feel free to let me know if any further adjustments are needed.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

All good! thanks again @adiaholic 🤗

@hanouticelina hanouticelina merged commit 8042483 into huggingface:main Oct 3, 2024
16 checks passed
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.

3 participants