본 레포지토리는 한국어 GQA 데이터셋에 특화된 BLIP-2의 학습 및 추론 코드를 제공합니다.
원본 코드는 salesforce의 BLIP-2임을 밝힙니다.
사용자를 위한 AI 모델, 저작권 및 라이센스 세부 정보를 제공합니다.
BLIP-2 모델은 대규모 모델의 종단간(end-to-end) 사전 학습 비용이 점점 더 많이 드는 문제를 해결하기 위해 제안된 비전-언어 사전 학습 전략입니다. 기존에 사전 훈련된 이미지 인코더와 대규모 언어 모델을 그대로 활용(가중치 freeze)하여 비전-언어 표현 학습을 시작합니다.
BLIP-2는 모달리티 간의 간격을 'Querying Transformer'라는 가벼운 변환 모델을 통해 연결합니다. 이는 두 단계의 사전 학습 과정을 거칩니다. 첫 번째 단계에서는 고정된 이미지 인코더로부터 비전-언어 표현 학습을 시작합니다. 두 번째 단계에서는 고정된 언어 모델로부터 비전-언어 생성 학습을 시작하여, 이미지에서 텍스트로의 변환 능력을 배웁니다.
이 모델은 비전-언어 관련 다양한 작업에서 최고의 성능을 달성했음에도 불구하고, 기존의 방법들에 비해 훨씬 적은 수의 학습 가능한 파라미터를 가지고 있습니다.
예를 들어, BLIP-2는 학습 가능한 파라미터가 54배 적음에도 불구하고, 제로샷 VQAv2에서 Flamingo80B 모델보다 8.7% 더 높은 성능을 보여줍니다.
BLIP-2 모델의 대략적인 구조는 아래와 같습니다.
pip3 install -r requirements.txt
python3 preprocess.py
# 단일 GPU를 사용하는 경우:
python3 train.py
# 다중 GPU를 사용하는 경우:
accelerate launch --config_file multi_gpu_config.yaml train_multi.py
output 디렉토리 아래 model_best.pth 이름으로 저장되며 학습 중 갱신됩니다.# 단일 GPU를 사용하는 경우:
python3 test.py
# 다중 GPU를 사용하는 경우:
accelerate launch --config_file multi_gpu_config.yaml test_multi.py
@inproceedings{li2023blip2,
title={{BLIP-2:} Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models},
author={Junnan Li and Dongxu Li and Silvio Savarese and Steven Hoi},
year={2023},
booktitle={ICML},
}
BSD 3-Clause License
Copyright (c) 2022 Salesforce, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Please adhere to the above license terms and conditions when using this model. For any queries or further clarification, feel free to reach out to our support team.
Thank you for choosing our AI model for your applications.
1 commits
Jupyter Notebook
95.0%
Python
5.0%
본 레포지토리는 한국어 GQA 데이터셋에 특화된 BLIP-2의 학습 및 추론 코드를 제공합니다.
원본 코드는 salesforce의 BLIP-2임을 밝힙니다.
사용자를 위한 AI 모델, 저작권 및 라이센스 세부 정보를 제공합니다.
BLIP-2 모델은 대규모 모델의 종단간(end-to-end) 사전 학습 비용이 점점 더 많이 드는 문제를 해결하기 위해 제안된 비전-언어 사전 학습 전략입니다. 기존에 사전 훈련된 이미지 인코더와 대규모 언어 모델을 그대로 활용(가중치 freeze)하여 비전-언어 표현 학습을 시작합니다.
BLIP-2는 모달리티 간의 간격을 'Querying Transformer'라는 가벼운 변환 모델을 통해 연결합니다. 이는 두 단계의 사전 학습 과정을 거칩니다. 첫 번째 단계에서는 고정된 이미지 인코더로부터 비전-언어 표현 학습을 시작합니다. 두 번째 단계에서는 고정된 언어 모델로부터 비전-언어 생성 학습을 시작하여, 이미지에서 텍스트로의 변환 능력을 배웁니다.
이 모델은 비전-언어 관련 다양한 작업에서 최고의 성능을 달성했음에도 불구하고, 기존의 방법들에 비해 훨씬 적은 수의 학습 가능한 파라미터를 가지고 있습니다.
예를 들어, BLIP-2는 학습 가능한 파라미터가 54배 적음에도 불구하고, 제로샷 VQAv2에서 Flamingo80B 모델보다 8.7% 더 높은 성능을 보여줍니다.
BLIP-2 모델의 대략적인 구조는 아래와 같습니다.
pip3 install -r requirements.txt
python3 preprocess.py
# 단일 GPU를 사용하는 경우:
python3 train.py
# 다중 GPU를 사용하는 경우:
accelerate launch --config_file multi_gpu_config.yaml train_multi.py
output 디렉토리 아래 model_best.pth 이름으로 저장되며 학습 중 갱신됩니다.# 단일 GPU를 사용하는 경우:
python3 test.py
# 다중 GPU를 사용하는 경우:
accelerate launch --config_file multi_gpu_config.yaml test_multi.py
@inproceedings{li2023blip2,
title={{BLIP-2:} Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models},
author={Junnan Li and Dongxu Li and Silvio Savarese and Steven Hoi},
year={2023},
booktitle={ICML},
}
BSD 3-Clause License
Copyright (c) 2022 Salesforce, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Please adhere to the above license terms and conditions when using this model. For any queries or further clarification, feel free to reach out to our support team.
Thank you for choosing our AI model for your applications.
1 commits
Jupyter Notebook
95.0%
Python
5.0%