Finish PE-final

This commit is contained in:
nowadays0421
2023-07-24 16:39:16 +08:00
parent 98a723075d
commit b1990bf20c
5 changed files with 789 additions and 75 deletions

File diff suppressed because one or more lines are too long

View File

@ -102,7 +102,7 @@
"id": "76be2320",
"metadata": {},
"source": [
"如果你想要给出更简洁的答案,以便更容易进行后处理,可以在上述 Prompt 基础上添加另一个指令:*用一个单词回答:「正面」或「负面」*。这样就只会打印出 “正面” 这个单词,这使得输出更加统一,方便后续处理。"
"如果你想要给出更简洁的答案,以便更容易进行后处理,可以在上述 Prompt 基础上添加另一个指令:*用一个单词回答:「正面」或「负面」*。这样就只会打印出 “正面” 这个单词,这使得输出更加统一,方便后续处理。"
]
},
{
@ -136,7 +136,7 @@
"id": "81d2a973-1fa4-4a35-ae35-a2e746c0e91b",
"metadata": {},
"source": [
"### 2.2 识别情感类型"
"### 1.2 识别情感类型"
]
},
{
@ -456,7 +456,7 @@
"id": "95b636f1",
"metadata": {},
"source": [
"假设我们有一个新闻网站或类似的平台,这是我们感兴趣的主题:美国航空航天局、当地政府、工程、员工满意度、联邦政府等。我们想要分析一篇新闻文章,理解其包含了哪些主题。可以使用这样的prompt确定以下主题列表中的每个项目是否是以下文本中的主题。以 0 或 1 的形式给出答案列表。"
"假设我们有一个新闻网站或类似的平台,这是我们感兴趣的主题:美国航空航天局、当地政府、工程、员工满意度、联邦政府等。我们想要分析一篇新闻文章,理解其包含了哪些主题。可以使用这样的 Prompt确定以下主题列表中的每个项目是否是以下文本中的主题。以 0 或 1 的形式给出答案列表。"
]
},
{
@ -961,7 +961,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@ -975,7 +975,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.8.10"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,

View File

@ -9,7 +9,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "2fac57c2",
"metadata": {},
@ -22,7 +21,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "bf3733d4",
"metadata": {},
@ -35,7 +33,7 @@
"id": "06ba53ba",
"metadata": {},
"source": [
"文本翻译是大语言模型的典型应用场景之一。相比于传统统计机器翻译系统,大语言模型翻译更加流畅自然,还原度更高。通过在大规模高质量平行语料上进行fine-tuning训练,大语言模型可以深入学习不同语言间的词汇、语法、语义等层面的对应关系,模拟双语者的转换思维,进行意义传递的精准转换,而非简单的逐词替换。\n",
"文本翻译是大语言模型的典型应用场景之一。相比于传统统计机器翻译系统,大语言模型翻译更加流畅自然,还原度更高。通过在大规模高质量平行语料上进行 Fine-Tune,大语言模型可以深入学习不同语言间的词汇、语法、语义等层面的对应关系,模拟双语者的转换思维,进行意义传递的精准转换,而非简单的逐词替换。\n",
"\n",
"以英译汉为例,传统统计机器翻译多倾向直接替换英文词汇,语序保持英语结构,容易出现中文词汇使用不地道、语序不顺畅的现象。而大语言模型可以学习英汉两种语言的语法区别,进行动态的结构转换。同时,它还可以通过上下文理解原句意图,选择合适的中文词汇进行转换,而非生硬的字面翻译。\n",
"\n",
@ -43,7 +41,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "1b418e32",
"metadata": {},
@ -79,7 +76,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "e3e922b4",
"metadata": {},
@ -111,7 +107,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c1841354",
"metadata": {},
@ -146,7 +141,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "68723ba5",
"metadata": {},
@ -154,31 +148,6 @@
"### 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",
"execution_count": 14,
@ -204,7 +173,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b2dc4c56",
"metadata": {},
@ -213,7 +181,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "54b00aa4",
"metadata": {},
@ -297,7 +264,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "6ab558a2",
"metadata": {},
@ -306,7 +272,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b85ae847",
"metadata": {},
@ -350,7 +315,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "98df9009",
"metadata": {},
@ -359,7 +323,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "0bf9c074",
"metadata": {},
@ -429,6 +392,14 @@
"print(response)"
]
},
{
"cell_type": "markdown",
"id": "99c8114e",
"metadata": {},
"source": [
"将上述 HTML 代码展示出来如下:"
]
},
{
"cell_type": "code",
"execution_count": 11,
@ -476,7 +447,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "29b7167b",
"metadata": {},
@ -485,7 +455,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "22776140",
"metadata": {},
@ -552,7 +521,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "538181e0",
"metadata": {},
@ -602,7 +570,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "2e2d1f6a",
"metadata": {},
@ -657,7 +624,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "3ee5d487",
"metadata": {},
@ -1343,7 +1309,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@ -1357,7 +1323,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.8.10"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,

View File

@ -15,9 +15,7 @@
"\n",
"在本章中,我们将学习*基于 OpenAI API 实现一个客户邮件自动生成的示例*,用于*根据客户反馈优化客服邮件*。这里还会介绍“温度”temperature这一超参数它可以**控制文本生成的多样性**。\n",
"\n",
"需要注意,扩展功能只应用来辅助人类创作,而非大规模自动生成内容。开发者应审慎使用,避免产生负面影响。只有以负责任和有益的方式应用语言模型,才能发挥其最大价值。\n",
"\n",
"相信践行社会责任的开发者可以利用语言模型的扩展功能,开发出真正造福人类的创新应用。\n"
"需要注意,扩展功能只应用来辅助人类创作,而非大规模自动生成内容。开发者应审慎使用,避免产生负面影响。只有以负责任和有益的方式应用语言模型,才能发挥其最大价值。相信践行社会责任的开发者可以利用语言模型的扩展功能,开发出真正造福人类的创新应用。\n"
]
},
{
@ -192,6 +190,13 @@
"print(response)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"第二次运行输出结果会发生变化:"
]
},
{
"cell_type": "code",
"execution_count": 5,
@ -411,7 +416,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@ -425,7 +430,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.8.10"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,

View File

@ -15,14 +15,8 @@
"id": "f0bdc2c9",
"metadata": {},
"source": [
"大型语言模型带给我们的激动人心的一种可能性是我们可以通过它构建定制的聊天机器人Chatbot而且只需很少的工作量。在这一章节的探索中我们将带你了解如何利用会话形式与具有个性化特性或专门为特定任务或行为设计的聊天机器人进行深度对话。"
]
},
{
"cell_type": "markdown",
"id": "e6fae355",
"metadata": {},
"source": [
"大型语言模型带给我们的激动人心的一种可能性是我们可以通过它构建定制的聊天机器人Chatbot而且只需很少的工作量。在这一章节的探索中我们将带你了解如何利用会话形式与具有个性化特性或专门为特定任务或行为设计的聊天机器人进行深度对话。\n",
"\n",
"像 ChatGPT 这样的聊天模型实际上是组装成以一系列消息作为输入,并返回一个模型生成的消息作为输出的。这种聊天格式原本的设计目标是简便多轮对话,但我们通过之前的学习可以知道,它对于不会涉及任何对话的**单轮任务**也同样有用。"
]
},
@ -380,6 +374,14 @@
"!pip install panel"
]
},
{
"cell_type": "markdown",
"id": "b61e475a",
"metadata": {},
"source": [
"如果你还没有安装 panel 库(用于可视化界面),请运行上述指令以安装该第三方库。"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -850,7 +852,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.8.10"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,