Instructions to use fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B") model = AutoModelForMultimodalLM.from_pretrained("fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B
- SGLang
How to use fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B with Docker Model Runner:
docker model run hf.co/fewshot-goes-multilingual/mTk-AdversarialQA_en-SberQuAD_ru-1B
YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Model Card for mTk-AdversarialQA_en-SberQuAD_ru-1B
This model is a generative in-context few-shot learner specialized in Russian. It was trained on a combination of English AdversarialQA and Russian SberQuAD datasets.
You can find detailed information on Project Github & the referenced paper.
Model Details
Model Description
- Developed by: Michal Stefanik & Marek Kadlcik, Masaryk University
- Model type: mt5
- Language(s) (NLP): en,ru
- License: MIT
- Finetuned from model: google/mt5-large
Model Sources
- Repository: https://github.com/fewshot-goes-multilingual/slavic-incontext-learning
- Paper: https://arxiv.org/abs/2304.01922
Uses
This model is intended to be used in a few-shot in-context learning format in the target language (Russian), or in the source language (English, see below). It was evaluated for unseen task learning (with k=3 demonstrations) in Russian: see the referenced paper for details.
How to Get Started with the Model
Use the code below to get started with the model.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("{this model path}")
tokenizer = AutoTokenizer.from_pretrained("{this model path}")
# Instead, use keywords "Вопрос", "Контекст" and "Отвечать" for Russian few-shot prompts
input_text = """
Question: What is the customer's name?
Context: Origin: Barrack Obama, Customer id: Bill Moe.
Answer: Bill Moe,
Question: What is the customer's name?
Context: Customer id: Barrack Obama, if not deliverable, return to Bill Clinton.
Answer:
"""
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs)
print("Answer:")
print(tokenizer.decode(outputs))
Training Details
Training this model can be reproduced by running pip install -r requirements.txt && python train_mt5_qa_en_AQA+ru_info.py .
See the referenced script for hyperparameters and other training configurations.
Citation
If you use our models or other resources in your research, please cite our work as follows.
BibTeX:
@inproceedings{stefanik2023resources,
author = {\v{S}tef\'{a}nik, Michal and Kadlčík, Marek and Gramacki, Piotr and Sojka, Petr},
title = {Resources and Few-shot Learners for In-context Learning in Slavic Languages},
booktitle = {Proceedings of the 9th Workshop on Slavic Natural Language Processing},
publisher = {ACL},
numpages = {9},
url = {https://arxiv.org/abs/2304.01922},
}
- Downloads last month
- 6