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

Using HuggingFace ViT implementation (#219) #303

Merged
merged 5 commits into from
Jun 19, 2023
Merged

Using HuggingFace ViT implementation (#219) #303

merged 5 commits into from
Jun 19, 2023

Conversation

prabhuteja12
Copy link
Contributor

Solves #219

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@prabhuteja12 prabhuteja12 changed the base branch from main to dev June 16, 2023 11:55
@prabhuteja12 prabhuteja12 marked this pull request as ready for review June 16, 2023 11:58
@@ -119,6 +144,7 @@ def __init__(self, **kwargs: Any) -> None:
num_heads=12,
hidden_dim=768,
mlp_dim=3072,
pretrained_name="google/vit-base-patch16-224",
Copy link
Contributor

Choose a reason for hiding this comment

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

why still pass the other arguments? they aren't used, right? or is this a requirement for reloading the model?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Point.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I thought the idea was to reload it without pretrained_name. Now, it will not be able to reloaded since pretrained_name is missing? Can we maybe add a test for this model or do we already have that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

model_fn loads through from_state_dict if model_state_url is specified. So reloading (in principle) should be able to restore the weights.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would a test for this do?

prediction_strategy: Optional[PredictionStrategy] = None,
add_icarl_class_means: bool = True,
pretrained_name: Optional[str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe make this the first argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@github-actions
Copy link

Coverage report

The coverage rate went from 85.68% to 85.17% ⬇️

92.85% of new lines are covered.

Diff Coverage details (click to unfold)

src/renate/benchmark/models/vision_transformer.py

92.85% of new lines are covered (97.36% of the complete file).
Missing lines: 40

@wistuba wistuba merged commit e4984aa into dev Jun 19, 2023
18 checks passed
@wistuba wistuba deleted the pt_use_hfvit branch June 19, 2023 11:15
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.

None yet

2 participants