""" Copyright (c) 2022, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause """ import re from lavis.common.registry import registry from lavis.processors.base_processor import BaseProcessor from lavis.processors.randaugment import RandomAugment from omegaconf import OmegaConf from torchvision import transforms from torchvision.transforms.functional import InterpolationMode import os from itertools import chain import numpy as np import torch from transformers import GPT2Tokenizer SPECIAL_TOKENS_DICT = { "bos_token": "", "eos_token": "", "additional_special_tokens": ["", "", "