我想要一天分享一點「LLM從底層堆疊的技術」,並且每篇文章長度控制在三分鐘以內,讓大家不會壓力太大,但是又能夠每天成長一點。
text = """ No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offense to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use without just compensation. """
print("Number of characters:", len(text))
summary = summarize(text, 50)
wrapped_summary = textwrap.fill(summary, width = 70)
print ("\nSummarized text: \n", wrapped_summary)
結果為:

這個範例很重要,因為它展示了無論是 Transformer 模型還是其他自然語言處理模型,當面對像這樣的文本時所面臨的局限性,我們不能只展示總是成功的範例,讓使用者相信 Transformer 已經解決了我們面臨的所有自然語言處理挑戰,無論這些模型多麼創新,我們仍然需要處理結果,並尋找解決方案,例如檢測不完整的句子、增加最大長度,及其他經典的數據處理方法。
也許我們應該提供更長的文本來總結,使用其他參數,選用更大的模型,或者改變 T5 模型的結構,然而,不管多麼努力地使用自然語言處理模型去總結複雜的文本,總會有一些文檔是模型無法總結的。