machine-learning - 您使用 GPT-3 从多篇文章中提取摘要段落的方法是什么?

标签 machine-learning nlp summarization openai-api gpt-3

在以下场景中,使用 GPT-3 API 的最佳方法是什么?

  1. 您需要写一段关于特定主题
  2. 的简短段落
  3. 您的段落必须基于一组文章,3-6 篇文章,以未知结构编写

以下是我发现效果很好的方法:

  1. 主要约束是提示中的开放ai代币限制
  2. 由于限制,我会要求 OPT-3 使用提示请求中的特定主题来解析非结构化数据。
  3. 然后我将迭代每篇文章并将其全部保存到 1 个字符串变量中
  4. 然后,最后一次重复它,但使用新的字符串变量
  5. 如果文章太长,我会把它分成小块
  6. curse fine-tune,之前带有特定主题的模型会产生更好的结果
  7. temperature 应设置为 0,以确保 GPT-3 仅使用来自数据源的事实。

例子: 假设我想写一段关于主题 A、主题 B 和主题 C 的文章。我有 5 篇文章作为引用。 开放的 ai playground 看起来像这样:

Example Article 1
----
Subject A: example A for OPT-3
Subject B: n/a
Subject c: n/a
=========
Example Article 2
----
Subject A: n/a
Subject B: example B for GPT-3
Subject C: n/a
=========
Example Article 3
----
Subject A: n/a
Subject B: n/a
Subject c: example for GPT-3
=========
Article 1
-----
Subject A:
Subject B:
Subject C:
=========
... repeating with all articles, save to str
=========
str
-----
Subject A:
Subject B:
Subject C:

最佳答案

可以使用 Python 库 GPT Index (麻省理工学院许可)总结文档集合。来自documentation :

index = GPTTreeIndex(documents)
response = index.query("<summarization_query>", mode="summarize")

The “default” mode for a tree-based query is traversing from the top of the graph down to leaf nodes. For summarization purposes we will want to use mode="summarize".

 A summarization query could look like one of the following:

  • “What is a summary of this collection of text?”
  • “Give me a summary of person X’s experience with the company.”

关于machine-learning - 您使用 GPT-3 从多篇文章中提取摘要段落的方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74255038/

相关文章:

machine-learning - Keras/机器学习 : Any pros and cons of flattening input data vs having a higher dimensional input?

nlp - 如何将自定义俚语添加到 spaCy 的 norm_exceptions.py 模块中?

machine-learning - CNN SGD损失从较小值跃升至较大值

nlp - 向 Google Action/API.AI 发送 POST 请求或发送超过 5 秒的响应

python - 使用 RASA 的 API 的正确方法是什么(rasa.core.processor - 遇到异常)?

r - R中同时使用两列的聚合函数

python - 安装pyrouge在ubuntu中出错

machine-learning - 我如何自愿过度拟合我的文本分类模型

machine-learning - 训练 Faster R-CNN 时如何固定共享卷积层