跟随internLM的教程演示,完成一个internLM的helloword
https://github.com/InternLM/tutorial
1.InternLM-Chat-7B 智能对话 Demo

首先创建一台A100(1/4)的开发机,选择好镜像资源。进入 `conda` 环境之后,使用以下命令从本地克隆一个已有的 `pytorch 2.0.1` 的环境,并在环境中安装运行 demo 所需要的依赖。
(https://studio.intern-ai.org.cn/) 平台的 `share` 目录下已经为我们准备了全系列的 `InternLM` 模型,所以我们可以直接复制即可。
首先 `clone` 代码,在 `/root` 路径下新建 `code` 目录,然后切换路径, clone 代码. cd /root/code git clone https://gitee.com/internlm/InternLM.git,并修改模型路径

我们切换到 `VScode` 中,运行 `/root/code/InternLM` 目录下的 `web_demo.py` 文件,将端口映射到本地。在本地浏览器输入 `http://127.0.0.1:6006` 即可。

模型加载完成之后,可以进行对话。
2.Lagent 智能体工具调用 Demo
使用和第一个 `InternLM` 一样的镜像环境,无需再次更换环境,首先切换路径到 `/root/code` 克隆 `lagent` 仓库,并通过 `pip install -e .` 源码安装 `Lagent`
```shell cd /root/code git clone https://gitee.com/internlm/lagent.git cd /root/code/lagent git checkout 511b03889010c4811b1701abb153e02b8e94fb5e # 尽量保证和教程commit版本一致 pip install -e . # 源码安装 ```
根据教程直接进行源码替换
端口运行:streamlit run /root/code/lagent/examples/react_web_demo.py --server.address 127.0.0.1 --server.port 6006
我们在 `Web` 页面选择 `InternLM` 模型,等待模型加载完毕后,输入数学问题 已知 `2x+3=10`,求`x` ,此时 `InternLM-Chat-7B` 模型理解题意生成解此题的 `Python` 代码,`Lagent` 调度送入 `Python` 代码解释器求出该问题的解。

3.浦语·灵笔图文理解创作 Demo
使用 [InternStudio](https://studio.intern-ai.org.cn/) 中的 A100(1/4) * 2 机器和 `internlm-xcomposer-7b` 模型部署一个图文理解创作 Demo
进入 `conda` 环境之后,使用以下命令从本地克隆一个已有的`pytorch 2.0.1` 的环境
```shell conda create --name xcomposer-demo --clone=/root/share/conda_envs/internlm-base ``` 然后使用以下命令激活环境 ```shell conda activate xcomposer-demo ``` 接下来运行以下命令,安装 `transformers`、`gradio` 等依赖包。请严格安装以下版本安装! ```shell pip install transformers==4.33.1 timm==0.4.12 sentencepiece==0.1.99 gradio==3.44.4 markdown2==2.4.10 xlsxwriter==3.1.2 einops accelerate ```
(https://studio.intern-ai.org.cn/)平台的 `share` 目录下已经为我们准备了全系列的 `InternLM` 模型,所以我们可以直接复制即可。
在 `/root/code` `git clone InternLM-XComposer` 仓库的代码
cd /root/code git clone https://gitee.com/internlm/InternLM-XComposer.git
在终端运行以下代码:
cd /root/code/InternLM-XComposer python examples/web_demo.py \ --folder /root/model/Shanghai_AI_Laboratory/internlm-xcomposer-7b \ --num_gpus 1 \ --port 6006
接下来,我们可以体验图片理解的能力
