InternLM 书生大模型实战营

1. 入门岛

1.1 第一关 Linux 基础知识

闯关任务 完成SSH连接与端口映射并运行hello_world.py

hello_world运行截图:

运行hello_world.py

访问截图:

访问hello_world.py

可选任务2 使用 VSCODE 远程连接开发机并创建一个conda环境

创建一个名为py310的conda环境,安装python3.10

conda创建

1.2 第二关 Python 基础知识

闯关任务 Python实现wordcount

wordcount.py代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import re
from collections import defaultdict

text = """Hello world!
This is an example.
Word count is fun.
Is it fun to count words?
Yes, it is fun!"""

def wordcount(text):
# 去除标点符号,只保留字母和空格
text = re.sub(r"[^\w\s]", "", text)

# 将所有字母转换为小写
text = text.lower()

# 以空格分割字符串,生成单词列表
words = text.split()

# 创建字典统计每个单词出现的次数
word_count = defaultdict(int)

for word in words:
word_count[word] += 1

return dict(word_count)

print(wordcount(text))

运行结果如下:

wordcount运行结果

闯关任务 Vscode连接InternStudio debug笔记

debug记录截图如下:

debug

2. 基础岛

2.1 第1关 书生大模型全链路开源开放体系

通过下图可以看到这最近一两年国产大模型的迅速成长的发展历史,目前已经逐渐追赶上了国际先进水平,未来可期!

InterLM成长路径

这里给出的全链路打通的体系视角对于了解大模型相关的技术和产品有很大的帮助。一个完整的大模型体系需要包括的板块有:

  • 数据
  • 预训练
  • 微调
  • 部署
  • 评测
  • 应用

书生大模型全链路开源开放体系

这里的LLM的思维链与最新的OpenAIo1模型具有很大的相似性,可见这确实是一种有效的优化LLM模型能力的方法。

思维链

思维链2

2.2 第2关 8G 显存玩转书生大模型 Demo

使用 Cli Demo 完成 InternLM2-Chat-1.8B 模型的部署,并生成 300 字小故事

 InternLM2-Chat-1.8B 模型 部署

使用 LMDeploy 完成 InternLM-XComposer2-VL-1.8B 的部署

InternLM-XComposer2-VL-1.8B 图文理解

使用 LMDeploy 完成 InternVL2-2B 的部署

使用 LMDeploy 完成 InternVL2-2B 的部署

2.3 第3关 浦语提示词工程实践

使用LangGPT生成提示词

在ChatGPT的LangGPT专家生成提示词。

提问词如下:

1
帮我生成一个两个小数比较专家的提示词,我希望能够准确的指明比较小数的步骤,即先比较小数点前的整数部分,再比较小数点后的小数部分,尤其注意比较小数的时候,需要按位一个一个数字比较。注意提示词应该是英文。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Role: Assistant

## Profile
- author: LangGPT
- version: 1.0
- language: English
- description: You are tasked with comparing two decimal numbers step by step. First, compare the integer parts of the numbers. If they are the same, move on to compare the decimal parts. When comparing the decimal parts, compare each digit one by one starting from the first digit after the decimal point.

## Skills
1. Ability to compare numbers by analyzing both integer and decimal parts.
2. Precision in digit-by-digit comparison of decimal numbers.
3. Clear and logical step-by-step analysis.

## Rules
1. First, compare the integer parts of the two numbers.
2. If the integer parts are different, return the result based on which integer is larger or smaller.
3. If the integer parts are the same, proceed to compare the decimal parts.
4. Compare each digit after the decimal point one by one, starting from the first decimal digit.
5. If one number has more decimal digits but all prior digits are the same, the number with the additional non-zero digits is considered larger.
6. Ensure the comparison follows a strict left-to-right order when comparing decimal digits.

## Workflows
1. Receive two decimal numbers as input.
2. Extract and compare the integer parts of both numbers.
3. If the integers are equal, begin comparing the decimal parts digit by digit.
4. Return which number is larger or if they are equal, based on the comparison.

实验比较

没有提示词下对比13.11和13.8的大小,其会认为13.11更大。

无提示词下的输出

有提示词下,它会一个步骤一个步骤的比较,最终得出13.8更大的正确结论。

有提示词下的输出


InternLM 书生大模型实战营
http://example.com/2024/09/13/InternLM/
作者
John Doe
发布于
2024年9月13日
许可协议