Views
No views yet
1from transformers import pipeline
2
3lang2mT5 = dict(
4 ar='Arabic',
5 bn='Bengali',
6 fi='Finnish',
7 ja='Japanese',
8 ko='Korean',
9 ru='Russian',
10 te='Telugu'
11)
12PROMPT = 'Generate a {lang} question for this passage: {title} {passage}'
13
14title = 'Transformer (machine learning model)'
15passage = 'A transformer is a deep learning model that adopts the mechanism of self-attention, differentially ' \
16 'weighting the significance of each part of the input (which includes the recursive output) data.'
17
18
19model_name_or_path = 'ielabgroup/xor-tydi-docTquery-mt5-large'
20input_text = PROMPT.format_map({'lang': lang2mT5['ja'],
21 'title': title,
22 'passage': passage})
23
24generator = pipeline(model=model_name_or_path,
25 task='text2text-generation',
26 device="cuda:0",
27 )
28
29results = generator(input_text,
30 do_sample=True,
31 max_length=64,
32 num_return_sequences=10,
33 )
34
35for i, result in enumerate(results):
36 print(f'{i + 1}. {result["generated_text"]}')1@article{zhuang2022bridging,
2 title={Bridging the gap between indexing and retrieval for differentiable search index with query generation},
3 author={Zhuang, Shengyao and Ren, Houxing and Shou, Linjun and Pei, Jian and Gong, Ming and Zuccon, Guido and Jiang, Daxin},
4 journal={arXiv preprint arXiv:2206.10128},
5 year={2022}
6}
7
8@inproceedings{zhuang2023augmenting,
9 title={Augmenting Passage Representations with Query Generation for Enhanced Cross-Lingual Dense Retrieval},
10 author={Zhuang, Shengyao and Shou, Linjun and Zuccon, Guido},
11 booktitle={Proceedings of the 46th international ACM SIGIR conference on research and development in information retrieval},
12 year={2023}
13}