Introduction of wikibert-base-parsinlu-multiple-choice
Model Details of wikibert-base-parsinlu-multiple-choice
Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی)
This is a wikibert-based model for multiple-choice question answering.
Here is an example of how you can run this model:
from typing importListimport torch
from transformers import AutoConfig, AutoModelForMultipleChoice, AutoTokenizer
model_name = "persiannlp/wikibert-base-parsinlu-multiple-choice"
tokenizer = AutoTokenizer.from_pretrained(model_name)
config = AutoConfig.from_pretrained(model_name)
model = AutoModelForMultipleChoice.from_pretrained(model_name, config=config)
defrun_model(question: str, candicates: List[str]):
assertlen(candicates) == 4, "you need four candidates"
choices_inputs = []
for c in candicates:
text_a = ""# empty context
text_b = question + " " + c
inputs = tokenizer(
text_a,
text_b,
add_special_tokens=True,
max_length=128,
padding="max_length",
truncation=True,
return_overflowing_tokens=True,
)
choices_inputs.append(inputs)
input_ids = torch.LongTensor([x["input_ids"] for x in choices_inputs])
output = model(input_ids=input_ids)
print(output)
return output
run_model(question="وسیع ترین کشور جهان کدام است؟", candicates=["آمریکا", "کانادا", "روسیه", "چین"])
run_model(question="طامع یعنی ؟", candicates=["آزمند", "خوش شانس", "محتاج", "مطمئن"])
run_model(
question="زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده ",
candicates=["روز اول", "روز دوم", "روز سوم", "هیچکدام"])
wikibert-base-parsinlu-multiple-choice huggingface.co is an AI model on huggingface.co that provides wikibert-base-parsinlu-multiple-choice's model effect (), which can be used instantly with this persiannlp wikibert-base-parsinlu-multiple-choice model. huggingface.co supports a free trial of the wikibert-base-parsinlu-multiple-choice model, and also provides paid use of the wikibert-base-parsinlu-multiple-choice. Support call wikibert-base-parsinlu-multiple-choice model through api, including Node.js, Python, http.
wikibert-base-parsinlu-multiple-choice huggingface.co is an online trial and call api platform, which integrates wikibert-base-parsinlu-multiple-choice's modeling effects, including api services, and provides a free online trial of wikibert-base-parsinlu-multiple-choice, you can try wikibert-base-parsinlu-multiple-choice online for free by clicking the link below.
persiannlp wikibert-base-parsinlu-multiple-choice online free url in huggingface.co:
wikibert-base-parsinlu-multiple-choice is an open source model from GitHub that offers a free installation service, and any user can find wikibert-base-parsinlu-multiple-choice on GitHub to install. At the same time, huggingface.co provides the effect of wikibert-base-parsinlu-multiple-choice install, users can directly use wikibert-base-parsinlu-multiple-choice installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
wikibert-base-parsinlu-multiple-choice install url in huggingface.co: