Edit model card

T5 model for multilingual text Summary in English, Russian and Chinese language

This model is designed to perform the task of controlled generation of summary text content in multitasking mode with a built-in translation function for languages: Russian, Chinese, English.

This is the T5 multitasking model. Which has a conditionally controlled ability to generate summary text content, and translate this. In total, she understands 12 commands, according to the set prefix:

  1. "summary: " - to generate simple concise content in the source language
  2. "summary brief: " - to generate a shortened summary content in the source language
  3. "summary big: " - to generate elongated summary content in the source language

The model can understand text in any language from the list: Russian, Chinese or English. It can also translate the result into any language from the list: Russian, Chinese or English.

For translation into the target language, the target language identifier is specified as a prefix "... to :". Where lang can take the values: ru, en, zh. The source language may not be specified, in addition, the source text may be multilingual.

task prefix:

  1. "summary to en: " - to generate summary content in English from multilingual text
  2. "summary brief to en: " - to generate a shortened summary of the content in English from multilingual text
  3. "summary big to en: " - to generate elongated summary content in English from multilingual text
  4. "summary to ru: " - to generate summary content in Russian from multilingual text
  5. "summary brief to ru: " - to generate a shortened summary of the content in Russian from multilingual text
  6. "summary big to ru: " - to generate elongated summary content in Russian from multilingual text
  7. "summary to zh: " - to generate summary content in Chinese from multilingual text
  8. "summary brief to zh: " - to generate a shortened summary of the content in Chinese from multilingual text
  9. "summary big to zh: " - to generate elongated summary content in Chinese from multilingual text

A training model for compressing a context of 2048 tokens and outputs a summary of up to 200 tokens in big task, 50 tokens in summary, and 20 tokens in brief task.

Example resume for English:

from transformers import T5ForConditionalGeneration, T5Tokenizer

model_name = 'utrobinmv/t5_summary_en_ru_zh_base_2048'
model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = T5Tokenizer.from_pretrained(model_name)

text = """Videos that say approved vaccines are dangerous and cause autism, cancer or infertility are among those that will be taken down, the company said.  The policy includes the termination of accounts of anti-vaccine influencers.  Tech giants have been criticised for not doing more to counter false health information on their sites.  In July, US President Joe Biden said social media platforms were largely responsible for people's scepticism in getting vaccinated by spreading misinformation, and appealed for them to address the issue.  YouTube, which is owned by Google, said 130,000 videos were removed from its platform since last year, when it implemented a ban on content spreading misinformation about Covid vaccines.  In a blog post, the company said it had seen false claims about Covid jabs "spill over into misinformation about vaccines in general". The new policy covers long-approved vaccines, such as those against measles or hepatitis B.  "We're expanding our medical misinformation policies on YouTube with new guidelines on currently administered vaccines that are approved and confirmed to be safe and effective by local health authorities and the WHO," the post said, referring to the World Health Organization."""

# text summary generate
prefix = 'summary: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#YouTube is cracking down on videos that suggest Covid-19 vaccines are dangerous and harmful.

# text brief summary generate
prefix = 'summary brief: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#YouTube is cracking down on misleading information about Covid vaccines.

# text big summary generate
prefix = 'summary big: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#YouTube has said it will remove more than 1,500 videos of Covid vaccines from its platform in a bid to tackle the spread of misinformation about the jabs.

Example resume for Chinese text on English language:

from transformers import T5ForConditionalGeneration, T5Tokenizer

model_name = 'utrobinmv/t5_summary_en_ru_zh_base_2048'
model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = T5Tokenizer.from_pretrained(model_name)

text = """在北京冬奥会自由式滑雪女子坡面障碍技巧决赛中,中国选手谷爱凌夺得银牌。祝贺谷爱凌!今天上午,自由式滑雪女子坡面障碍技巧决赛举行。决赛分三轮进行,取选手最佳成绩排名决出奖牌。第一跳,中国选手谷爱凌获得69.90分。在12位选手中排名第三。完成动作后,谷爱凌又扮了个鬼脸,甚是可爱。第二轮中,谷爱凌在道具区第三个障碍处失误,落地时摔倒。获得16.98分。网友:摔倒了也没关系,继续加油!在第二跳失误摔倒的情况下,谷爱凌顶住压力,第三跳稳稳发挥,流畅落地!获得86.23分!此轮比赛,共12位选手参赛,谷爱凌第10位出场。网友:看比赛时我比谷爱凌紧张,加油!"""

# text summary generate
prefix = 'summary to en: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#In Beijing Winter Olympics Games, Chinese contestant Grulove凌 won the silver card. Celebrate.

# text brief summary generate
prefix = 'summary brief to en: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#In Beijing Winter Olympics Games, Chinese contestant Gruelean won the silver card.

# text big summary generate
prefix = 'summary big to en: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#In Beijing's Winter Olympics Games, the 12-year-old has won the silver card in a free-skating lady hillwalking contest. The first jump, Chinese contestant, 69.90.

and Example resume for Russian:

from transformers import T5ForConditionalGeneration, T5Tokenizer

model_name = 'utrobinmv/t5_summary_en_ru_zh_base_2048'
model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = T5Tokenizer.from_pretrained(model_name)

text = """Высота башни составляет 324 метра (1063 фута), примерно такая же высота, как у 81-этажного здания, и самое высокое сооружение в Париже. Его основание квадратно, размером 125 метров (410 футов) с любой стороны. Во время строительства Эйфелева башня превзошла монумент Вашингтона, став самым высоким искусственным сооружением в мире, и этот титул она удерживала в течение 41 года до завершения строительство здания Крайслер в Нью-Йорке в 1930 году. Это первое сооружение которое достигло высоты 300 метров. Из-за добавления вещательной антенны на вершине башни в 1957 году она сейчас выше здания Крайслер на 5,2 метра (17 футов). За исключением передатчиков, Эйфелева башня является второй самой высокой отдельно стоящей структурой во Франции после виадука Мийо."""

# text summary generate
prefix = 'summary: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#Французская Эйфелева башня, ставшая самой высокой в мире, достигла высоты 300 метров (1063 фута).

# text brief summary generate
prefix = 'summary brief: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#Французская Эйфелева башня стала самой высокой в мире.

# text big summary generate
prefix = 'summary big: '
src_text = prefix + text
input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids)

result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)
#Французская Эйфелева башня, построенная в 1957 году, достигла высоты 300 метров (1063 фута) с любой стороны. Это самый высокий сооружения в мире после виадука Мийо.

Languages covered

Russian (ru_RU), Chinese (zh_CN), English (en_US)

Downloads last month
2,394
Safetensors
Model size
298M params
Tensor type
F32
·

Spaces using utrobinmv/t5_summary_en_ru_zh_base_2048 4