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

Adding support for MobileViTV2 model #720

Closed
1 of 2 tasks
laszlokiss-szelena opened this issue Apr 22, 2024 · 3 comments · Fixed by #721
Closed
1 of 2 tasks

Adding support for MobileViTV2 model #720

laszlokiss-szelena opened this issue Apr 22, 2024 · 3 comments · Fixed by #721
Labels
new model Request a new model

Comments

@laszlokiss-szelena
Copy link

Model description

Hi,

I would love to use MobileViTV2 in my application. I am definitely not an expert, but it seems that its architecture is pretty similar to MobileViT, so adding it seems fairly straightforward to me.

Laszlo

Prerequisites

  • The model is supported in Transformers (i.e., listed here)
  • The model can be exported to ONNX with Optimum (i.e., listed here)

Additional information

No response

Your contribution

I experimented with this model on my fork here: KLaci@e1e02b1

I can submit a PR too if needed.

@laszlokiss-szelena laszlokiss-szelena added the new model Request a new model label Apr 22, 2024
@xenova
Copy link
Collaborator

xenova commented Apr 22, 2024

Hi there 👋 Looks like the ONNX export isn't as simple as I originally thought (see here). Is this something you'd be able to look into? :)

@xenova
Copy link
Collaborator

xenova commented Apr 22, 2024

Okay I might have got it working.

@xenova xenova mentioned this issue Apr 22, 2024
@xenova
Copy link
Collaborator

xenova commented Apr 22, 2024

Example code (requires #721):

import { pipeline } from '@xenova/transformers';

const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
const classifier = await pipeline('image-classification', 'Xenova/mobilevitv2-1.0-imagenet1k-256', {
    quantized: false,
});
const output = await classifier(url);
// [{ label: 'tiger, Panthera tigris', score: 0.6491137742996216 }]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new model Request a new model
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants