🚀 🦚 孔雀模型
🦚 孔雀(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}
}