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

error while running code #44

Open
raseena-tp opened this issue Jan 4, 2023 · 6 comments
Open

error while running code #44

raseena-tp opened this issue Jan 4, 2023 · 6 comments

Comments

@raseena-tp
Copy link

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

@qanastek
Copy link
Owner

qanastek commented Jan 4, 2023

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.

@raseena-tp
Copy link
Author

raseena-tp commented Jan 4, 2023

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

@raseena-tp
Copy link
Author

raseena-tp commented Jan 4, 2023 via email

@raseena-tp
Copy link
Author

raseena-tp commented Jan 15, 2023 via email

@Metal079
Copy link

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)

@qanastek
Copy link
Owner

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.

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

No branches or pull requests

3 participants