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

Fix issues with minification (Closes #300) #307

Merged
merged 4 commits into from
Sep 17, 2023
Merged

Fix issues with minification (Closes #300) #307

merged 4 commits into from
Sep 17, 2023

Conversation

xenova
Copy link
Collaborator

@xenova xenova commented Sep 15, 2023

This PR fixes issues that arise from using this.constructor.name or this.name to determine which model should be instantiated when doing from_pretrained, after minification. This is because the class names are changed to things like tt or te and so do not correspond to their correct names (#283). We overcome this limitation by storing a bidirectional mapping from class names (e.g., 'BertForSequenceClassification') and the class name (could be BertForSequenceClassification if unminified, or, say, te if minified). Although this does require a bit more boilerplate when adding new models, it should reduce issues that arise in future.

One solution (which I did not go for) is to simply not minify class names. However, this would require all users of the library to do the same, and may defeat the purposes of minification. It also increases bundle size, which is not ideal.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 15, 2023

The documentation is not available anymore as the PR was closed or merged.

@xenova xenova changed the title Fix issues with minimization (Closes #300) Fix issues with minification (Closes #300) Sep 17, 2023
@xenova xenova merged commit 6f1842a into main Sep 17, 2023
4 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.

[Bug] Error: Unsupported model type: whisper when running in a app bundled with vite
2 participants