Instructions to use ielabgroup/xor-tydi-docTquery-mt5-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ielabgroup/xor-tydi-docTquery-mt5-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ielabgroup/xor-tydi-docTquery-mt5-large")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("ielabgroup/xor-tydi-docTquery-mt5-large") model = AutoModelForSeq2SeqLM.from_pretrained("ielabgroup/xor-tydi-docTquery-mt5-large") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ielabgroup/xor-tydi-docTquery-mt5-large with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ielabgroup/xor-tydi-docTquery-mt5-large" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ielabgroup/xor-tydi-docTquery-mt5-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ielabgroup/xor-tydi-docTquery-mt5-large
- SGLang
How to use ielabgroup/xor-tydi-docTquery-mt5-large 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 "ielabgroup/xor-tydi-docTquery-mt5-large" \ --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": "ielabgroup/xor-tydi-docTquery-mt5-large", "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 "ielabgroup/xor-tydi-docTquery-mt5-large" \ --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": "ielabgroup/xor-tydi-docTquery-mt5-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ielabgroup/xor-tydi-docTquery-mt5-large with Docker Model Runner:
docker model run hf.co/ielabgroup/xor-tydi-docTquery-mt5-large
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 description
mT5-large query generation model that is trained with XOR QA data.
Used in paper Bridging the Gap Between Indexing and Retrieval for Differentiable Search Index with Query Generation
and Augmenting Passage Representations with Query Generation for Enhanced Cross-Lingual Dense Retrieval
How to use
from transformers import pipeline
lang2mT5 = dict(
ar='Arabic',
bn='Bengali',
fi='Finnish',
ja='Japanese',
ko='Korean',
ru='Russian',
te='Telugu'
)
PROMPT = 'Generate a {lang} question for this passage: {title} {passage}'
title = 'Transformer (machine learning model)'
passage = 'A transformer is a deep learning model that adopts the mechanism of self-attention, differentially ' \
'weighting the significance of each part of the input (which includes the recursive output) data.'
model_name_or_path = 'ielabgroup/xor-tydi-docTquery-mt5-large'
input_text = PROMPT.format_map({'lang': lang2mT5['ja'],
'title': title,
'passage': passage})
generator = pipeline(model=model_name_or_path,
task='text2text-generation',
device="cuda:0",
)
results = generator(input_text,
do_sample=True,
max_length=64,
num_return_sequences=10,
)
for i, result in enumerate(results):
print(f'{i + 1}. {result["generated_text"]}')
BibTeX entry and citation info
@article{zhuang2022bridging,
title={Bridging the gap between indexing and retrieval for differentiable search index with query generation},
author={Zhuang, Shengyao and Ren, Houxing and Shou, Linjun and Pei, Jian and Gong, Ming and Zuccon, Guido and Jiang, Daxin},
journal={arXiv preprint arXiv:2206.10128},
year={2022}
}
@inproceedings{zhuang2023augmenting,
title={Augmenting Passage Representations with Query Generation for Enhanced Cross-Lingual Dense Retrieval},
author={Zhuang, Shengyao and Shou, Linjun and Zuccon, Guido},
booktitle={Proceedings of the 46th international ACM SIGIR conference on research and development in information retrieval},
year={2023}
}
- Downloads last month
- 12