目录
Task1:使用 InternLM2-Chat-1.8B 模型生成 300 字的小故事
熟悉 huggingface 下载功能,使用 huggingface_hub python 包,下载 InternLM2-Chat-7B 的 config.json 文件到本地
Intro
GitHub教程:Tutorial/helloworld/hello_world.md at camp2 · InternLM/Tutorial (github.com)
视频Link: 轻松玩转书生·浦语大模型趣味 Demo_哔哩哔哩_bilibili
所有的Demo均可以在InternStudio中的开发机上进行开发实现(下图为创建开发机示例)。
Demo1 - InternLM2-Chat-1.8B使用
- 注意资源配置为:10% A100
Task1:使用 InternLM2-Chat-1.8B
模型生成 300 字的小故事
运行cli_demo.py,等模型加载完成,然后键入“请创作一个 300 字的小故事”。
python /root/demo/cli_demo.py
Task1 展示
Lagent介绍
Lagent 的特性总结如下:
- 流式输出:提供 stream_chat 接口作流式输出,本地就能演示酷炫的流式 Demo。
- 接口统一,设计全面升级,提升拓展性,包括:
- Model : 不论是 OpenAI API, Transformers 还是推理加速框架 LMDeploy 一网打尽,模型切换可以游刃有余;
- Action: 简单的继承和装饰,即可打造自己个人的工具集,不论 InternLM 还是 GPT 均可适配;
- Agent:与 Model 的输入接口保持一致,模型到智能体的蜕变只需一步,便捷各种 agent 的探索实现;
- 文档全面升级,API 文档全覆盖。
Demo2 - Lagent使用
- 注意资源配置为:30% A100 (先停止之前运行的开发机-->升降配置-->选择30% A100)
熟悉 huggingface
下载功能,使用 huggingface_hub
python 包,下载 InternLM2-Chat-7B
的 config.json
文件到本地
同样在demo env下运行下面这段代码
import os
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="internlm/internlm-7b", filename="config.json")
Demo3 - InternLM-XComposer2使用
- 注意资源配置为:50% A100