PEGASUS BASE

This model was pretrained on Bulgarian language. It was intorduced in this paper.

Model description

The training data is private Bulgarian squad data.

Intended uses & limitations

You can use the raw model for generation of question-answer pairs related with given Bulgarian text.

How to use

Here is how to use this model in PyTorch:

>>> from transformers import PegasusForConditionalGeneration, AlbertTokenizer
>>>
>>> model_id = "rmihaylov/pegasus-base-qag-bg"
>>> model = PegasusForConditionalGeneration.from_pretrained(model_id)
>>> tokenizer = AlbertTokenizer.from_pretrained(model_id)
>>>
>>> text = """Това, че някой може да заяви на най-силен глас исканията си, не означава те да бъдат удовлетворени, заяви Костадин Ангелов. 
Той допълни, че приоритетите на властите са здравето, образование и спорта, давайки знак, че се търси разхлабване на мерките в болничните заведения, връщането на учениците в класните стаи и отварянето на обектите за масов спорт.
"""
>>>
>>> inputs = tokenizer.encode_plus(
>>>     text, 
>>>     return_tensors='pt', 
>>>     truncation=True, 
>>>     max_length=512, 
>>>     return_token_type_ids=False, 
>>>     return_attention_mask=True)
>>> 
>>> outputs = model.generate(**inputs,                          
>>>     max_length=150, 
>>>     top_p=0.95, 
>>>     top_k=20, 
>>>     do_sample=True, 
>>>     num_return_sequences=10, 
>>>     num_beams=1,
>>>     eos_token_id=50259,
>>>     decoder_start_token_id=50257,
>>>     return_dict_in_generate=True,
>>>     output_scores=True)
>>> 
>>> for g in outputs.sequences:
>>>   text_gen = tokenizer.decode(g, skip_special_tokens=False)
>>> 
>>>   if ('[SEP]' not in text_gen) or ('[MASK]' not in text_gen) or ('[CLS]' not in text_gen):
>>>     continue
>>> 
>>>   question, answer = text_gen.replace('[CLS]', '').strip().split('[SEP]')
>>>   answer = answer.split('[MASK]')[0].strip()
>>>   
>>>   if (not answer) or (answer not in text) or (len(answer) <= 1):   
>>>     continue
>>> 
>>> print(f'{question.strip()}\n{answer.strip()}', '\n\n')

Какво трябва да се предприеме, за да се случи?
разхлабване 


Какви са приоритетите на управляващите?
здравето, образование и спорта, 


Какви усилия има правителството за стимулиране на раждаемостта?
разхлабване на мерките 


Какъв е основният проблем, който може да реши?
образование 
Downloads last month
111
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model authors have turned it off explicitly.

Datasets used to train rmihaylov/pegasus-base-qag-bg