language:
- ja
tags:
- 苍鹭模型
- 视觉
- 图像描述生成
- 视觉问答
pipeline_tag: 图像转文本
license:
- 署名-非商业性使用 4.0
inference: false
苍鹭BLIP日语StableLM基础版7B llava-620k
模型详情
苍鹭BLIP日语StableLM基础版7B是一个能够就输入图像进行对话的视觉语言模型。
该模型使用苍鹭库训练完成,详情请参阅相关代码。
使用方法
请按照安装指南进行操作。
import torch
from heron.models.video_blip import VideoBlipForConditionalGeneration, VideoBlipProcessor
from transformers import LlamaTokenizer
device_id = 0
device = f"cuda:{device_id}"
MODEL_NAME = "turing-motors/heron-chat-blip-ja-stablelm-base-7b-v1"
model = VideoBlipForConditionalGeneration.from_pretrained(
MODEL_NAME, torch_dtype=torch.float16, ignore_mismatched_sizes=True
)
model = model.half()
model.eval()
model.to(device)
processor = VideoBlipProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
tokenizer = LlamaTokenizer.from_pretrained("novelai/nerdstash-tokenizer-v1", additional_special_tokens=['▁▁'])
processor.tokenizer = tokenizer
import requests
from PIL import Image
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=text,
images=image,
return_tensors="pt",
truncation=True,
)
inputs = {k: v.to(device) for k, v in inputs.items()}
inputs["pixel_values"] = inputs["pixel_values"].to(device, torch.float16)
eos_token_id_list = [
processor.tokenizer.pad_token_id,
processor.tokenizer.eos_token_id,
int(tokenizer.convert_tokens_to_ids("##"))
]
with torch.no_grad():
out = model.generate(**inputs, max_length=256, do_sample=False, temperature=0., eos_token_id=eos_token_id_list, no_repeat_ngram_size=2)
print(processor.tokenizer.batch_decode(out))
模型详情
训练过程
该模型使用LLaVA-Instruct-620K-JA数据集进行了全面微调。
训练数据集
使用范围与限制
预期用途
本模型适用于聊天类应用场景及研究用途。
使用限制
模型可能产生不准确或错误信息,其准确性无法保证。目前仍处于研发阶段。
引用方式
@misc{Blip日语StableLM,
url = {[https://huggingface.co/turing-motors/heron-chat-blip-ja-stablelm-base-7b-v0](https://huggingface.co/turing-motors/heron-chat-blip-ja-stablelm-base-7b-v0)},
title = {苍鹭BLIP日语StableLM基础版7B},
author = {棚桥浩太郎, 井上裕一, 山口优}
}
参考文献
@misc{日语InstructBLIPAlpha版,
url = {[https://huggingface.co/stabilityai/japanese-instructblip-alpha](https://huggingface.co/stabilityai/japanese-instructblip-alpha)},
title = {日语InstructBLIP Alpha版},
author = {Shing Makoto, 秋叶拓也}
}
license: 署名-非商业性使用 4.0