-
Notifications
You must be signed in to change notification settings - Fork 140
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
[torchvision][Bug-fix] ignore state dict error on transfer learning tasks + use PythonLogger default logger #1455
Merged
Conversation
This file contains 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
KSGulin
requested review from
tdg5 and
abhinavnmagic
and removed request for
a team
March 17, 2023 16:09
rahul-tuli
previously approved these changes
Mar 17, 2023
dbogunowicz
previously approved these changes
Mar 17, 2023
corey-nm
reviewed
Mar 17, 2023
bfineran
previously approved these changes
Mar 17, 2023
KSGulin
dismissed stale reviews from bfineran, dbogunowicz, and rahul-tuli
via
March 17, 2023 19:11
9c156cd
KSGulin
force-pushed
the
ic_class_fix
branch
2 times, most recently
from
March 17, 2023 19:17
0f66a06
to
2fd4854
Compare
bfineran
reviewed
Mar 17, 2023
bfineran
approved these changes
Mar 17, 2023
bfineran
changed the title
[Bug-fix] Don't override num_classes for pre-trained torchvision models
[torchvision][Bug-fix] ignore state dict error on transfer learning tasks + use PythonLogger default logger
Mar 17, 2023
anmarques
approved these changes
Mar 17, 2023
bfineran
added a commit
that referenced
this pull request
Mar 17, 2023
…asks + use PythonLogger default logger (#1455) * Remove cf from native torchvision models * * do not pass default logger to PythonLogger * comments --------- Co-authored-by: Damian <damian@neuralmagic.com> Co-authored-by: Benjamin <ben@neuralmagic.com>
bfineran
added a commit
that referenced
this pull request
Mar 17, 2023
…asks + use PythonLogger default logger (#1455) * Remove cf from native torchvision models * * do not pass default logger to PythonLogger * comments --------- Co-authored-by: Damian <damian@neuralmagic.com> Co-authored-by: Benjamin <ben@neuralmagic.com>
bfineran
added a commit
that referenced
this pull request
Mar 17, 2023
…ansfer learning tasks + use PythonLogger default logger #1455 (#1460) * [torchvision][Bug-fix] ignore state dict error on transfer learning tasks + use PythonLogger default logger (#1455) * Remove cf from native torchvision models * * do not pass default logger to PythonLogger * comments --------- Co-authored-by: Damian <damian@neuralmagic.com> Co-authored-by: Benjamin <ben@neuralmagic.com> * [torchvision] add ignore error tensors back to optional checkpoint load (#1459) --------- Co-authored-by: Konstantin Gulin <66528950+KSGulin@users.noreply.github.com> Co-authored-by: Damian <damian@neuralmagic.com>
bfineran
added a commit
that referenced
this pull request
Mar 17, 2023
…ansfer learning tasks + use PythonLogger default logger #1455 (#1461) * [torchvision][Bug-fix] ignore state dict error on transfer learning tasks + use PythonLogger default logger (#1455) * Remove cf from native torchvision models * * do not pass default logger to PythonLogger * comments --------- Co-authored-by: Damian <damian@neuralmagic.com> Co-authored-by: Benjamin <ben@neuralmagic.com> * [torchvision] add ignore error tensors back to optional checkpoint load (#1459) --------- Co-authored-by: Konstantin Gulin <66528950+KSGulin@users.noreply.github.com> Co-authored-by: Damian <damian@neuralmagic.com>
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.
When loading a pre-trained torchvision model, an error will occur if the number of classes in the target dataset doesn't match the number of classes in the pre-trained model. e.g. when using a smaller subset of the original dataset. This PR fixes that issue by ignoring the classification head in the loaded model dict. Note that in some cases (such as inceptionet) it will fail, as for some models the classification head naming doesn't follow the standard naming pattern.
Test plan
sparseml.image_classification.train --checkpoint-path verizon_dense.pt --arch-key densenet121 --dataset-path /network/datasets/imagenette-160/imagenette-160 --pretrained True