Views
No views yet
1from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
2model = AutoModelForSeq2SeqLM.from_pretrained("{this model path}")
3tokenizer = AutoTokenizer.from_pretrained("{this model path}")
4# Instead, use keywords "Вопрос", "Контекст" and "Отвечать" for Russian few-shot prompts
5input_text = """
6 Question: What is the customer's name?
7 Context: Origin: Barrack Obama, Customer id: Bill Moe.
8 Answer: Bill Moe,
9 Question: What is the customer's name?
10 Context: Customer id: Barrack Obama, if not deliverable, return to Bill Clinton.
11 Answer:
12"""
13inputs = tokenizer(input_text, return_tensors="pt")
14
15outputs = model.generate(**inputs)
16print("Answer:")
17print(tokenizer.decode(outputs))pip install -r requirements.txt && python train_mt5_qa_en_AQA+ru_info.py .
See the referenced script for hyperparameters and other training configurations.1@inproceedings{stefanik2023resources,
2 author = {\v{S}tef\'{a}nik, Michal and Kadlčík, Marek and Gramacki, Piotr and Sojka, Petr},
3 title = {Resources and Few-shot Learners for In-context Learning in Slavic Languages},
4 booktitle = {Proceedings of the 9th Workshop on Slavic Natural Language Processing},
5 publisher = {ACL},
6 numpages = {9},
7 url = {https://arxiv.org/abs/2304.01922},
8}