语言:
- 英文
标签:
- 苍鹭模型
- 视觉
- 图像描述生成
- 视觉问答
任务类型: 图像转文本
许可协议:
- 知识共享-非商业性使用 4.0
推理: 不支持
苍鹭GIT Llama 2快速版7B模型

模型详情
苍鹭GIT Llama 2 7B是一款能够就输入图像进行对话的视觉语言模型。
该模型使用苍鹭库训练完成,具体细节请参考相关代码。
使用方式
请按照安装指南进行操作。
import requests
from PIL import Image
import torch
from transformers import AutoProcessor
from heron.models.git_llm.git_llama import GitLlamaConfig, GitLlamaForCausalLM
device_id = 0
model = GitLlamaForCausalLM.from_pretrained(
'turing-motors/heron-chat-git-Llama-2-7b-v0', torch_dtype=torch.float16
)
model.eval()
model.to(f"cuda:{device_id}")
processor = AutoProcessor.from_pretrained('turing-motors/heron-chat-git-Llama-2-7b-v0')
url = "https://www.barnorama.com/wp-content/uploads/2016/12/03-Confusing-Pictures.jpg"
image = Image.open(requests.get(url, stream=True).raw)
text = f"##human: 这张图片是什么?\n##gpt: "
inputs = processor(
text,
image,
return_tensors="pt",
truncation=True,
)
inputs = {k: v.to(f"cuda:{device_id}") for k, v in inputs.items()}
eos_token_id_list = [
processor.tokenizer.pad_token_id,
processor.tokenizer.eos_token_id,
]
with torch.no_grad():
out = model.generate(**inputs, max_length=256, do_sample=False, temperature=0., eos_token_id=eos_token_id_list)
print(processor.tokenizer.batch_decode(out)[0])
模型详情
训练过程
本模型首先使用适配器在M3IT的Coco Captions数据集上进行初步训练。第二阶段使用M3IT进行微调。最后通过LLaVA-Instruct-150K进行指令调优训练。
训练数据集
使用范围与限制
预期用途
本模型适用于聊天类应用场景和研究用途。
使用限制
模型可能产生不准确或错误信息,其准确性无法保证。目前仍处于研发阶段。
引用方式
@misc{GitLlama2,
url = {[https://huggingface.co/turing-motors/heron-chat-git-Llama-2-7b-v0](https://huggingface.co/turing-motors/heron-chat-git-Llama-2-7b-v0)},
title = {苍鹭GIT Llama 2 7B模型},
author = {井上裕一, 田中光太郎, 山口悠}
}
参考文献
@misc{touvron2023llama,
title={Llama 2: 开放基础与微调聊天模型},
author={雨果·图夫龙等},
year={2023},
eprint={2307.09288},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
许可协议: 知识共享-非商业性使用 4.0