书生浦语实战营 第2节课 《轻松分钟玩转书生.浦语大模型趣味Demo》

1.根据https://github.com/InternLM/Tutorial/blob/camp1/helloworld/hello_world.md

2.打开InternStudio的开发机

配置好所需的环境

bash /root/share/install_conda_env_internlm_base.sh internlm-demo

配置好环境之后,安装所需要的包

python -m pip install --upgrade pip

pip install modelscope==1.9.5
pip install transformers==4.35.2
pip install streamlit==1.24.0
pip install sentencepiece==0.1.99
pip install accelerate==0.24.1

当以上的包和环境配置好之后,就可以开始进行模型的下载了

mkdir -p /root/model/Shanghai_AI_Laboratory
cp -r /root/share/temp/model_repos/internlm-chat-7b /root/model/Shanghai_AI_Laboratory

下载代码:

cd /root/code
git clone https://gitee.com/internlm/InternLM.git

之后在进入我们下载代码的路径:

cd InternLM
git checkout 3028f07cb79e5b1d7342f4ad8d11efad3fd13d17

将其中的web_demo.py的文件中29行和33行的模型路径更换为本地的/root/model/Shanghai_AI_Laboratory/internlm-chat-7b

cd /root/code/InternLM

在当前目录下新建一个cli_demo.py的文件:

将这些代码设置完成之后,我们呢就可以在终端运行:

python /root/code/InternLM/cli_demo.py

使用InternLM-Chat-7B模型生成300字的小故事:

熟悉 hugging face 下载功能,使用 huggingface_hub python 包,下载 InternLM-20B 的 config.json 文件到本地(需截图下载过程)。

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值