项目积分|水獭纸| 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团队的巨大赞誉为这一伟大的建筑作品。