先放两个类似的运行textsum的教程
曾伊言:准备 textsum(文章自动摘要) 的中文数据集zhuanlan.zhihu Textsum 运行录我的环境配置如下,建议使用以下版本,否则容易报错。
textsum中使用的training样本是二进制的,可以使用他给出的data_convert_example.py来将二进制文件还原成txt文件。使用方法如下:
python data_convert_example.py --command binary_to_text --in_file data/data --out_file data/text_datapython data_convert_example.py --command text_to_binary --in_file data/text_data --out_file data/binary_data
还原后的内容如下(这只是其中一行,一行代表一个样本):
abstract=<d> <p> <s> sri lanka closes schools as war escalates . </s> </p> </d> article=<d> <p> <s> the sri lankan government on wednesday announced the closure of government schools with immediate effect as a military campaign against tamil separatists escalated in the north of the country . </s> <s> the cabinet wednesday decided to advance the december holidays by one month because of a threat from the liberation tigers of tamil eelam -lrb- ltte -rrb- against school children , a government official said . </s> <s> `` there are intelligence reports that the tigers may try to kill a lot of children to provoke a backlash against tamils in colombo . </s> <s> `` if that happens , troops will have to be withdrawn from the north to maintain law and order here , '' a police official said . </s> <s> he said education minister richard pathirana visited several government schools wednesday before the closure decision was taken . </s> <s> the government will make alternate arrangements to hold end of term examinations , officials said . </s> <s> earlier wednesday , president chandrika kumaratunga said the ltte may step up their attacks in the capital to seek revenge for the ongoing military offensive which she described as the biggest ever drive to take the tiger town of jaffna . . </s> </p> </d> publisher=AFP
只是这样看看不出来样本的格式,可以简单概况一下样本的格式如下:
abstract=<d> <p> <s> 这里是文章摘要 </s> </p> </d> tarticle=<d> <p> <s> 这里是正文, </s> <s> 句子用这个隔开→ </s> </p> </d> tpublisher=AFPn
注意t在文本中看不出来。
接下来就要将自己的数据集改写成这种形式,数据集不同,处理代码自然也不同,我的代码如下:
import
代码同时生成了所需的训练数据和字典,生成的样本如下:
abstract= <s> 徐州 农家 女孩 考上 清华 她 的 懂事 让 人 心酸 </s> article= <s> 徐州 18 岁 农家 女孩 宋爽 今年 考入 清华大学 除了 自己 一路 闯关 年 年 拿 奖 还 帮 妹妹 弟弟 制定 学习 计划 姐弟 仨 齐头并进 妹妹 也 考上 区里 最好 的 中学 这个 家里 的 收入 全靠 父亲 务农 和 打零工 但 宋爽 懂事 得 让 人 心疼 曾 需要 200 元 奥数 竞赛 的 教材费 她 羞于 开口 愣 是 急 哭 了 戳 腾讯 公益 帮帮 她们 助学 圆梦 江苏 新闻 的 秒 拍 视频 </s>
接下来就要将训练数据转换成二进制,还是用上面的脚本。然后用官方教程中的方法构建目录将二进制训练数据放到正确的位置进行训练就好了。
目前,模型还在跑,跑完了,再把test结果展示给大家吧。
留个坑。
训练遇到问题可以私信我呀。
本文发布于:2024-02-05 00:09:54,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170719537461056.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |