qanastek / HugsVision

HugsVision is a easy to use huggingface wrapper for state-of-the-art computer vision

Home Page:https://pypi.org/project/hugsvision/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error while running code

raseena-tp opened this issue · comments

i am getting an error while running the below code snippet,

from hugsvision.nnet.VisionClassifierTrainer import VisionClassifierTrainer
from transformers import ViTFeatureExtractor, ViTForImageClassification

trainer = VisionClassifierTrainer(
model_name = "MyKvasirV2Model",
train = train,
test = test,
output_dir = "./out/",
max_epochs = 1,
batch_size = 32, # On RTX 2080 Ti
lr = 2e-5,
fp16 = True,
model = ViTForImageClassification.from_pretrained(
huggingface_model,
num_labels = len(label2id),
label2id = label2id,
id2label = id2label
),
feature_extractor = ViTFeatureExtractor.from_pretrained(
huggingface_model,
),
)
error

Hi,

Thank you very much for your help. I just edit the main branch of the repository to fix this issue. You can install it from here by using pip install --force --upgrade git+https://github.com/qanastek/HugsVision.git until I got the time to compile the PyPi archive again.

Again, thank you for your feedback.

But still, it shows the same error...Can you pls resolve this?

Do this to fix it

self.metric = torchmetrics.Accuracy(task="multiclass", num_classes=13)

sir, this is still not working.....can u pls correct the issue....because i am doing one project with this.

On Wed, Jan 4, 2023 at 8:10 PM Labrak Yanis @.> wrote: Hi, Thank you very much for your help. I just edit the main branch of the repository to fix this issue. You can install it from here by using pip install --force --upgrade git+https://github.com/qanastek/HugsVision.git until I got the time to compile the PyPi archive again. Again, thank you for your feedback. — Reply to this email directly, view it on GitHub <#44 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZSLGB6M7INRP24KIHZMBLLWQWDVFANCNFSM6AAAAAATQ26CXE . You are receiving this because you authored the thread.Message ID: @.>

Do this in VisionClassifierTrainer.py

self.metric = torchmetrics.Accuracy(task="multiclass", num_classes=2)

Thank you @Metal079 and @raseena-tp for your help, and sorry for my late response, I was very busy during past weeks.

I push a new commit where I fix the issue and build the new PyPi version 0.75.4.