🚀 🦚 孔雀模型
🦚 孔雀(Peacock)是一个基于InstructBLIP的模型,它使用阿拉伯语大语言模型AraLLaMA作为其语言模型。该模型在论文 Peacock: A Family of Arabic Multimodal Large Language Models and Benchmarks 中被首次提出。
🚀 快速开始
模型使用
使用方法如下:
from transformers import InstructBlipProcessor, InstructBlipForConditionalGeneration
import torch
from PIL import Image
import requests
model = InstructBlipForConditionalGeneration.from_pretrained("UBC-NLP/Peacock")
processor = InstructBlipProcessor.from_pretrained("UBC-NLP/Peacock")
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
url = "https://upload.wikimedia.org/wikipedia/commons/8/83/Socotra_dragon_tree.JPG"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
prompt = "اوصف الصوره"
inputs = processor(images=image, text=prompt, return_tensors="pt").to(device)
outputs = model.generate(
**inputs,
do_sample=False,
num_beams=5,
max_length=256,
min_length=1,
top_p=0.9,
repetition_penalty=1.5,
length_penalty=1.0,
temperature=1,
)
generated_text = processor.batch_decode(outputs, skip_special_tokens=True)[0].strip()
print(generated_text)
📄 许可证
该项目使用其他许可证。
📚 引用说明
如果您使用了该模型,请引用以下论文:
@inproceedings{alwajih2024peacock,
title = {Peacock: A Family of Arabic Multimodal Large Language Models and Benchmarks},
author = {Alwajih, Fakhraddin and Nagoudi, El Moatez Billah and Bhatia, Gagan and Mohamed, Abdelrahman and Abdul-Mageed, Muhammad},
booktitle = {Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
pages = {12753--12776},
year = {2024},
address = {Bangkok, Thailand},
publisher = {Association for Computational Linguistics},
url = {https://aclanthology.org/2024.acl-long.689}
}