Prometheus Vision 7b V1.0
普羅米修斯視覺是首個專為評估任務設計的開源視覺語言模型,與GPT-4V及人類評估者均展現出高度相關性,可作為GPT-4V評估的經濟替代方案。
Downloads 112
Release Time : 1/14/2024
Model Overview
該模型是一個視覺語言模型,專門用於評估任務,包含五個輸入組件(圖像、指令、待評估回答、定製評分標準、參考答案)和兩個輸出組件(語言反饋與評分決策)。
Model Features
評估任務專用設計
首個專為評估任務設計的開源視覺語言模型,特別適合需要精確評估的場景。
多組件輸入輸出
支持圖像、指令、待評估回答、評分標準和參考答案五個輸入組件,輸出語言反饋和評分決策兩個組件。
與GPT-4V高度相關
與GPT-4V及人類評估者均展現出高度相關性,可作為經濟替代方案。
Model Capabilities
圖像理解
文本生成
視覺問答
評估反饋生成
評分決策
Use Cases
教育評估
視覺問答評估
評估學生對圖像內容的理解和回答質量
提供詳細反饋和評分
內容審核
圖像內容合規性評估
評估圖像內容是否符合特定標準
生成合規性報告和評分
🚀 Prometheus-Vision - 圖像到文本的視覺語言模型
Prometheus-Vision 是首個專為評估目的設計的開源視覺語言模型(VLM)。它與 GPT - 4V 和人類評估者都有很高的相關性,這表明它有潛力作為 GPT - 4V 評估的低成本替代方案。
🚀 快速開始
Prometheus-Vision 有五個輸入組件(圖像、指令、待評估的響應、定製的評分標準、參考答案)和兩個輸出組件(語言反饋和評分決策)。你可以參考以下鏈接獲取更多信息:
- 主頁:https://kaistai.github.io/prometheus-vision/
- 倉庫:https://github.com/kaistAI/prometheus-vision
- 論文:https://arxiv.org/abs/2401.06591
- 聯繫人:seongyun@kaist.ac.kr
✨ 主要特性
- 專為評估設計:是首個專注於評估的開源 VLM。
- 高相關性:與 GPT - 4V 和人類評估者高度相關。
- 多組件輸入輸出:支持五個輸入組件和兩個輸出組件。
📦 安裝指南
文檔未提及安裝步驟,暫不提供。
💻 使用示例
基礎用法
在 transformers
中使用該模型的示例腳本如下,展示瞭如何在 GPU 上運行模型:
import argparse
import torch
import os
import json
from tqdm import tqdm
import shortuuid
from llava.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN, DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN
from llava.conversation import conv_templates, SeparatorStyle
from llava.model.builder import load_pretrained_model
from llava.utils import disable_torch_init
from llava.mm_utils import tokenizer_image_token, get_model_name_from_path, KeywordsStoppingCriteria
from PIL import Image
import math
def split_list(lst, n):
"""Split a list into n (roughly) equal-sized chunks"""
chunk_size = math.ceil(len(lst) / n) # integer division
return [lst[i:i+chunk_size] for i in range(0, len(lst), chunk_size)]
def get_chunk(lst, n, k):
chunks = split_list(lst, n)
return chunks[k]
def eval_model(args):
# Model
disable_torch_init()
model_path = 'kaist-ai/prometheus-vision-7b-v1.0'
model_name = 'llava-v1.5'
tokenizer, model, image_processor, context_len = load_pretrained_model(model_path, args.model_base, model_name)
questions = [json.loads(q) for q in open(os.path.expanduser(args.question_file), "r")]
questions = get_chunk(questions, args.num_chunks, args.chunk_idx)
answers_file = os.path.expanduser(args.answers_file)
os.makedirs(os.path.dirname(answers_file), exist_ok=True)
ans_file = open(answers_file, "w")
for line in tqdm(questions):
idx = line["question_id"]
image_file = line["image"]
qs = line["text"]
cur_prompt = qs
if model.config.mm_use_im_start_end:
qs = DEFAULT_IM_START_TOKEN + DEFAULT_IMAGE_TOKEN + DEFAULT_IM_END_TOKEN + '\n' + qs
else:
qs = DEFAULT_IMAGE_TOKEN + '\n' + qs
conv = conv_templates[args.conv_mode].copy()
conv.append_message(conv.roles[0], qs)
conv.append_message(conv.roles[1], None)
prompt = conv.get_prompt()
input_ids = tokenizer_image_token(prompt, tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).cuda()
image = Image.open(os.path.join(args.image_folder, image_file))
image_tensor = image_processor.preprocess(image, return_tensors='pt')['pixel_values'][0]
stop_str = conv.sep if conv.sep_style != SeparatorStyle.TWO else conv.sep2
keywords = [stop_str]
stopping_criteria = KeywordsStoppingCriteria(keywords, tokenizer, input_ids)
with torch.inference_mode():
output_ids = model.generate(
input_ids,
images=image_tensor.unsqueeze(0).half().cuda(),
do_sample=True if args.temperature > 0 else False,
temperature=args.temperature,
top_p=args.top_p,
num_beams=args.num_beams,
# no_repeat_ngram_size=3,
max_new_tokens=1024,
use_cache=True)
input_token_len = input_ids.shape[1]
n_diff_input_output = (input_ids != output_ids[:, :input_token_len]).sum().item()
if n_diff_input_output > 0:
print(f'[Warning] {n_diff_input_output} output_ids are not the same as the input_ids')
outputs = tokenizer.batch_decode(output_ids[:, input_token_len:], skip_special_tokens=True)[0]
outputs = outputs.strip()
if outputs.endswith(stop_str):
outputs = outputs[:-len(stop_str)]
outputs = outputs.strip()
ans_id = shortuuid.uuid()
ans_file.write(json.dumps({"question_id": idx,
"prompt": cur_prompt,
"text": outputs,
"answer_id": ans_id,
"model_id": model_name,
"metadata": {}}) + "\n")
ans_file.flush()
ans_file.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model-path", type=str, default="facebook/opt-350m")
parser.add_argument("--model-base", type=str, default=None)
parser.add_argument("--image-folder", type=str, default="")
parser.add_argument("--question-file", type=str, default="tables/question.jsonl")
parser.add_argument("--answers-file", type=str, default="answer.jsonl")
parser.add_argument("--conv-mode", type=str, default="llava_v1")
parser.add_argument("--num-chunks", type=int, default=1)
parser.add_argument("--chunk-idx", type=int, default=0)
parser.add_argument("--temperature", type=float, default=0.2)
parser.add_argument("--top_p", type=float, default=None)
parser.add_argument("--num_beams", type=int, default=1)
args = parser.parse_args()
eval_model(args)
高級用法
文檔未提及高級用法示例,暫不提供。
📚 詳細文檔
模型描述
屬性 | 詳情 |
---|---|
模型類型 | 視覺語言模型 |
語言(NLP) | 英語 |
許可證 | Apache 2.0 |
相關模型 | 所有 Prometheus 檢查點 |
更多信息資源 | 研究論文、GitHub 倉庫 |
Prometheu-Vision 有兩種不同的規模(7B 和 13B)。你可以在 此頁面 查看 13B 規模的 VLM,也可以在 此頁面 查看相關數據集。
提示格式
Prometheus-Vision 的輸入需要 5 個組件:一張圖像、一條指令、一個待評估的響應、一個評分標準和一個參考答案。你可以參考以下提示格式:
###任務描述:
給出一條指令(可能包含輸入內容)、一個待評估的響應、一個得分為 5 的參考答案、一張圖像和一個代表評估標準的評分標準。
1. 嚴格根據給定的評分標準,撰寫一份詳細的反饋,評估響應的質量,而不是進行一般性評估。
2. 撰寫反饋後,給出一個 1 到 5 之間的整數評分。你應該參考評分標準。
3. 輸出格式應如下所示:"反饋: (為標準撰寫反饋) [結果] (1 到 5 之間的整數)"
4. 請不要生成任何其他開頭、結尾和解釋內容。
###待評估的指令:
{instruction}
###待評估的響應:
{response}
###參考答案(得分 5):
{reference_answer}
###評分標準:
[{criteria_description}]
得分 1: {score1_description}
得分 2: {score2_description}
得分 3: {score3_description}
得分 4: {score4_description}
得分 5: {score5_description}
###反饋:
🔧 技術細節
文檔未提供具體技術細節,暫不提供。
📄 許可證
Perception Collection 和 Prometheus-Vision 生成的數據需遵循 OpenAI 的使用條款。如果您懷疑有任何違規行為,請與我們聯繫。
📖 引用
如果您發現該模型有幫助,請考慮引用我們的論文:
@misc{lee2024prometheusvision,
title={Prometheus-Vision: Vision-Language Model as a Judge for Fine-Grained Evaluation},
author={Seongyun Lee and Seungone Kim and Sue Hyun Park and Geewook Kim and Minjoon Seo},
year={2024},
eprint={2401.06591},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Clip Vit Large Patch14
CLIP是由OpenAI開發的視覺-語言模型,通過對比學習將圖像和文本映射到共享的嵌入空間,支持零樣本圖像分類
圖像生成文本
C
openai
44.7M
1,710
Clip Vit Base Patch32
CLIP是由OpenAI開發的多模態模型,能夠理解圖像和文本之間的關係,支持零樣本圖像分類任務。
圖像生成文本
C
openai
14.0M
666
Siglip So400m Patch14 384
Apache-2.0
SigLIP是基於WebLi數據集預訓練的視覺語言模型,採用改進的sigmoid損失函數,優化了圖像-文本匹配任務。
圖像生成文本
Transformers

S
google
6.1M
526
Clip Vit Base Patch16
CLIP是由OpenAI開發的多模態模型,通過對比學習將圖像和文本映射到共享的嵌入空間,實現零樣本圖像分類能力。
圖像生成文本
C
openai
4.6M
119
Blip Image Captioning Base
Bsd-3-clause
BLIP是一個先進的視覺-語言預訓練模型,擅長圖像描述生成任務,支持條件式和非條件式文本生成。
圖像生成文本
Transformers

B
Salesforce
2.8M
688
Blip Image Captioning Large
Bsd-3-clause
BLIP是一個統一的視覺-語言預訓練框架,擅長圖像描述生成任務,支持條件式和無條件式圖像描述生成。
圖像生成文本
Transformers

B
Salesforce
2.5M
1,312
Openvla 7b
MIT
OpenVLA 7B是一個基於Open X-Embodiment數據集訓練的開源視覺-語言-動作模型,能夠根據語言指令和攝像頭圖像生成機器人動作。
圖像生成文本
Transformers English

O
openvla
1.7M
108
Llava V1.5 7b
LLaVA 是一款開源多模態聊天機器人,基於 LLaMA/Vicuna 微調,支持圖文交互。
圖像生成文本
Transformers

L
liuhaotian
1.4M
448
Vit Gpt2 Image Captioning
Apache-2.0
這是一個基於ViT和GPT2架構的圖像描述生成模型,能夠為輸入圖像生成自然語言描述。
圖像生成文本
Transformers

V
nlpconnect
939.88k
887
Blip2 Opt 2.7b
MIT
BLIP-2是一個視覺語言模型,結合了圖像編碼器和大型語言模型,用於圖像到文本的生成任務。
圖像生成文本
Transformers English

B
Salesforce
867.78k
359
Featured Recommended AI Models
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers Supports Multiple Languages

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers English

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 Chinese
R
uer
2,694
98