You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
这是官方教程:https://github.com/InternLM/InternLM-XComposer/blob/main/docs/install_CN.md
我要用这个模型进行推理:https://huggingface.co/internlm/internlm-xcomposer2-vl-7b
一个最简单有效的操作流程:
1.创建一个空项目,创建一个虚拟环境,python可以用3.10,官方要求是3.9;
2.安装最新版的PyTorch:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
3.安装包:
pip install transformers-4.33.2 timm==0.4.12 sentencepiece==0.1.99 gradio==3.44.4 markdown2==2.4.10 xlsxwriter==3.1.2 einops
官方要安装transformers==4.30.2,但是,会报错
4.要手动下载 openai/clip-vit-large-patch14-336:
huggingface-cli download --resume-download openai/clip-vit-large-patch14-336 --local-dir clip-vit-large-patch14-336
官方的代码不会自动下载它,只会读取缓存,发现没有,就报错。
5.复制官方给的代码,粘贴到一个新建的python文件中:
https://github.com/InternLM/InternLM-XComposer?tab=readme-ov-file#xcomposer2-vl
指定好代码中的图片。
如果你直接运行,会显存溢出,除非,你的显存大于32GB。
如果你用的是RTX4090,那么,就要设置加载模型的精度为fp16,或bf16,然后,运行代码,占用显存约20GB
我对比了好几个类似模型,别人家的模型,从3GB-46GB的,我基本都是直接复制代码、粘贴、运行,一次性成功!我连环境都不用搭建,就用平时常用的一个虚拟环境。46GB的模型,自动加载到我的2*4090中,跑的很溜。
我忍不住吐槽,这个项目教程和示例代码是我遇到的上手体验最差的!
很显然,开发者,根本就没有在一个普通用户的电脑环境上进行测试,他电脑上运行成功了,就直接提交代码。但是,这个模型的大小显然就是给普通用户用的。
之前看到的模型都是英文版的,第一次看到中文的模型和示例代码,眼前一亮,天真的以为运行这些代码一定更顺利,没想到这么坎坷。
这个项目现在有1.6K start,但是,Issues 已经高达 76!
对应的huggingFace上的模型,收到 50 个like,但是,Community 里面的帖子高达 10 个!
模型本身的质量还是很好的,相比同类模型,生成内容的准确性更高,可控性也更强。
Beta Was this translation helpful? Give feedback.
All reactions