Skip to content

Migrates bioclip classifier imports to use bioclip.predict#192

Merged
hlapp merged 2 commits into
mainfrom
nb-updates
Apr 22, 2026
Merged

Migrates bioclip classifier imports to use bioclip.predict#192
hlapp merged 2 commits into
mainfrom
nb-updates

Conversation

@hlapp

@hlapp hlapp commented Apr 22, 2026

Copy link
Copy Markdown
Member

This is in follow-up to #187 and #189.

Also fixes the patch size for GradCAM, which changed from BioCLIP1 (14x14) to BioCLIP2 (16x16).

@hlapp

hlapp commented Apr 22, 2026

Copy link
Copy Markdown
Member Author

Makes me wonder whether we shouldn't hardcode the desired model rather than pulling whatever the default is. @thompsonmj @egrace479 @NetZissou thoughts either way?

@egrace479

Copy link
Copy Markdown
Member

Makes me wonder whether we shouldn't hardcode the desired model rather than pulling whatever the default is. @thompsonmj @egrace479 @NetZissou thoughts either way?

Yes, I think we should provide the examples in these notebooks with BioCLIP 2 explicitly passed and include a note where checking which model is used matters (for this line).

@hlapp

hlapp commented Apr 22, 2026

Copy link
Copy Markdown
Member Author

Actually turns out the patch size is a red herring and has not changed between BioCLIP and BioCLIP2. It's the width of the transformer that has changed (now 1024), and probably as a result the spatial grid size in the token tensor.

The transformer widths of BioCLIP models can differ, and presumably
as a result the spatial grid size for the last transformer block (?).
For BioCLIP1 it is 14x14, but for BioCLIP2 it is 16x16.

Instead of hard-coding, we are inferring this now from the data unless
it is specified.
@hlapp

hlapp commented Apr 22, 2026

Copy link
Copy Markdown
Member Author

@hlapp hlapp requested review from egrace479 and thompsonmj April 22, 2026 20:23

@egrace479 egrace479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! I like the reproducibility comment for the BioCLIP 2 model call.

@hlapp hlapp merged commit a96a21f into main Apr 22, 2026
10 checks passed
@hlapp hlapp deleted the nb-updates branch April 22, 2026 22:18
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