【llm 部署运行videochat--完整教程】

申请llama权重

https://ai.meta.com/resources/models-and-libraries/llama-downloads/
-> 勾选三个模型
-> 等待接收邮件信息(很快)

下载llama权重

git clone https://github.com/facebookresearch/llama.git
cd llama
bash download.py
-> 输入email 中的 url
-> 输入模型名字 7B or 13B , ....

获取转换文件

https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py

https://huggingface.co/CarperAI/stable-vicuna-13b-delta/raw/main/apply_delta.py

获取videochat

git clone https://github.com/OpenGVLab/Ask-Anything.git
cd Ask-Anything/video_chat/
pip install -r requirements.txt
pip install huggingface_hub

下载eva_vit_g.pth

wget https://storage.googleapis.com/sfr-vision-language-research/LAVIS/models/BLIP2/eva_vit_g.pth

下载blip2_pretrained_flant5xxl.pth

wget https://storage.googleapis.com/sfr-vision-language-research/LAVIS/models/BLIP2/blip2_pretrained_flant5xxl.pth

使用13b模型 运行下边的四个

下载stable-vicuna-13b-delta

huggingface-cli download --token hf_xxx --resume-download --local-dir-use-symlinks False CarperAI/stable-vicuna-13b-delta --local-dir stable-vicuna-13b-delta

转换权重llama2-13b

python convert_llama_weights_to_hf.py --input_dir llama-2-13b --model_size 13B --output_dir llama2-13b

转换权重stable-vicuna-13b

python3 apply_delta.py --base llama2-13b --target stable-vicuna-13b --delta stable-vicuna-13b-delta

删除无用的内容

rm -rf stable-vicuna-13b-delta
rm -rf llama-2-13b

使用7b模型 运行下边的四个

下载lmsys/vicuna-7b-delta-v0

huggingface-cli download --token hf_xxx --resume-download --local-dir-use-symlinks False lmsys/vicuna-7b-delta-v0 --local-dir vicuna-7b-delta-v0

转换权重llama2-7b

python convert_llama_weights_to_hf.py --input_dir llama-2-7b --model_size 7B --output_dir llama2-7b

转换权重vicuna-7b-v0

python3 apply_delta.py --base llama2-7b --target vicuna-7b-v0 --delta vicuna-7b-delta-v0

删除无用的

rm -rf vicuna-7b-delta-v0
rm -rf llama-2-7b

运行

python demo.py

或者运行

demo.ipynb

注意

  • hr_xxx 需要改成你自己的(https://huggingface.co/ ->点击头像 -> setting -> Access Tokens)
  • config_7b.json 配置文件中 需要将videochat.pth修改 videochat_7b.pth
  • huggingface 下载缓慢可以使用镜像
  • 其他的参考videochat readme进行设置
  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

放飞自我的Coder

你的鼓励很棒棒哦~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值