目录
基础任务
LMDeploy部署
网页应用部署体验
我们可以使用UI界面先体验与InternVL对话:
拉取本教程的github仓库GitHub - Control-derek/InternVL2-Tutorial:
git clone https://github.com/Control-derek/InternVL2-Tutorial.git cd InternVL2-Tutorial
conda activate lmdeploy python demo.py


XTuner微调实践
数据集下载
通过huggingface下载
去huggingface下载此数据集:https://huggingface.co/datasets/lyan62/FoodieQA。该数据集为了防止网络爬虫污染测评效果,需要向提交申请后下载使用。
解压下载包
开始微调
运行命令,开始微调:
xtuner train internvl_v2_internlm2_2b_lora_finetune_food --deepspeed deepspeed_zero2
微调后,把模型checkpoint的格式转化为便于测试的格式:
python xtuner/configs/internvl/v1_5/convert_to_official.py xtuner/configs/internvl/v2/internvl_v2_internlm2_2b_lora_finetune_food.py ./work_dirs/internvl_v2_internlm2_2b_lora_finetune_food/iter_640.pth ./work_dirs/internvl_v2_internlm2_2b_lora_finetune_food/lr35_ep10/
完成后文件夹如下
与AI美食家玩耍
重新启动网站应用,微调前的效果,说肠粉是饺子
微调后的效果,进行了正确的识别
进阶任务(优秀学员)
将训练好的模型上传到 Hugging Face 或 ModelScope 上,模型名称包含 InternVL 关键词
模型上传
登录并创建model L2_InternVL,把微调好的模型传进去,然后推出
Pluto0616/L2_InternVL · Hugging Face
模型部署
创建一个Space,远程连接后编辑requirements.txt和app.py,配置和代码都是结合实际进行了修改的
部署后发现报错,提示Hugging Face 环境中没有检测到 NVIDIA 驱动或 GPU。这是因为咱用的是CPU basic免费版,等以后有机会在升级吧