項目積分|水獺紙| Otterhd紙|模仿紙
檢查點:
對於中國大陸的誰:|
免責聲明:該代碼可能無法完美拋光和重構,但是所有開放的代碼均可測試和運行,因為我們還使用代碼來支持我們的研究。如果您有任何疑問,請隨時打開問題。我們熱切期待提出建議和PR,以提高代碼質量。
[2023-11]:支持GPT4V對8個基準的評估;從FUYU-8B提高了OTTERHD-8B。有關詳細信息,請結帳OtterHD。
datasets :
- name : magnifierbench
split : test
prompt : Answer with the option's letter from the given choices directly.
api_key : [Your API Key] # GPT4 or GPT3.5 to evaluate the answers and ground truth.
debug : true # put debug=true will save the model response in log file.
- name : mme
split : test
debug : true
- name : mmbench
split : test
debug : true
models :
- name : gpt4v
api_key : [Your API Key] # to call GPT4V model.
IMAGE_TEXT : # Group name should be in [IMAGE_TEXT, TEXT_ONLY, IMAGE_TEXT_IN_CONTEXT]
LADD : # Dataset name can be assigned at any name you want
mimicit_path : azure_storage/json/LA/LADD_instructions.json # Path of the instruction json file
images_path : azure_storage/Parquets/LA.parquet # Path of the image parquet file
num_samples : -1 # Number of samples you want to use, -1 means use all samples, if not set, default is -1.
M3IT_CAPTIONING :
mimicit_path : azure_storage/json/M3IT/captioning/coco/coco_instructions.json
images_path : azure_storage/Parquets/coco.parquet
num_samples : 20000
[2023-08]
[2023-07]:用於多個交織的圖像文本/視頻指令調整的模擬模擬數據集。
[2023-06]
frame tensors
被錯誤地毫無爭議地與錯誤的vision_x
。確保正確調整
sys.path.append("../..")
以訪問otter.modeling_otter
,以啟動模型。
大型語言模型(LLMS)已證明了眾多/零攝像的學習者在眾多任務中表現出了非凡的通用才能,這是由於它們對廣泛的文本數據進行了預培訓。在這些LLM中,GPT-3是具有重要功能的突出模型。此外,GPT-3的變體(即指令和Chatgpt)已被證明有效地解釋了自然語言指令以執行複雜的現實世界任務,這要歸功於說明。
我們提出的是,我們提出的是由上游交織的格式預處理的動機? Otter,一種基於OpenFlamingo(DeepMind的Flamingo的開源版本)的多模式模型。我們在提議的mi -m odal i n c ontext i n構建t uning ( mimic-it )數據集中以一種內在的指令調整方式訓練水獺。 Otter在圖像和視頻中都展示了改進的指導遵循和秘密學習能力。
模仿-IT啟用了以自我為中心的視覺助手模型的應用,該模型可以用來回答您的問題,例如嘿,您認為我將鑰匙留在桌子上嗎? 。利用模擬物的力量,以解開AI驅動的視覺助手的全部潛力,並將您的交互式視覺語言任務提升到新的高度。
我們還介紹了Syphus ,這是一種自動化管道,用於以多種語言生成高質量的指令 - 響應對。在LLAVA提出的框架的基礎上,我們利用Chatgpt根據視覺內容生成指令 - 響應對。為了確保生成的指令 - 響應對的質量,我們的管道將系統消息,視覺註釋和內在示例包含作為CHATGPT的提示。
有關更多詳細信息,請檢查模仿數據集。
Otter旨在支持基於OpenFlamingo模型的多模式中下文指令進行調整,該模型涉及在相應的媒體上調節語言模型,例如與標題或指令響應對相對應的圖像。
我們在模仿數據集上使用約280萬個內部文字指令 - 響應對訓練水獺,它們結構為凝聚模板以促進各種任務。 Otter支持視頻輸入(將幀作為原始Flamingo的實現安排),將多個圖像輸入作為文本示例,這是第一個多模式指令調諧模型。
以下模板包含圖像,用戶說明和模型生成的響應,利用User
和GPT
角色標籤啟用無縫的用戶輔助交互。
prompt = f"<image>User: { instruction } GPT:<answer> { response } <endofchunk>"
如LA和SD任務所證明的那樣,在MIMIC-IT數據集中訓練水獺模型可以使其獲得不同的能力。該模型經過洛杉磯任務的培訓,具有出色的場景理解,推理能力和多輪對話能力。
# multi-round of conversation
prompt = f"<image>User: { first_instruction } GPT:<answer> { first_response } <endofchunk>User: { second_instruction } GPT:<answer>"
關於組織視覺語言中文上下文示例的概念,我們在這裡演示了Otter模型在訓練LA-T2T任務後遵循跨文字指令的獲得能力。有組織的輸入數據格式如下:
# Multiple in-context example with similar instructions
prompt = f"<image>User: { ict_first_instruction } GPT: <answer> { ict_first_response } <|endofchunk|><image>User: { ict_second_instruction } GPT: <answer> { ict_second_response } <|endofchunk|><image>User: { query_instruction } GPT: <answer>"
有關更多詳細信息,請參閱我們的論文附錄以獲取其他任務。
conda env create -f environment.yml
安裝。特別是要確保transformers>=4.28.0
, accelerate>=0.18.0
。配置環境後,您可以使用?火烈鳥模型 /?水獺模型為?只用幾行擁抱面部模型!一單擊,然後自動下載模型配置/權重。有關詳細信息,請參閱Huggingface Otter/Flamingo。
水獺經過基於OpenFlamingo的培訓。您可能需要在Luodian/Otter-9b-Init或Luodian/Otter-MPT7B-Init上使用轉換的權重。它們分別從OpenFlamingo-llama7b-v1和OpenFlamingo-MPT7B-V2轉換,我們為Otter的下游指令調整添加了一個<answer>
令牌。
您也可以使用任何受過訓練的水獺重量從我們的訓練開始,以水獺重量見。您可以參考模擬圖,以準備圖像/指令/火車JSON文件。
export PYTHONPATH=.
RUN_NAME= " Otter_MPT7B "
GPU=8
WORKERS= $(( ${GPU} * 2 ))
echo " Using ${GPU} GPUs and ${WORKERS} workers "
echo " Running ${RUN_NAME} "
accelerate launch --config_file=./pipeline/accelerate_configs/accelerate_config_zero3.yaml
--num_processes= ${GPU}
pipeline/train/instruction_following.py
--pretrained_model_name_or_path=luodian/OTTER-MPT7B-Init
--model_name=otter
--instruction_format=simple
--training_data_yaml=./shared_scripts/Demo_Data.yaml
--batch_size=8
--num_epochs=3
--report_to_wandb
--wandb_entity=ntu-slab
--external_save_dir=./checkpoints
--run_name= ${RUN_NAME}
--wandb_project=Otter_MPTV
--workers= ${WORKERS}
--lr_scheduler=cosine
--learning_rate=2e-5
--warmup_steps_ratio=0.01
--save_hf_model
--max_seq_len=1024
如果您發現此存儲庫有用,請考慮引用:
@article{li2023otter,
title={Otter: A Multi-Modal Model with In-Context Instruction Tuning},
author={Li, Bo and Zhang, Yuanhan and Chen, Liangyu and Wang, Jinghao and Yang, Jingkang and Liu, Ziwei},
journal={arXiv preprint arXiv:2305.03726},
year={2023}
}
@article{li2023mimicit,
title={MIMIC-IT: Multi-Modal In-Context Instruction Tuning},
author={Bo Li and Yuanhan Zhang and Liangyu Chen and Jinghao Wang and Fanyi Pu and Jingkang Yang and Chunyuan Li and Ziwei Liu},
year={2023},
eprint={2306.05425},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
我們感謝杰克·赫塞爾(Jack Hessel)的建議和支持,以及OpenFlamingo團隊為開源社區做出的巨大貢獻。
Flamingo和OpenFlamingo團隊的巨大讚譽為這一偉大的建築作品。