Does not work

#2
by kopyl - opened

My code:

import requests
from PIL import Image
from io import BytesIO
import os

from transformers import ViTFeatureExtractor, ViTForImageClassification
model = ViTForImageClassification.from_pretrained('ibombonato/swin-age-classifier')
transforms = ViTFeatureExtractor.from_pretrained('ibombonato/swin-age-classifier')

Error: https://i.imgur.com/C1boD9U.jpg

This model/code is two years old, so I really dont know if it stills works...

But the error message tells the problem: "You are using a model of type SWIN to instantiate a model of type VIT"

Use SWIN besides VIT and give it a try

from transformers import SwinForImageClassification, AutoFeatureExtractor

feature_extractor = AutoFeatureExtractor.from_pretrained(...)
model = SwinForImageClassification.from_pretrained(...)
ibombonato changed discussion status to closed

@ibombonato thanks :)

Sign up or log in to comment