metadata
language:
- he
pipeline_tag: summarization
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, SummarizationPipeline
model_name = "imvladikon/het5_summarization"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
summarizer = SummarizationPipeline(model=model, tokenizer=tokenizer)
example
text = """
爪专驻转 诪诪砖讬讻讛 诇讘注讜专: 诇讗讞专 讗专讘注讛 讬诪讬诐 砖诇 注讬诪讜转讬诐 讗诇讬诪讬诐 讘讬谉 诪转驻专注讬诐 诇讻讜讞讜转 讛讘讬讟讞讜谉 讘讻诇 专讞讘讬 爪专驻转, 讛讬讜诐 (砖讘转) 讛转拽讬讬诪讛 讛诇讜讜讬转讜 砖诇 讛谞注专 讛讗诇讙'讬专讗讬, 谞讗讛诇 讘谉 讛-17, 砖谞讜专讛 诇诪讜讜转 注诇 讬讚讬 砖讜讟专 诇讗讞专 砖谞讞砖讚 讘讙谞讬讘转 专讻讘. 诇讘拽砖转 诪砖驻讞转讜, 讛讛诇讜讜讬讛 讛转拽讬讬诪讛 讻讗讬专讜注 诪爪讜诪爪诪诐 砖讘讜 讛砖转转驻讜 讘谞讬 诪砖驻讞讛 讜讞讘专讬诐 讘诇讘讚. 诇讗讞专 砖讗专讜谞讜 砖诇 谞讗讛诇 讛讜爪讗 诪讛诪住讙讚 讘注讬专 谞讗谞讟专, 讗诇驻讬诐 拽专讗讜 "诇注砖讬讬转 爪讚拽 注讘讜专讜".讘诪拽讘讬诇, 讛诪砖讟专讛 讛爪专驻转讬转 谞注专讻转 诇讛诪砖讱 讛诪讛讜诪讜转 讘注砖专讜转 诪讜拽讚讬诐 讘专讞讘讬 讛诪讚讬谞讛, 讻砖讘诪讛诇讱 讛诇讬诇讛 谞注爪专讜 1,300 讘谞讬 讗讚诐. 诪砖专讚 讛驻谞讬诐 讛爪专驻转讬 讛讜讚讬注 讻讬 讘诪讛诇讱 讛讗讬专讜注讬诐 讛讜爪转讜 1,350 讻诇讬 专讻讘, 讜-234 讛爪转讜转 砖诇 诪讘谞讬诐. 讻诪讜 讻谉, 注诇 驻讬 讛谞转讜谞讬诐 谞讙专诐 谞讝拽 诇-200 诪专讻讝讬 拽谞讬讜转, 200 住讜驻专诪专拽讟讬诐 讜-250 住谞讬驻讬 讘谞拽.
""".strip()
summarizer(text,
max_length=50,
num_beams=4,
no_repeat_ngram_size=2,
early_stopping=True)[0]["summary_text"]
#诇讗讞专 讗专讘注讛 讬诪讬诐 砖诇 注讬诪讜转讬诐 讗诇讬诪讬诐 讘讬谉 诪转驻专注讬诐 诇讻讜讞讜转 讛讘讬讟讞讜谉 讘讻诇 专讞讘讬 爪专驻转, 讛诇讜讜讬转讜 砖诇 谞讗讛诇 讘谉 讛-17 讛转拽讬讬诪讛 讻讗讬专讜注 诪爪讜诪爪诐