Predicting the expected answer class for a question using pretrained AraBERT model. #182
Unanswered
ReemAlJunaid
asked this question in
Q&A
Replies: 1 comment 7 replies
-
@ReemAlJunaid The fix to the first OSError you got is wrong, if you don't find a pytorch_model.bin file which should be >500mb, then you didn't save the model |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm following your code here to perform text classification for a set of questions with their expected answer type, after training and saving the model, I want to see the predictions for some texts, So I wrote the following code:
`from transformers import pipeline,AutoModel, AutoModelForSequenceClassification, AutoTokenizer
model_name = 'aubmindlab/bert-base-arabertv02'
arabert_model = AutoModelForSequenceClassification.from_pretrained('/gdrive/MyDrive/LabelModel')
tokenizer = AutoTokenizer.from_pretrained(model_name)
text = "أين وقعت غزوة بدر؟"
#{'كيان': 0, 'تقريري': 1, 'حدث': 2, 'رقم': 3, 'عاقل': 4, 'موقع': 5, 'وصف': 6}
pipe = pipeline(model=arabert_model, tokenizer=tokenizer)
pipe(text) `
First, it gave me this error:
OSError: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory /gdrive/MyDrive/LabelModel.
Then I solved this problem by renaming the training_args.bin file to pytorch_model.bin as in this link
After that, another error exists:
AttributeError: 'TrainingArguments' object has no attribute 'keys'
How can I solve this?
Beta Was this translation helpful? Give feedback.
All reactions