第二节 轻松玩转书生·浦语大模型趣味 Demo
1.部署 InternLM2-Chat-1.8B 模型进行智能对话
2.实战:部署实战营优秀作品
八戒-Chat是利用《西游记》剧本中所有关于猪八戒的台词和语句,以及Chat-GPT-3.5生成的相关问题结果,基于InternLM2-chat-1.8b进行全量微调得到的模仿猪八戒语气的聊天语言模型。
有点幽默了,这到底是猪八戒还是猴哥。
3.使用 Lagent 运行 InternLM2-Chat-7B 模型
安装好后,
streamlit run /root/demo/lagent/examples/internlm2_agent_web_demo_hf.py --server.address 127.0.0.1 --server.port 6006
在本地的powershell
# 从本地使用 ssh 连接 studio 端口
# 将下方端口号 38374 替换成自己的端口号
ssh -CNg -L 6006:127.0.0.1:6006 root@ssh.intern-ai.org.cn -p 38374
lagent框架有着纠错功能,测试纠错两次,第三次得到正确答案。
4.灵笔开发机还没权限
5.Hugging Face模型下载
pip install -U huggingface_hub
import os
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"
from huggingface_hub import hf_hub_download # Load model directly
# os.system('huggingface-cli download --resume-download internlm/internlm2-chat-7b --local-dir your_path')
hf_hub_download(local_dir="pythonProject2",repo_id="internlm/internlm2-7b", filename="config.json")
运行之后并没有输出
文件目录显示下载成功