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

Register all timm models with ImageNet-1K and update documentation #24

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,7 @@ model = xinfer.create_model(model)


TIMM:
<table>
<thead>
<tr>
<th>Model</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://github.com/baaivision/EVA/tree/master/EVA-02">EVA02 Series</a></td>
<td><code>xinfer.create_model("eva02_small_patch14_336.mim_in22k_ft_in1k")</code></td>
</tr>
</tbody>
</table>
All models from [TIMM](https://github.com/huggingface/pytorch-image-models) fine-tuned for ImageNet 1k are supported.

> [!NOTE]
> Wish to load an unsupported model?
Expand Down
594 changes: 474 additions & 120 deletions nbs/timm.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ einops
pillow
gradio
itables
pandas
pandas
numpy<2.0.0
2 changes: 1 addition & 1 deletion xinfer/timm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .eva02 import EVA02
from .load_timm_models import load_timm_models
from .timm_model import TimmModel
47 changes: 0 additions & 47 deletions xinfer/timm/eva02.py

This file was deleted.

16 changes: 16 additions & 0 deletions xinfer/timm/load_timm_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import timm

from ..model_registry import ModelInputOutput, register_model
from .timm_model import TimmModel


def load_timm_models():
model_list = timm.list_models("*1k*", pretrained=True)

for model_id in model_list:
register_model(model_id, "timm", ModelInputOutput.IMAGE_TO_CATEGORIES)(
TimmModel
)


load_timm_models()
Loading