Haruhi Dialogue Speaker Extract Qwen18
基於qwen-1.8模型微調的對話抽取模型,能從小說片段中批量提取摘要和對話
下載量 17
發布時間 : 1/26/2024
模型概述
該模型專門用於從小說文本中抽取對話內容和摘要信息,支持中英文文本處理,輸出結構化JSON格式結果
模型特點
多語言支持
同時支持中文和英文小說的內容抽取
結構化輸出
自動生成包含摘要和對話的JSON格式結果
批量處理能力
可處理連續文本塊和多章節內容
模型能力
文本摘要生成
對話內容識別
說話人判斷
結構化數據輸出
使用案例
文學分析
小說對話分析
從小說文本中提取對話內容用於角色分析
示例顯示能準確識別對話內容和說話人
內容摘要生成
自動生成小說片段的要點摘要
示例顯示能生成連貫的段落摘要
數據預處理
對話數據集構建
為對話系統準備訓練數據
可批量處理大量小說文本
🚀 Chat涼宮春日的對話抽取模型
本模型旨在從小說的chunk中批量提取摘要和對話,為小說內容的分析和處理提供便利。它使用了約30k的中文小說數據和20k的英文小說數據進行訓練,並在qwen - 1.8上進行了3個epoch的finetune,原則上支持中文和英文小說的抽取。
🚀 快速開始
推理代碼
你可以通過以下代碼進行推理:
from transformers import AutoTokenizer, AutoModel, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("silk-road/Haruhi-Dialogue-Speaker-Extract_qwen18", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("silk-road/Haruhi-Dialogue-Speaker-Extract_qwen18", device_map="auto", trust_remote_code=True)
sys_prompt = "給定input paragraph,抽取其中的對話,並輸出為json格式 Let's think it step by step 1. summarize input paragraph into bullet format,存儲在summary字段 2. 抽取每一句對話的內容 dialogue,判斷每一句話的說話人 said by, 存儲在conversations中"
text = "Your novel text"
response_str, history = model.chat(tokenizer, text, history=[], system=sys_prompt)
推理代碼鏈接:Dialogue_Speaker_Extract_Test.ipynb
✨ 主要特性
- 多語言支持:模型使用中文和英文小說數據進行訓練,支持對中文和英文小說的對話和摘要抽取。
- 批量抽取:能夠從小說的chunk中批量提取摘要和對話。
📦 模型信息
屬性 | 詳情 |
---|---|
模型類型 | Chat涼宮春日的對話抽取模型 |
訓練數據 | 約30k的中文小說數據和20k的英文小說數據 |
微調基礎模型 | qwen - 1.8 |
微調輪數 | 3個epoch |
📚 詳細文檔
官方提示
中文
給定input paragraph,抽取其中的對話,並輸出為json格式 Let's think it step by step 1. summarize input paragraph into bullet format,存儲在summary字段 2. 抽取每一句對話的內容 dialogue,判斷每一句話的說話人 said by, 存儲在conversations中
英文
Given an input paragraph, extract the dialogues within it, and output them in JSON format.
Let's think about it step by step:
- Summarize the input paragraph into bullet points and store it in the 'summary' field.
- Extract the content of each dialogue ('dialogue'), identify the speaker for each sentence ('said by'), and store these in 'conversations'.
輸出示例
中文輸出示例
{'summary': '- 彭蠡不在家中,老刀感到擔憂並等待著彭蠡回家的時間,同時觀察周圍環境和人們的消費行為,表現出內心的飢餓感和焦慮情緒。', 'conversations': [{'dialogue': '哎,你們知道那兒一盤迴鍋肉多少錢嗎?', 'said_by': '小李'}, {'dialogue': '靠,菜裡有沙子。', 'said_by': '小丁'}, {'dialogue': '人家那兒一盤迴鍋肉,就三百四。', 'said_by': '小李'}, {'dialogue': '什麼玩意?這麼貴。', 'said_by': '小丁'}, {'dialogue': '你吃不了這麼多。', 'said_by': '小李'}]}
{'summary': '- 彭蠡在家等待彭蠡回家,表現出內心的飢餓感和焦慮情緒,同時對彭蠡的行為表示不滿和失望。彭蠡則對老刀的行為表現出冷漠和不屑的態度。', 'conversations': [{'dialogue': '我沒時間和你解釋。我需要去第一空間,你告訴我怎麼走。', 'said_by': '老刀'}, {'dialogue': '回我家說,要走也從那兒走。', 'said_by': '彭蠡'}, {'dialogue': '回家啦,回家啦。轉換馬上開始了。', 'said_by': '車上的人'}, {'dialogue': '你不告訴我為什麼,我就不告訴你怎麼走。', 'said_by': '彭蠡'}, {'dialogue': '你躲在垃圾道里?去第二空間?那你得等24小時啊。', 'said_by': '彭蠡'}, {'dialogue': '二十萬塊。等一禮拜也值啊。', 'said_by': '老刀'}, {'dialogue': '你就這麼缺錢花?', 'said_by': '彭蠡'}, {'dialogue': '糖糖還有一年多該去幼兒園了。我來不及了。', 'said_by': '老刀'}, {'dialogue': '你別說了。', 'said_by': '彭蠡'}]}
{'summary': '- 彭蠡對彭蠡的行為表現出不滿和失望,同時對老刀的行為表現出冷漠和不屑的態度。', 'conversations': [{'dialogue': '你真是作死,她又不是你閨女,犯得著嗎。', 'said_by': '彭蠡'}, {'dialogue': '別說這些了。快告我怎麼走。', 'said_by': '老刀'}, {'dialogue': '你可得知道,萬一被抓著,可不只是罰款,得關上好幾個月。', 'said_by': '彭蠡'}, {'dialogue': '你不是去過好多次嗎?', 'said_by': '老刀'}, {'dialogue': '只有四次。第五次就被抓了。', 'said_by': '彭蠡'}, {'dialogue': '那也夠了。我要是能去四次,抓一次也無所謂。', 'said_by': '老刀'}, {'dialogue': '別說了。你要是真想讓我帶你去,我就帶你去。', 'said_by': '彭蠡'}]}
- 彭蠡不在家中,老刀感到擔憂並等待著彭蠡回家的時間,同時觀察周圍環境和人們的消費行為,表現出內心的飢餓感和焦慮情緒。
小李 : 哎,你們知道那兒一盤迴鍋肉多少錢嗎?
小丁 : 靠,菜裡有沙子。
小李 : 人家那兒一盤迴鍋肉,就三百四。
小丁 : 什麼玩意?這麼貴。
小李 : 你吃不了這麼多。
- 彭蠡在家等待彭蠡回家,表現出內心的飢餓感和焦慮情緒,同時對彭蠡的行為表示不滿和失望。彭蠡則對老刀的行為表現出冷漠和不屑的態度。
老刀 : 我沒時間和你解釋。我需要去第一空間,你告訴我怎麼走。
彭蠡 : 回我家說,要走也從那兒走。
車上的人 : 回家啦,回家啦。轉換馬上開始了。
彭蠡 : 你不告訴我為什麼,我就不告訴你怎麼走。
彭蠡 : 你躲在垃圾道里?去第二空間?那你得等24小時啊。
老刀 : 二十萬塊。等一禮拜也值啊。
彭蠡 : 你就這麼缺錢花?
老刀 : 糖糖還有一年多該去幼兒園了。我來不及了。
彭蠡 : 你別說了。
- 彭蠡對彭蠡的行為表現出不滿和失望,同時對老刀的行為表現出冷漠和不屑的態度。
彭蠡 : 你真是作死,她又不是你閨女,犯得著嗎。
老刀 : 別說這些了。快告我怎麼走。
彭蠡 : 你可得知道,萬一被抓著,可不只是罰款,得關上好幾個月。
老刀 : 你不是去過好多次嗎?
彭蠡 : 只有四次。第五次就被抓了。
老刀 : 那也夠了。我要是能去四次,抓一次也無所謂。
彭蠡 : 別說了。你要是真想讓我帶你去,我就帶你去。
英文輸出示例
{'summary': "Snow-covered Paris, Kimura's workshop, artist and viewer engaging in conversation.", 'conversations': [{'dialogue': 'You should hear the stories they tell of you at the café. If Émile is to be believed, you arrived here as an ukiyo-e courtesan, nothing more than paper wrapped around a porcelain bowl. A painter—he will not say which of us it was, of course—bought the bowl and the print along with it.', 'said_by': 'Artist'}, {'dialogue': 'And the painter pulled me from the print with the sheer force of his imagination, I’m sure. Émile is a novelist and can hardly be trusted to give an accurate account. The reality of my conception is vastly more mundane, I assure you…though it does involve a courtesan.', 'said_by': 'Woman'}, {'dialogue': 'A grain of truth makes for the best fiction. nude, but leave the jewelry and the shoes. I’ll paint you on the chaise. We’ll have three hours in the proper light, and I will pay you four francs.', 'said_by': 'Artist'}, {'dialogue': 'Victorine gets five!', 'said_by': 'Woman'}, {'dialogue': 'Victorine is a redhead.', 'said_by': 'Artist'}, {'dialogue': 'My name is Mariko, by the way, but everyone calls me Mari.', 'said_by': 'Mariko'}]}
{'summary': "Snow-covered Paris, Kimura's workshop, artist and viewer engaged in conversation. Artist and viewer engage in intimate conversation and interaction.", 'conversations': [{'dialogue': 'I’m on the chaise', 'said_by': 'Artist'}, {'dialogue': 'Bring your left hip forward. No, not that far. Bend the leg a bit more, yes. Turn your head to face the canvas.', 'said_by': 'Artist'}, {'dialogue': 'Like a Manet', 'said_by': 'Artist'}, {'dialogue': 'Don’t like a model that talks while you work, huh?', 'said_by': 'Artist'}, {'dialogue': 'I don’t like being compared to other artists.', 'said_by': 'Artist'}, {'dialogue': 'Then you must paint me so well that I forget about the others.', 'said_by': 'Artist'}, {'dialogue': 'Tilt your head into the light. And look at me intently. Intently. As though I were the one naked on the chaise.', 'said_by': 'Artist'}, {'dialogue': 'You did better than I would have expected.', 'said_by': 'Artist'}, {'dialogue': 'There are other poses I could show you, if you like?', 'said_by': 'Artist'}, {'dialogue': 'But the sooner I get started on this portrait, the better.', 'said_by': 'Artist'}]}
{'summary': "Kimura's workshop, artist and viewer engaging in intimate conversation and interaction. Kimura responds with a strong, cold embrace, leading to a passionate physical exchange. Afterward, the artist falls asleep, leaving the narrator feeling incomplete and longing.", 'num': 14, 'conversations': [{'dialogue': 'I could show you other poses.', 'said_by': 'Kimura'}, {'dialogue': 'Yes.', 'said_by': 'Kimura'}, {'dialogue': 'See you tomorrow?', 'said_by': 'Artist'}]}
Snow-covered Paris, Kimura's workshop, artist and viewer engaging in conversation.
Artist : You should hear the stories they tell of you at the café. If Émile is to be believed, you arrived here as an ukiyo-e courtesan, nothing more than paper wrapped around a porcelain bowl. A painter—he will not say which of us it was, of course—bought the bowl and the print along with it.
Woman : And the painter pulled me from the print with the sheer force of his imagination, I’m sure. Émile is a novelist and can hardly be trusted to give an accurate account. The reality of my conception is vastly more mundane, I assure you…though it does involve a courtesan.
Artist : A grain of truth makes for the best fiction. nude, but leave the jewelry and the shoes. I’ll paint you on the chaise. We’ll have three hours in the proper light, and I will pay you four francs.
Woman : Victorine gets five!
Artist : Victorine is a redhead.
Mariko : My name is Mariko, by the way, but everyone calls me Mari.
Snow-covered Paris, Kimura's workshop, artist and viewer engaged in conversation. Artist and viewer engage in intimate conversation and interaction.
Artist : I’m on the chaise
Artist : Bring your left hip forward. No, not that far. Bend the leg a bit more, yes. Turn your head to face the canvas.
Artist : Like a Manet
Artist : Don’t like a model that talks while you work, huh?
Artist : I don’t like being compared to other artists.
Artist : Then you must paint me so well that I forget about the others.
Artist : Tilt your head into the light. And look at me intently. Intently. As though I were the one naked on the chaise.
Artist : You did better than I would have expected.
Artist : There are other poses I could show you, if you like?
Artist : But the sooner I get started on this portrait, the better.
Kimura's workshop, artist and viewer engaging in intimate conversation and interaction. Kimura responds with a strong, cold embrace, leading to a passionate physical exchange. Afterward, the artist falls asleep, leaving the narrator feeling incomplete and longing.
Kimura : I could show you other poses.
Kimura : Yes.
Artist : See you tomorrow?
🔜 待辦事項
中文
- [x] 拓展到多chunks的inference
- [x] 提供英語的例子
- [ ] 提供一個多章節並行inference的例子
- [ ] 在json解析失敗的時候嘗試直接從raw字符串提取summary
- [ ] 在失敗的時候額外嘗試調用openai進行推理
英文
- [x] Expand to multi - chunk inference
- [x] Provide an English example
- [ ] Provide an example of multi - chapter parallel inference
- [ ] Try extracting summary directly from raw strings when JSON parsing fails
- [ ] Additionally attempt to use OpenAI for inference when failing
👥 貢獻者
📄 許可證
本項目採用Apache - 2.0許可證。
🔗 主項目鏈接
Bart Large Cnn
MIT
基於英語語料預訓練的BART模型,專門針對CNN每日郵報數據集進行微調,適用於文本摘要任務
文本生成 英語
B
facebook
3.8M
1,364
Parrot Paraphraser On T5
Parrot是一個基於T5的釋義框架,專為加速訓練自然語言理解(NLU)模型而設計,通過生成高質量釋義實現數據增強。
文本生成
Transformers

P
prithivida
910.07k
152
Distilbart Cnn 12 6
Apache-2.0
DistilBART是BART模型的蒸餾版本,專門針對文本摘要任務進行了優化,在保持較高性能的同時顯著提升了推理速度。
文本生成 英語
D
sshleifer
783.96k
278
T5 Base Summarization Claim Extractor
基於T5架構的模型,專門用於從摘要文本中提取原子聲明,是摘要事實性評估流程的關鍵組件。
文本生成
Transformers 英語

T
Babelscape
666.36k
9
Unieval Sum
UniEval是一個統一的多維評估器,用於自然語言生成任務的自動評估,支持多個可解釋維度的評估。
文本生成
Transformers

U
MingZhong
318.08k
3
Pegasus Paraphrase
Apache-2.0
基於PEGASUS架構微調的文本複述模型,能夠生成語義相同但表達不同的句子。
文本生成
Transformers 英語

P
tuner007
209.03k
185
T5 Base Korean Summarization
這是一個基於T5架構的韓語文本摘要模型,專為韓語文本摘要任務設計,通過微調paust/pko-t5-base模型在多個韓語數據集上訓練而成。
文本生成
Transformers 韓語

T
eenzeenee
148.32k
25
Pegasus Xsum
PEGASUS是一種基於Transformer的預訓練模型,專門用於抽象文本摘要任務。
文本生成 英語
P
google
144.72k
198
Bart Large Cnn Samsum
MIT
基於BART-large架構的對話摘要模型,專為SAMSum語料庫微調,適用於生成對話摘要。
文本生成
Transformers 英語

B
philschmid
141.28k
258
Kobart Summarization
MIT
基於KoBART架構的韓語文本摘要模型,能夠生成韓語新聞文章的簡潔摘要。
文本生成
Transformers 韓語

K
gogamza
119.18k
12
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98