マルチモーダルCoTは、分離されたトレーニングフレームワークにビジョン機能を組み込んでいます。フレームワークは、(i)理論的根拠の生成と(ii)回答の推論の2つのトレーニング段階で構成されています。両方のステージは同じモデルアーキテクチャを共有しますが、入力と出力が異なります。
必要なすべての Python 依存関係をインストールします。
pip install -r requirements.txt
次のリポジトリからデータセットをダウンロードします。
https://github.com/lupantech/ScienceQA/tree/main/data
抽出したビジョン機能をvision_featuresからダウンロードし、以下のファイルを解凍します。
vision_features
# rationale generation CUDA_VISIBLE_DEVICES=0,1 python main.py \ --model allenai/unifiedqa-t5-base \ --user_msg rationale --img_type detr \ --bs 8 --eval_bs 4 --eval_acc 10 --output_len 512 \ --final_eval --prompt_format QCM-LE # answer inference CUDA_VISIBLE_DEVICES=0,1 python main.py \ --model allenai/unifiedqa-t5-base \ --user_msg answer --img_type detr \ --bs 8 --eval_bs 4 --eval_acc 10 --output_len 64 \ --final_eval --prompt_format QCMG-A \ --eval_le experiments/rationale_allenai-unifiedqa-t5-base_detr_QCM-LE_lr5e-05_bs16_op512_ep20/predictions_ans_eval.json \ --test_le experiments/rationale_allenai-unifiedqa-t5-base_detr_QCM-LE_lr5e-05_bs16_op512_ep20/predictions_ans_test.json
トレーニング済みのモデルは、モデルで入手できます。トレーニング済みのモデルを使用するには、フォルダーの下に配置してください。
models
# rationale generation CUDA_VISIBLE_DEVICES=0,1 python main.py \ --model allenai/unifiedqa-t5-base \ --user_msg rationale --img_type detr \ --bs 8 --eval_bs 4 --eval_acc 10 --output_len 512 \ --final_eval --prompt_format QCM-LE \ --evaluate_dir models/MM-CoT-UnifiedQA-base-Rationale # answer inference CUDA_VISIBLE_DEVICES=0,1 python main.py \ --model allenai/unifiedqa-t5-base \ --user_msg answer --img_type detr \ --bs 8 --eval_bs 4 --eval_acc 10 --output_len 64 \ --final_eval --prompt_format QCMG-A \ --eval_le models/rationale/predictions_ans_eval.json \ --test_le models/rationale/predictions_ans_test.json \ --evaluate_dir models/MM-CoT-UnifiedQA-base-Answer
@article{zhang2023multicot, title={Multimodal Chain-of-Thought Reasoning in Language Models}, author={Zhang, Zhuosheng and Zhang, Aston and Li, Mu and Zhao, Hai and Karypis, George and Smola, Alex}, journal={arXiv preprint arXiv:2302.00923}, year={2023} }
このプロジェクトは Apache-2.0 ライセンスの下でライセンスされています。
私たちのコードの一部は、ScienceQAとトランスフォーマーから適応されています。
ScienceQAベースラインのパラメータサイズを提供してくれたPan Luに感謝します。