- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在从事一个项目,但我有一些限制,无法使用提取方法来总结文章,而必须使用 BERT 来完成此任务。如果这是一个标签问题(总结推文、评论、问题),我有训练数据的相应标签,我会使用 BERT 中的向量作为 Keras 嵌入层的输入使用 LSTM 并构建一个带有输入和输出标签的模型。但问题是我必须总结文本而不是那些标记的推文和评论。当我拥有与词汇表相对应的向量时,有什么方法(我确信有,因为我被问得如此具体)可以使用 BERT?
最佳答案
您有很多想要自动总结的文档,但您没有任何训练数据。我假设你的文件是英文的。幸运的是,BERT 是一个预训练的模型,甚至还有专门用于摘要的库并且非常易于使用。您是否尝试过其中一项是否满足您的目标?例如bert-extractive-summarizer :
from summarizer import Summarizer
body = ''' Indian Bank is an Indian state-owned financial services company established in 1907 and headquartered in Chennai, India.
It has 20,924 employees, 2900 branches with 2861 ATMs and 1014 cash deposit machines and is one of the top performing public sector banks in India.
Total business of the bank has touched ₹430,000 crore (US$60 billion) as on 31 March 2019. Bank's Information Systems & Security processes certified with ISO27001:2013 standard and is among very few Banks certified worldwide.
It has overseas branches in Colombo and Singapore including a Foreign Currency Banking Unit at Colombo and Jaffna. It has 227 Overseas Correspondent banks in 75 countries.
Since 1969, the Government of India has owned the bank. As per the announcement made by the Indian Finance Minister Nirmala Sitharaman on 30 August 2019, Indian Bank will be anchor bank for the Kolkata-based Allahabad Bank, and this merger is expected to come on force from 1 April 2020, making it the seventh largest bank in the country. '''
model = Summarizer()
result = model(body, min_length=60)
full = ''.join(result)
print(full)
输出:
Indian Bank is an Indian state-owned financial services company established in 1907 and headquartered in Chennai, India. Total business of the bank has touched ₹430,000 crore (US$60 billion) as on 31 March 2019.
关于python - 使用 BERT 进行文章摘要,其中文章不存在标签或预期输出摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59828517/
我正在尝试从 BERT 模型中的隐藏状态中获取句子向量。看着拥抱脸 BertModel 说明 here ,其中说: from transformers import BertTokenizer, Be
我正在将 Huggingface BERT 用于 NLP 任务。我的文本包含被分成子词的公司名称。 tokenizer = BertTokenizerFast.from_pretrained('ber
对于 Transformer 模型,尤其是 BERT,以编程方式禁止模型以特殊标记作为预测结果是否有意义(并且在统计上是否正确)?在最初的实现中情况如何?在收敛过程中,模型必须学会不预测这些,但这种干
我有一个包含段落的数据集,我需要将其分为两类。这些段落通常有 3-5 句话长。其中绝大多数的长度不到 500 字。我想利用BERT来解决这个问题。 我想知道我应该如何使用 BERT 来生成这些段落的向
我想在特定域上微调 BERT。我在文本文件中有该域的文本。我如何使用这些来微调 BERT? 我在找 here目前。 我的主要目标是使用 BERT 获得句子嵌入。 最佳答案 这里要做出的重要区别是您是否
我想针对未标记数据的特定域微调 BERT,并让输出层检查它们之间的相似性。我该怎么做?我是否需要先微调分类器任务(或问题答案等)并获得嵌入?或者我可以只使用预先训练好的 Bert 模型而无需执行任务并
我遇到了这个page 1)我想在微调完成后获得句子级嵌入(由[CLS] token 给出的嵌入)。我怎么能做到? 2)我还注意到该页面上的代码需要花费大量时间才能返回测试数据的结果。这是为什么?当我训
我读过解释滑动窗口如何工作的帖子,但我找不到任何关于它是如何实际实现的信息。 据我了解,如果输入太长,可以使用滑动窗口来处理文本。 如果我错了,请纠正我。 假设我有一个文本 “2017 年 6 月 K
我正在尝试使用 BERT 微调模型(使用 transformers 库),但我对优化器和调度器有点不确定。 首先,我明白我应该使用 transformers.AdamW而不是 Pytorch 的版本。
我在 Tensorflow 中使用 BERT,有一个细节我不太明白。根据文档( https://tfhub.dev/google/bert_uncased_L-12_H-768_A-12/1 ),合并
我正在阅读 BERT paper并且不清楚 transformer 的输入编码器和解码器。 对于学习掩码语言模型(Cloze 任务),论文称 15% 的标记是被掩码的,并且训练网络来预测被掩码的标记。
我想使用 Bert 训练一个21 类 文本分类模型。但是我的训练数据很少,所以下载了一个类似的数据集,其中包含 5 类 和 200 万个样本。t并使用 bert 提供的 uncased 预训练模型对下
我正在训练一个在 BERT 之上使用自定义层的分类模型。在此期间,该模型的训练性能随着纪元的增加而下降(在第一个纪元之后)..我不确定这里要修复什么 - 是模型还是数据? (对于数据来说,它是二进制标
我是初学者..我正在和伯特一起工作。但出于公司网络的安全考虑,以下代码并没有直接接收bert模型。 tokenizer = BertTokenizer.from_pretrained('bert-ba
如何卡住上述预训练模型中的最后两层(dropout 和分类器层)?这样当模型运行时,我将得到一个致密层作为输出。 最佳答案 我想指出 BertForSequenceClassification 的定义
我正在使用 Huggingface 进一步训练 BERT 模型。我使用两种方法保存模型:步骤 (1) 使用此代码保存整个模型:model.save_pretrained(save_location),
我收到以下错误: AssertionError:文本输入必须为 str(单个示例)、List[str](批处理或单个预标记示例)或 List[List[str]](预标记示例批处理)类型。,当我运行
我想构建一个多类分类模型,我将对话数据作为 BERT 模型的输入(使用 bert-base-uncased)。 QUERY: I want to ask a question. ANSWER: Sur
我很感兴趣如何从 BERT 模型中获得不同句子中词嵌入的相似性(实际上,这意味着词在不同场景中具有不同的含义)。 例如: sent1 = 'I like living in New York.' se
众所周知,BERT 模型的词嵌入能力可能优于 word2vec 和任何其他模型。 我想在 BERT 词嵌入上创建一个模型来生成同义词或相似词。就像我们在 Gensim Word2Vec 中所做的一样。
我是一名优秀的程序员,十分优秀!