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

allow to load pretrained weights when the include_top variable is False #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kurnianggoro
Copy link

This merge request is related to the bug #278

The class initialization is failed when called using from_pretrained(.., include_top=False) function or when the number of classes is not equal to 1000, i.e. from_pretrained(.., num_classes=100).

This pull request allow to load the pre-trained weights even when the number of classes is not equal to 1000 or when the top classifier is ignored.

_fc.weight and _fc.bias will only be loaded when include_top=True and num_classes=1000 (default values)

@spirosbax
Copy link

Why hasn't this been merged yet? A simple solution to a problem affecting many users.

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.

2 participants