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

I get this error when I use Example code for huggingface ,how can i fix it? #392

Closed
sammichenVV opened this issue Dec 27, 2022 · 4 comments

Comments

@sammichenVV
Copy link

sammichenVV commented Dec 27, 2022

this is my code:
image
the error is:Expected format: {'predictions': Value(dtype='int32', id=None), 'references': Value(dtype='int32', id=None)},
image

@SkanderHellal
Copy link

Hello,
Can you give us further details on the task you are working on? is it a simple classification task? In that case , if you flatten your tensors, you will get the good result.

@sammichenVV
Copy link
Author

it's fixed by flatten tensors. my task is translation . I use xlm-roberta to fine tune. The way to load the model is XLMRobertaForCausalLM.from_pretrained('xlm-roberta-base'). and I fix it by flatten tensor "predictions=predictions.view(5120) references=batch["labels"].view(5120)".

@lvwerra
Copy link
Member

lvwerra commented Jan 6, 2023

Closing this as it seems resolved.

@lvwerra lvwerra closed this as completed Jan 6, 2023
@cspink
Copy link

cspink commented Jul 5, 2023

Could you elaborate on the flattening, @SkanderHellal? I get the same error for my setup and don't understand why it doesn't work, as training works with the same preparation of the dataset. Where can I read more on this?

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

4 participants