File diff suppressed because one or more lines are too long
@ -8,9 +8,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"在开发大语言模型应用时,很难通过第一次尝试就得到完美适用的 Prompt。但关键是要有一个**良好的迭代优化过程**,以不断改进 Prompt。相比训练机器学习模型,Prompt 的一次成功率可能更高,但仍需要通过多次迭代找到最适合应用的形式。\n",
|
"在开发大语言模型应用时,很难通过第一次尝试就得到完美适用的 Prompt。但关键是要有一个**良好的迭代优化过程**,以不断改进 Prompt。相比训练机器学习模型,Prompt 的一次成功率可能更高,但仍需要通过多次迭代找到最适合应用的形式。\n",
|
||||||
"\n",
|
"\n",
|
||||||
"本章以产品说明书生成营销文案为例,展示Prompt迭代优化的思路。这与吴恩达在机器学习课程中演示的机器学习模型开发流程相似:有了想法后,编写代码、获取数据、训练模型、查看结果。通过分析错误找出适用领域,调整方案后再次训练。Prompt开发也采用类似循环迭代的方式,逐步逼近最优。\n",
|
"本章以产品说明书生成营销文案为例,展示 Prompt 迭代优化的思路。这与吴恩达在机器学习课程中演示的机器学习模型开发流程相似:有了想法后,编写代码、获取数据、训练模型、查看结果。通过分析错误找出适用领域,调整方案后再次训练。Prompt 开发也采用类似循环迭代的方式,逐步逼近最优。具体来说,有了任务想法后,可以先编写初版 Prompt,注意清晰明确并给模型充足思考时间。运行后检查结果,如果不理想,则分析 Prompt 不够清楚或思考时间不够等原因,做出改进,再次运行。如此循环多次,终将找到适合应用的 Prompt。\n",
|
||||||
"\n",
|
|
||||||
"具体来说,有了任务想法后,可以先编写初版Prompt,注意清晰明确并给模型充足思考时间。运行后检查结果,如果不理想,则分析Prompt不够清楚或思考时间不够等原因,做出改进,再次运行。如此循环多次,终将找到适合应用的Prompt。\n",
|
|
||||||
" \n",
|
" \n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -173,6 +171,13 @@
|
|||||||
"print(response)\n"
|
"print(response)\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"我们可以计算一下输出的长度。"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 11,
|
||||||
@ -198,7 +203,6 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"\n",
|
|
||||||
"当在 Prompt 中设置长度限制要求时,语言模型生成的输出长度不总能精确符合要求,但基本能控制在可接受的误差范围内。比如要求生成50词的文本,语言模型有时会生成60词左右的输出,但总体接近预定长度。\n",
|
"当在 Prompt 中设置长度限制要求时,语言模型生成的输出长度不总能精确符合要求,但基本能控制在可接受的误差范围内。比如要求生成50词的文本,语言模型有时会生成60词左右的输出,但总体接近预定长度。\n",
|
||||||
"\n",
|
"\n",
|
||||||
"这是因为**语言模型在计算和判断文本长度时依赖于分词器**,而分词器在字符统计方面不具备完美精度。目前存在多种方法可以尝试控制语言模型生成输出的长度,比如指定语句数、词数、汉字数等。\n",
|
"这是因为**语言模型在计算和判断文本长度时依赖于分词器**,而分词器在字符统计方面不具备完美精度。目前存在多种方法可以尝试控制语言模型生成输出的长度,比如指定语句数、词数、汉字数等。\n",
|
||||||
@ -216,9 +220,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"比如在这个案例中,进一步分析会发现,该椅子面向的其实是家具零售商,而不是终端消费者。所以生成的文案中过多强调风格、氛围等方面,而较少涉及产品技术细节,与目标受众的关注点不太吻合。这时候我们就可以继续调整 Prompt,明确要求语言模型生成面向家具零售商的描述,更多关注材质、工艺、结构等技术方面的表述。\n",
|
"比如在这个案例中,进一步分析会发现,该椅子面向的其实是家具零售商,而不是终端消费者。所以生成的文案中过多强调风格、氛围等方面,而较少涉及产品技术细节,与目标受众的关注点不太吻合。这时候我们就可以继续调整 Prompt,明确要求语言模型生成面向家具零售商的描述,更多关注材质、工艺、结构等技术方面的表述。\n",
|
||||||
"\n",
|
"\n",
|
||||||
"通过迭代地分析结果,检查是否捕捉到正确的细节,我们可以逐步优化Prompt,使语言模型生成的文本更加符合预期的样式和内容要求。\n",
|
"通过迭代地分析结果,检查是否捕捉到正确的细节,我们可以逐步优化 Prompt,使语言模型生成的文本更加符合预期的样式和内容要求。细节的精准控制是语言生成任务中非常重要的一点。我们需要训练语言模型**根据不同目标受众关注不同的方面,输出风格和内容上都适合的文本**。"
|
||||||
"\n",
|
|
||||||
"细节的精准控制是语言生成任务中非常重要的一点。我们需要训练语言模型**根据不同目标受众关注不同的方面,输出风格和内容上都适合的文本**。"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -379,6 +381,13 @@
|
|||||||
"print(response)"
|
"print(response)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"上述输出为 HTML 代码,我们可以使用 Python 的 IPython 库将 HTML 代码加载出来。"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 20,
|
"execution_count": 20,
|
||||||
@ -447,9 +456,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"本章重点讲解了在开发大语言模型应用时,采用迭代方式不断优化 Prompt 的过程。作为 Prompt 工程师,关键不是一开始就要求完美的 Prompt,而是掌握有效的 Prompt 开发流程。\n",
|
"本章重点讲解了在开发大语言模型应用时,采用迭代方式不断优化 Prompt 的过程。作为 Prompt 工程师,关键不是一开始就要求完美的 Prompt,而是掌握有效的 Prompt 开发流程。\n",
|
||||||
"\n",
|
"\n",
|
||||||
"具体来说,首先编写初版Prompt,然后通过多轮调整逐步改进,直到生成了满意的结果。对于更复杂的应用,可以在多个样本上进行迭代训练,评估Prompt的平均表现。\n",
|
"具体来说,首先编写初版 Prompt,然后通过多轮调整逐步改进,直到生成了满意的结果。对于更复杂的应用,可以在多个样本上进行迭代训练,评估 Prompt 的平均表现。在应用较为成熟后,才需要采用在多个样本集上评估 Prompt 性能的方式来进行细致优化。因为这需要较高的计算资源。\n",
|
||||||
"\n",
|
|
||||||
"在应用较为成熟后,才需要采用在多个样本集上评估Prompt性能的方式来进行细致优化。因为这需要较高的计算资源。\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"总之,Prompt 工程师的核心是掌握 Prompt 的迭代开发和优化技巧,而非一开始就要求100%完美。通过不断调整试错,最终找到可靠适用的 Prompt 形式才是设计 Prompt 的正确方法。\n",
|
"总之,Prompt 工程师的核心是掌握 Prompt 的迭代开发和优化技巧,而非一开始就要求100%完美。通过不断调整试错,最终找到可靠适用的 Prompt 形式才是设计 Prompt 的正确方法。\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -899,7 +906,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.11"
|
"version": "3.8.10"
|
||||||
},
|
},
|
||||||
"latex_envs": {
|
"latex_envs": {
|
||||||
"LaTeX_envs_menu_present": true,
|
"LaTeX_envs_menu_present": true,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -102,7 +102,7 @@
|
|||||||
"id": "76be2320",
|
"id": "76be2320",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"如果你想要给出更简洁的答案,以便更容易进行后处理,可以在上述 Prompt 基础上添加另一个指令:*用一个单词回答:「正面」或「负面」*。这样就只会打印出 “正面” 这个单词,这使得输出更加统一,方便后续处理。"
|
"如果你想要给出更简洁的答案,以便更容易进行后期处理,可以在上述 Prompt 基础上添加另一个指令:*用一个单词回答:「正面」或「负面」*。这样就只会打印出 “正面” 这个单词,这使得输出更加统一,方便后续处理。"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -136,7 +136,7 @@
|
|||||||
"id": "81d2a973-1fa4-4a35-ae35-a2e746c0e91b",
|
"id": "81d2a973-1fa4-4a35-ae35-a2e746c0e91b",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### 2.2 识别情感类型"
|
"### 1.2 识别情感类型"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -456,7 +456,7 @@
|
|||||||
"id": "95b636f1",
|
"id": "95b636f1",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"假设我们有一个新闻网站或类似的平台,这是我们感兴趣的主题:美国航空航天局、当地政府、工程、员工满意度、联邦政府等。我们想要分析一篇新闻文章,理解其包含了哪些主题。可以使用这样的prompt:确定以下主题列表中的每个项目是否是以下文本中的主题。以 0 或 1 的形式给出答案列表。"
|
"假设我们有一个新闻网站或类似的平台,这是我们感兴趣的主题:美国航空航天局、当地政府、工程、员工满意度、联邦政府等。我们想要分析一篇新闻文章,理解其包含了哪些主题。可以使用这样的 Prompt:确定以下主题列表中的每个项目是否是以下文本中的主题。以 0 或 1 的形式给出答案列表。"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -961,7 +961,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -975,7 +975,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.11"
|
"version": "3.8.10"
|
||||||
},
|
},
|
||||||
"latex_envs": {
|
"latex_envs": {
|
||||||
"LaTeX_envs_menu_present": true,
|
"LaTeX_envs_menu_present": true,
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "2fac57c2",
|
"id": "2fac57c2",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -22,7 +21,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "bf3733d4",
|
"id": "bf3733d4",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -35,7 +33,7 @@
|
|||||||
"id": "06ba53ba",
|
"id": "06ba53ba",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"文本翻译是大语言模型的典型应用场景之一。相比于传统统计机器翻译系统,大语言模型翻译更加流畅自然,还原度更高。通过在大规模高质量平行语料上进行fine-tuning训练,大语言模型可以深入学习不同语言间的词汇、语法、语义等层面的对应关系,模拟双语者的转换思维,进行意义传递的精准转换,而非简单的逐词替换。\n",
|
"文本翻译是大语言模型的典型应用场景之一。相比于传统统计机器翻译系统,大语言模型翻译更加流畅自然,还原度更高。通过在大规模高质量平行语料上进行 Fine-Tune,大语言模型可以深入学习不同语言间的词汇、语法、语义等层面的对应关系,模拟双语者的转换思维,进行意义传递的精准转换,而非简单的逐词替换。\n",
|
||||||
"\n",
|
"\n",
|
||||||
"以英译汉为例,传统统计机器翻译多倾向直接替换英文词汇,语序保持英语结构,容易出现中文词汇使用不地道、语序不顺畅的现象。而大语言模型可以学习英汉两种语言的语法区别,进行动态的结构转换。同时,它还可以通过上下文理解原句意图,选择合适的中文词汇进行转换,而非生硬的字面翻译。\n",
|
"以英译汉为例,传统统计机器翻译多倾向直接替换英文词汇,语序保持英语结构,容易出现中文词汇使用不地道、语序不顺畅的现象。而大语言模型可以学习英汉两种语言的语法区别,进行动态的结构转换。同时,它还可以通过上下文理解原句意图,选择合适的中文词汇进行转换,而非生硬的字面翻译。\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -43,7 +41,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "1b418e32",
|
"id": "1b418e32",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -79,7 +76,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "e3e922b4",
|
"id": "e3e922b4",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -111,7 +107,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "c1841354",
|
"id": "c1841354",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -146,7 +141,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "68723ba5",
|
"id": "68723ba5",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -154,31 +148,6 @@
|
|||||||
"### 1.4 同时进行语气转换"
|
"### 1.4 同时进行语气转换"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 13,
|
|
||||||
"id": "a4770dcc",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"Formal: ¿Le gustaría ordenar una almohada?\n",
|
|
||||||
"Informal: ¿Te gustaría ordenar una almohada?\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
|
||||||
"prompt = f\"\"\"\n",
|
|
||||||
"Translate the following text to Spanish in both the \\\n",
|
|
||||||
"formal and informal forms: \n",
|
|
||||||
"'Would you like to order a pillow?'\n",
|
|
||||||
"\"\"\"\n",
|
|
||||||
"response = get_completion(prompt)\n",
|
|
||||||
"print(response)\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 14,
|
"execution_count": 14,
|
||||||
@ -204,7 +173,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "b2dc4c56",
|
"id": "b2dc4c56",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -213,7 +181,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "54b00aa4",
|
"id": "54b00aa4",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -297,7 +264,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "6ab558a2",
|
"id": "6ab558a2",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -306,7 +272,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "b85ae847",
|
"id": "b85ae847",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -350,7 +315,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "98df9009",
|
"id": "98df9009",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -359,7 +323,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "0bf9c074",
|
"id": "0bf9c074",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -429,6 +392,14 @@
|
|||||||
"print(response)"
|
"print(response)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "99c8114e",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"将上述 HTML 代码展示出来如下:"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 11,
|
||||||
@ -476,7 +447,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "29b7167b",
|
"id": "29b7167b",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -485,7 +455,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "22776140",
|
"id": "22776140",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -552,7 +521,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "538181e0",
|
"id": "538181e0",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -602,7 +570,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "2e2d1f6a",
|
"id": "2e2d1f6a",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -657,7 +624,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "3ee5d487",
|
"id": "3ee5d487",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -1343,7 +1309,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -1357,7 +1323,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.11"
|
"version": "3.8.10"
|
||||||
},
|
},
|
||||||
"latex_envs": {
|
"latex_envs": {
|
||||||
"LaTeX_envs_menu_present": true,
|
"LaTeX_envs_menu_present": true,
|
||||||
|
|||||||
@ -15,9 +15,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"在本章中,我们将学习*基于 OpenAI API 实现一个客户邮件自动生成的示例*,用于*根据客户反馈优化客服邮件*。这里还会介绍“温度”(temperature)这一超参数,它可以**控制文本生成的多样性**。\n",
|
"在本章中,我们将学习*基于 OpenAI API 实现一个客户邮件自动生成的示例*,用于*根据客户反馈优化客服邮件*。这里还会介绍“温度”(temperature)这一超参数,它可以**控制文本生成的多样性**。\n",
|
||||||
"\n",
|
"\n",
|
||||||
"需要注意,扩展功能只应用来辅助人类创作,而非大规模自动生成内容。开发者应审慎使用,避免产生负面影响。只有以负责任和有益的方式应用语言模型,才能发挥其最大价值。\n",
|
"需要注意,扩展功能只应用来辅助人类创作,而非大规模自动生成内容。开发者应审慎使用,避免产生负面影响。只有以负责任和有益的方式应用语言模型,才能发挥其最大价值。相信践行社会责任的开发者可以利用语言模型的扩展功能,开发出真正造福人类的创新应用。\n"
|
||||||
"\n",
|
|
||||||
"相信践行社会责任的开发者可以利用语言模型的扩展功能,开发出真正造福人类的创新应用。\n"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -192,6 +190,13 @@
|
|||||||
"print(response)"
|
"print(response)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"第二次运行输出结果会发生变化:"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 5,
|
||||||
@ -411,7 +416,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -425,7 +430,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.11"
|
"version": "3.8.10"
|
||||||
},
|
},
|
||||||
"latex_envs": {
|
"latex_envs": {
|
||||||
"LaTeX_envs_menu_present": true,
|
"LaTeX_envs_menu_present": true,
|
||||||
|
|||||||
@ -15,14 +15,8 @@
|
|||||||
"id": "f0bdc2c9",
|
"id": "f0bdc2c9",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"大型语言模型带给我们的激动人心的一种可能性是,我们可以通过它构建定制的聊天机器人(Chatbot),而且只需很少的工作量。在这一章节的探索中,我们将带你了解如何利用会话形式,与具有个性化特性(或专门为特定任务或行为设计)的聊天机器人进行深度对话。"
|
"大型语言模型带给我们的激动人心的一种可能性是,我们可以通过它构建定制的聊天机器人(Chatbot),而且只需很少的工作量。在这一章节的探索中,我们将带你了解如何利用会话形式,与具有个性化特性(或专门为特定任务或行为设计)的聊天机器人进行深度对话。\n",
|
||||||
]
|
"\n",
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"id": "e6fae355",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"像 ChatGPT 这样的聊天模型实际上是组装成以一系列消息作为输入,并返回一个模型生成的消息作为输出的。这种聊天格式原本的设计目标是简便多轮对话,但我们通过之前的学习可以知道,它对于不会涉及任何对话的**单轮任务**也同样有用。"
|
"像 ChatGPT 这样的聊天模型实际上是组装成以一系列消息作为输入,并返回一个模型生成的消息作为输出的。这种聊天格式原本的设计目标是简便多轮对话,但我们通过之前的学习可以知道,它对于不会涉及任何对话的**单轮任务**也同样有用。"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -380,6 +374,14 @@
|
|||||||
"!pip install panel"
|
"!pip install panel"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "b61e475a",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"如果你还没有安装 panel 库(用于可视化界面),请运行上述指令以安装该第三方库。"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@ -850,7 +852,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.11"
|
"version": "3.8.10"
|
||||||
},
|
},
|
||||||
"latex_envs": {
|
"latex_envs": {
|
||||||
"LaTeX_envs_menu_present": true,
|
"LaTeX_envs_menu_present": true,
|
||||||
|
|||||||
@ -221,7 +221,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "gpt_flask",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -235,10 +235,9 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.16"
|
"version": "3.10.11"
|
||||||
},
|
}
|
||||||
"orig_nbformat": 4
|
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 2
|
"nbformat_minor": 4
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user