SYMBOL INDEX (1548 symbols across 146 files) FILE: app.py function sevila_demo (line 60) | def sevila_demo(video, FILE: app/__init__.py function load_demo_image (line 16) | def load_demo_image(): FILE: app/calculate_coco_features.py function load_demo_image (line 22) | def load_demo_image(): function read_img (line 31) | def read_img(filepath): FILE: app/caption.py function app (line 15) | def app(): function generate_caption (line 72) | def generate_caption( FILE: app/classification.py function load_demo_image (line 23) | def load_demo_image(img_url=None): function load_model_cache (line 38) | def load_model_cache(model_type, device): function app (line 63) | def app(): FILE: app/dataset_browser.py function sample_dataset (line 26) | def sample_dataset(dataset, indices): function get_concat_v (line 32) | def get_concat_v(im1, im2): function resize_img_w (line 43) | def resize_img_w(raw_img, new_w=224): function get_visual_key (line 58) | def get_visual_key(dataset): function gather_items (line 69) | def gather_items(samples, exclude=[]): function load_dataset_cache (line 84) | def load_dataset_cache(name): function format_text (line 88) | def format_text(text): function show_samples (line 94) | def show_samples(dataset, offset=0, is_next=False): FILE: app/image_text_match.py function app (line 19) | def app(): FILE: app/multimodal_search.py function load_feat (line 34) | def load_feat(): function load_feature_extractor_model (line 61) | def load_feature_extractor_model(device): function app (line 72) | def app(): function read_and_process_images (line 183) | def read_and_process_images(image_paths, vis_processor): function compute_gradcam_batch (line 191) | def compute_gradcam_batch(model, visual_input, text_input, tokenized_tex... FILE: app/multipage.py class MultiPage (line 17) | class MultiPage: method __init__ (line 20) | def __init__(self) -> None: method add_page (line 24) | def add_page(self, title, func) -> None: method run (line 34) | def run(self): FILE: app/text_localization.py function app (line 20) | def app(): FILE: app/utils.py function resize_img (line 18) | def resize_img(raw_img): function read_img (line 25) | def read_img(filepath): function load_model_cache (line 39) | def load_model_cache(name, model_type, is_eval, device): function init_bert_tokenizer (line 44) | def init_bert_tokenizer(): function getAttMap (line 49) | def getAttMap(img, attMap, blur=True, overlap=True): function load_blip_itm_model (line 77) | def load_blip_itm_model(device, model_type="base"): FILE: app/vqa.py function app (line 15) | def app(): FILE: evaluate.py function parse_args (line 33) | def parse_args(): function setup_seeds (line 52) | def setup_seeds(config): function main (line 63) | def main(): FILE: lavis/common/config.py class Config (line 16) | class Config: method __init__ (line 17) | def __init__(self, args): method _validate_runner_config (line 43) | def _validate_runner_config(self, runner_config): method _build_opt_list (line 52) | def _build_opt_list(self, opts): method build_model_config (line 57) | def build_model_config(config, **kwargs): method build_runner_config (line 84) | def build_runner_config(config): method build_dataset_config (line 88) | def build_dataset_config(config): method _convert_to_dot_list (line 114) | def _convert_to_dot_list(self, opts): method get_config (line 128) | def get_config(self): method run_cfg (line 132) | def run_cfg(self): method datasets_cfg (line 136) | def datasets_cfg(self): method model_cfg (line 140) | def model_cfg(self): method pretty_print (line 143) | def pretty_print(self): method _convert_node_to_json (line 161) | def _convert_node_to_json(self, node): method to_dict (line 165) | def to_dict(self): function node_to_dict (line 169) | def node_to_dict(node): class ConfigValidator (line 173) | class ConfigValidator: class _Argument (line 187) | class _Argument: method __init__ (line 188) | def __init__(self, name, choices=None, type=None, help=None): method __str__ (line 195) | def __str__(self): method __init__ (line 205) | def __init__(self, description): method __getitem__ (line 212) | def __getitem__(self, key): method __str__ (line 217) | def __str__(self) -> str: method add_argument (line 220) | def add_argument(self, *args, **kwargs): method validate (line 226) | def validate(self, config=None): method format_arguments (line 248) | def format_arguments(self): method format_help (line 251) | def format_help(self): method print_help (line 256) | def print_help(self): function create_runner_config_validator (line 261) | def create_runner_config_validator(): FILE: lavis/common/dist_utils.py function setup_for_distributed (line 17) | def setup_for_distributed(is_master): function is_dist_avail_and_initialized (line 33) | def is_dist_avail_and_initialized(): function get_world_size (line 41) | def get_world_size(): function get_rank (line 47) | def get_rank(): function is_main_process (line 53) | def is_main_process(): function init_distributed_mode (line 57) | def init_distributed_mode(args): function get_dist_info (line 93) | def get_dist_info(): function main_process (line 107) | def main_process(func): function download_cached_file (line 117) | def download_cached_file(url, check_hash=True, progress=False): FILE: lavis/common/gradcam.py function getAttMap (line 7) | def getAttMap(img, attMap, blur=True, overlap=True): FILE: lavis/common/logger.py class SmoothedValue (line 19) | class SmoothedValue(object): method __init__ (line 24) | def __init__(self, window_size=20, fmt=None): method update (line 32) | def update(self, value, n=1): method synchronize_between_processes (line 37) | def synchronize_between_processes(self): method median (line 51) | def median(self): method avg (line 56) | def avg(self): method global_avg (line 61) | def global_avg(self): method max (line 65) | def max(self): method value (line 69) | def value(self): method __str__ (line 72) | def __str__(self): class MetricLogger (line 82) | class MetricLogger(object): method __init__ (line 83) | def __init__(self, delimiter="\t"): method update (line 87) | def update(self, **kwargs): method __getattr__ (line 94) | def __getattr__(self, attr): method __str__ (line 103) | def __str__(self): method global_avg (line 109) | def global_avg(self): method synchronize_between_processes (line 115) | def synchronize_between_processes(self): method add_meter (line 119) | def add_meter(self, name, meter): method log_every (line 122) | def log_every(self, iterable, print_freq, header=None): class AttrDict (line 184) | class AttrDict(dict): method __init__ (line 185) | def __init__(self, *args, **kwargs): function setup_logger (line 190) | def setup_logger(): FILE: lavis/common/optims.py class LinearWarmupStepLRScheduler (line 14) | class LinearWarmupStepLRScheduler: method __init__ (line 15) | def __init__( method step (line 37) | def step(self, cur_epoch, cur_step): class LinearWarmupCosineLRScheduler (line 57) | class LinearWarmupCosineLRScheduler: method __init__ (line 58) | def __init__( method step (line 77) | def step(self, cur_epoch, cur_step): function cosine_lr_schedule (line 97) | def cosine_lr_schedule(optimizer, epoch, max_epoch, init_lr, min_lr): function warmup_lr_schedule (line 106) | def warmup_lr_schedule(optimizer, step, max_step, init_lr, max_lr): function step_lr_schedule (line 113) | def step_lr_schedule(optimizer, epoch, init_lr, min_lr, decay_rate): FILE: lavis/common/registry.py class Registry (line 9) | class Registry: method register_builder (line 22) | def register_builder(cls, name): method register_task (line 54) | def register_task(cls, name): method register_model (line 83) | def register_model(cls, name): method register_processor (line 112) | def register_processor(cls, name): method register_lr_scheduler (line 141) | def register_lr_scheduler(cls, name): method register_runner (line 165) | def register_runner(cls, name): method register_path (line 189) | def register_path(cls, name, path): method register (line 205) | def register(cls, name, obj): method get_builder_class (line 232) | def get_builder_class(cls, name): method get_model_class (line 236) | def get_model_class(cls, name): method get_task_class (line 240) | def get_task_class(cls, name): method get_processor_class (line 244) | def get_processor_class(cls, name): method get_lr_scheduler_class (line 248) | def get_lr_scheduler_class(cls, name): method get_runner_class (line 252) | def get_runner_class(cls, name): method list_runners (line 256) | def list_runners(cls): method list_models (line 260) | def list_models(cls): method list_tasks (line 264) | def list_tasks(cls): method list_processors (line 268) | def list_processors(cls): method list_lr_schedulers (line 272) | def list_lr_schedulers(cls): method list_datasets (line 276) | def list_datasets(cls): method get_path (line 280) | def get_path(cls, name): method get (line 284) | def get(cls, name, default=None, no_warning=False): method unregister (line 315) | def unregister(cls, name): FILE: lavis/common/utils.py function now (line 35) | def now(): function is_url (line 41) | def is_url(url_or_filename): function get_cache_path (line 46) | def get_cache_path(rel_path): function get_abs_path (line 50) | def get_abs_path(rel_path): function load_json (line 54) | def load_json(filename): function makedir (line 64) | def makedir(dir_path): function get_redirected_url (line 78) | def get_redirected_url(url: str): function to_google_drive_download_url (line 93) | def to_google_drive_download_url(view_url: str) -> str: function download_google_drive_url (line 108) | def download_google_drive_url(url: str, output_path: str, output_file_na... function _get_google_drive_file_id (line 141) | def _get_google_drive_file_id(url: str) -> Optional[str]: function _urlretrieve (line 154) | def _urlretrieve(url: str, filename: str, chunk_size: int = 1024) -> None: function download_url (line 167) | def download_url( function download_and_extract_archive (line 221) | def download_and_extract_archive( function cache_url (line 242) | def cache_url(url: str, cache_dir: str) -> str: function create_file_symlink (line 261) | def create_file_symlink(file1, file2): function save_file (line 275) | def save_file(data, filename, append_to_json=True, verbose=True): function load_file (line 313) | def load_file(filename, mmap_mode=None, verbose=True, allow_pickle=False): function abspath (line 374) | def abspath(resource_path: str): function makedir (line 386) | def makedir(dir_path): function is_url (line 400) | def is_url(input_url): function cleanup_dir (line 408) | def cleanup_dir(dir): function get_file_size (line 419) | def get_file_size(filename): FILE: lavis/common/vqa_tools/vqa.py class VQA (line 31) | class VQA: method __init__ (line 32) | def __init__(self, annotation_file=None, question_file=None): method createIndex (line 53) | def createIndex(self): method info (line 71) | def info(self): method getQuesIds (line 79) | def getQuesIds(self, imgIds=[], quesTypes=[], ansTypes=[]): method getImgIds (line 114) | def getImgIds(self, quesIds=[], quesTypes=[], ansTypes=[]): method loadQA (line 148) | def loadQA(self, ids=[]): method showQA (line 159) | def showQA(self, anns): method loadRes (line 173) | def loadRes(self, resFile, quesFile): FILE: lavis/common/vqa_tools/vqa_eval.py class VQAEval (line 18) | class VQAEval: method __init__ (line 19) | def __init__(self, vqa=None, vqaRes=None, n=2): method evaluate (line 193) | def evaluate(self, quesIds=None): method processPunctuation (line 249) | def processPunctuation(self, inText): method processDigitArticle (line 261) | def processDigitArticle(self, inText): method setAccuracy (line 276) | def setAccuracy(self, accQA, accQuesType, accAnsType): method setEvalQA (line 292) | def setEvalQA(self, quesId, acc): method setEvalQuesType (line 295) | def setEvalQuesType(self, quesId, quesType, acc): method setEvalAnsType (line 300) | def setEvalAnsType(self, quesId, ansType, acc): method updateProgress (line 305) | def updateProgress(self, progress): FILE: lavis/datasets/builders/__init__.py function load_dataset (line 79) | def load_dataset(name, cfg_path=None, vis_path=None, data_type=None): class DatasetZoo (line 117) | class DatasetZoo: method __init__ (line 118) | def __init__(self) -> None: method get_names (line 124) | def get_names(self): FILE: lavis/datasets/builders/base_dataset_builder.py class BaseDatasetBuilder (line 23) | class BaseDatasetBuilder: method __init__ (line 26) | def __init__(self, cfg=None): method build_datasets (line 42) | def build_datasets(self): method build_processors (line 58) | def build_processors(self): method _build_proc_from_cfg (line 77) | def _build_proc_from_cfg(cfg): method default_config_path (line 85) | def default_config_path(cls, type="default"): method _download_data (line 88) | def _download_data(self): method _download_ann (line 92) | def _download_ann(self): method _download_vis (line 149) | def _download_vis(self): method build (line 163) | def build(self): function load_dataset_config (line 229) | def load_dataset_config(cfg_path): FILE: lavis/datasets/builders/caption_builder.py class COCOCapBuilder (line 22) | class COCOCapBuilder(BaseDatasetBuilder): class COCOCapBuilder (line 32) | class COCOCapBuilder(BaseDatasetBuilder): class MSRVTTCapBuilder (line 41) | class MSRVTTCapBuilder(BaseDatasetBuilder): class MSVDCapBuilder (line 51) | class MSVDCapBuilder(BaseDatasetBuilder): class VATEXCapBuilder (line 61) | class VATEXCapBuilder(BaseDatasetBuilder): FILE: lavis/datasets/builders/classification_builder.py class NLVRBuilder (line 15) | class NLVRBuilder(BaseDatasetBuilder): class SNLIVisualEntailmentBuilder (line 23) | class SNLIVisualEntailmentBuilder(BaseDatasetBuilder): FILE: lavis/datasets/builders/dialogue_builder.py class AVSDDialBuilder (line 17) | class AVSDDialBuilder(BaseDatasetBuilder): FILE: lavis/datasets/builders/image_text_pair_builder.py class ConceptualCaption3MBuilder (line 17) | class ConceptualCaption3MBuilder(BaseDatasetBuilder): class ConceptualCaption12MBuilder (line 26) | class ConceptualCaption12MBuilder(BaseDatasetBuilder): class SBUCaptionBuilder (line 35) | class SBUCaptionBuilder(BaseDatasetBuilder): class VGCaptionBuilder (line 42) | class VGCaptionBuilder(BaseDatasetBuilder): class Laion2BMultiBuilder (line 49) | class Laion2BMultiBuilder(BaseDatasetBuilder): method _download_ann (line 54) | def _download_ann(self): method _download_vis (line 57) | def _download_vis(self): method build (line 60) | def build(self): FILE: lavis/datasets/builders/imagefolder_builder.py class ImageNetBuilder (line 16) | class ImageNetBuilder(BaseDatasetBuilder): method _download_ann (line 22) | def _download_ann(self): method build (line 25) | def build(self): FILE: lavis/datasets/builders/retrieval_builder.py class MSRVTTRetrievalBuilder (line 20) | class MSRVTTRetrievalBuilder(BaseDatasetBuilder): class DiDeMoRetrievalBuilder (line 28) | class DiDeMoRetrievalBuilder(BaseDatasetBuilder): class COCORetrievalBuilder (line 36) | class COCORetrievalBuilder(BaseDatasetBuilder): class Flickr30kBuilder (line 44) | class Flickr30kBuilder(BaseDatasetBuilder): FILE: lavis/datasets/builders/video_qa_builder.py class VideoQABuilder (line 14) | class VideoQABuilder(BaseDatasetBuilder): method build (line 18) | def build(self): class MCVideoQABuilder (line 32) | class MCVideoQABuilder(BaseDatasetBuilder): method build (line 36) | def build(self): class MSRVTTQABuilder (line 45) | class MSRVTTQABuilder(VideoQABuilder): class MSVDQABuilder (line 52) | class MSVDQABuilder(VideoQABuilder): class NextQABuilder (line 59) | class NextQABuilder(MCVideoQABuilder): class STARBuilder (line 64) | class STARBuilder(MCVideoQABuilder): class TVQABuilder (line 70) | class TVQABuilder(MCVideoQABuilder): class How2QABuilder (line 76) | class How2QABuilder(MCVideoQABuilder): class VLEPBuilder (line 82) | class VLEPBuilder(MCVideoQABuilder): class QVHBuilder (line 88) | class QVHBuilder(MCVideoQABuilder): FILE: lavis/datasets/builders/vqa_builder.py class COCOVQABuilder (line 18) | class COCOVQABuilder(BaseDatasetBuilder): class VGVQABuilder (line 29) | class VGVQABuilder(BaseDatasetBuilder): class OKVQABuilder (line 35) | class OKVQABuilder(COCOVQABuilder): class AOKVQABuilder (line 42) | class AOKVQABuilder(BaseDatasetBuilder): class GQABuilder (line 50) | class GQABuilder(BaseDatasetBuilder): FILE: lavis/datasets/data_utils.py function load_video (line 29) | def load_video(video_path, n_frms=MAX_INT, height=-1, width=-1, sampling... function load_video_demo (line 74) | def load_video_demo(video_path, n_frms=MAX_INT, height=-1, width=-1, sam... function apply_to_sample (line 123) | def apply_to_sample(f, sample): function move_to_cuda (line 140) | def move_to_cuda(sample): function prepare_sample (line 147) | def prepare_sample(samples, cuda_enabled=True): function reorg_datasets_by_split (line 156) | def reorg_datasets_by_split(datasets): function concat_datasets (line 182) | def concat_datasets(datasets): function extract_archive (line 249) | def extract_archive(from_path, to_path=None, overwrite=False): function save_frames_grid (line 331) | def save_frames_grid(img_array, out_path): FILE: lavis/datasets/datasets/aok_vqa_datasets.py class __DisplMixin (line 18) | class __DisplMixin: method displ_item (line 19) | def displ_item(self, index): class AOKVQADataset (line 34) | class AOKVQADataset(VQADataset, __DisplMixin): method __init__ (line 35) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 38) | def __getitem__(self, index): class AOKVQAEvalDataset (line 67) | class AOKVQAEvalDataset(VQAEvalDataset, __DisplMixin): method __init__ (line 68) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method collater (line 96) | def collater(self, samples): method __getitem__ (line 126) | def __getitem__(self, index): FILE: lavis/datasets/datasets/avsd_dialogue_datasets.py class AVSDDialDataset (line 15) | class AVSDDialDataset(DialogueDataset): method __init__ (line 16) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 24) | def __getitem__(self, index): method collater (line 45) | def collater(self, samples): class AVSDDialEvalDataset (line 92) | class AVSDDialEvalDataset(DialogueEvalDataset): method __init__ (line 93) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 101) | def __getitem__(self, index): method collater (line 122) | def collater(self, samples): FILE: lavis/datasets/datasets/base_dataset.py class BaseDataset (line 16) | class BaseDataset(Dataset): method __init__ (line 17) | def __init__( method __len__ (line 44) | def __len__(self): method collater (line 47) | def collater(self, samples): method set_processors (line 50) | def set_processors(self, vis_processor, text_processor): method _add_instance_ids (line 54) | def _add_instance_ids(self, key="instance_id"): class ConcatDataset (line 62) | class ConcatDataset(ConcatDataset): method __init__ (line 63) | def __init__(self, datasets: Iterable[Dataset]) -> None: method collater (line 66) | def collater(self, samples): FILE: lavis/datasets/datasets/caption_datasets.py class __DisplMixin (line 15) | class __DisplMixin: method displ_item (line 16) | def displ_item(self, index): class CaptionDataset (line 28) | class CaptionDataset(BaseDataset, __DisplMixin): method __init__ (line 29) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 44) | def __getitem__(self, index): class CaptionEvalDataset (line 62) | class CaptionEvalDataset(BaseDataset, __DisplMixin): method __init__ (line 63) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 71) | def __getitem__(self, index): FILE: lavis/datasets/datasets/coco_caption_datasets.py class COCOCapEvalDataset (line 21) | class COCOCapEvalDataset(CaptionEvalDataset): method __init__ (line 22) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 30) | def __getitem__(self, index): class NoCapsEvalDataset (line 47) | class NoCapsEvalDataset(CaptionEvalDataset): method __init__ (line 48) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 56) | def __getitem__(self, index): FILE: lavis/datasets/datasets/coco_vqa_datasets.py class __DisplMixin (line 18) | class __DisplMixin: method displ_item (line 19) | def displ_item(self, index): class COCOVQADataset (line 33) | class COCOVQADataset(VQADataset, __DisplMixin): method __init__ (line 34) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 37) | def __getitem__(self, index): class COCOVQAEvalDataset (line 64) | class COCOVQAEvalDataset(VQAEvalDataset, __DisplMixin): method __init__ (line 65) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 93) | def __getitem__(self, index): FILE: lavis/datasets/datasets/dataloader_utils.py class MultiIterLoader (line 15) | class MultiIterLoader: method __init__ (line 24) | def __init__(self, loaders, ratios=None): method __next__ (line 40) | def __next__(self): class PrefetchLoader (line 46) | class PrefetchLoader(object): method __init__ (line 54) | def __init__(self, loader): method __iter__ (line 58) | def __iter__(self): method __len__ (line 73) | def __len__(self): method preload (line 76) | def preload(self, it): method next (line 101) | def next(self, it): method __getattr__ (line 109) | def __getattr__(self, name): function record_cuda_stream (line 114) | def record_cuda_stream(batch): class IterLoader (line 127) | class IterLoader: method __init__ (line 135) | def __init__(self, dataloader: DataLoader, use_distributed: bool = Fal... method epoch (line 142) | def epoch(self) -> int: method __next__ (line 145) | def __next__(self): method __iter__ (line 158) | def __iter__(self): method __len__ (line 161) | def __len__(self): FILE: lavis/datasets/datasets/dialogue_datasets.py class __DisplMixin (line 19) | class __DisplMixin: method displ_item (line 20) | def displ_item(self, index): class DialogueDataset (line 32) | class DialogueDataset(BaseDataset, __DisplMixin): method __init__ (line 33) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 71) | def __getitem__(self, index): class DialogueEvalDataset (line 88) | class DialogueEvalDataset(BaseDataset, __DisplMixin): method __init__ (line 89) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 128) | def __getitem__(self, index): FILE: lavis/datasets/datasets/gqa_datasets.py class __DisplMixin (line 18) | class __DisplMixin: method displ_item (line 19) | def displ_item(self, index): class GQADataset (line 33) | class GQADataset(VQADataset, __DisplMixin): method __init__ (line 34) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 37) | def __getitem__(self, index): class GQAEvalDataset (line 57) | class GQAEvalDataset(VQAEvalDataset, __DisplMixin): method __init__ (line 58) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 80) | def __getitem__(self, index): FILE: lavis/datasets/datasets/image_text_pair_datasets.py class __DisplMixin (line 15) | class __DisplMixin: method displ_item (line 16) | def displ_item(self, index): class ImageTextPairDataset (line 28) | class ImageTextPairDataset(BaseDataset, __DisplMixin): method __init__ (line 29) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 36) | def __getitem__(self, index): FILE: lavis/datasets/datasets/imagefolder_dataset.py class ImageFolderDataset (line 16) | class ImageFolderDataset(BaseDataset): method __init__ (line 17) | def __init__(self, vis_processor, vis_root, classnames=[], **kwargs): method __len__ (line 31) | def __len__(self): method __getitem__ (line 34) | def __getitem__(self, index): method displ_item (line 50) | def displ_item(self, index): FILE: lavis/datasets/datasets/laion_dataset.py class LaionDataset (line 12) | class LaionDataset(BaseDataset): method __init__ (line 13) | def __init__(self, vis_processor, text_processor, location): method to_dict (line 26) | def to_dict(self, sample): function to_image_text_pair (line 36) | def to_image_text_pair(sample): FILE: lavis/datasets/datasets/mc_video_vqa_datasets.py class __DisplMixin (line 18) | class __DisplMixin: method displ_item (line 19) | def displ_item(self, index): class MCVideoQADataset (line 30) | class MCVideoQADataset(MultimodalClassificationDataset, __DisplMixin): method __init__ (line 31) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method _load_auxiliary_mappings (line 34) | def _load_auxiliary_mappings(self): method _get_answer_label (line 37) | def _get_answer_label(self, answer): method __getitem__ (line 43) | def __getitem__(self, index): FILE: lavis/datasets/datasets/multimodal_classification_datasets.py class MultimodalClassificationDataset (line 12) | class MultimodalClassificationDataset(BaseDataset): method __init__ (line 13) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method _build_class_labels (line 19) | def _build_class_labels(self): method _load_auxiliary_mappings (line 23) | def _load_auxiliary_mappings(self): FILE: lavis/datasets/datasets/nlvr_datasets.py class __DisplMixin (line 19) | class __DisplMixin: method displ_item (line 20) | def displ_item(self, index): class NLVRDataset (line 34) | class NLVRDataset(MultimodalClassificationDataset, __DisplMixin): method __init__ (line 35) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method _build_class_labels (line 40) | def _build_class_labels(self): method _flip (line 44) | def _flip(samples): method __getitem__ (line 65) | def __getitem__(self, index): class NLVREvalDataset (line 91) | class NLVREvalDataset(NLVRDataset): method _flip (line 93) | def _flip(samples): FILE: lavis/datasets/datasets/retrieval_datasets.py class __DisplMixin (line 15) | class __DisplMixin: method displ_item (line 16) | def displ_item(self, index): class RetrievalDataset (line 29) | class RetrievalDataset(BaseDataset, __DisplMixin): method __init__ (line 30) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 45) | def __getitem__(self, index): class RetrievalEvalDataset (line 63) | class RetrievalEvalDataset(BaseDataset, __DisplMixin): method __init__ (line 64) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 88) | def __getitem__(self, index): class VideoRetrievalDataset (line 98) | class VideoRetrievalDataset(BaseDataset, __DisplMixin): method __init__ (line 99) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 114) | def __getitem__(self, index): class VideoRetrievalEvalDataset (line 131) | class VideoRetrievalEvalDataset(BaseDataset, __DisplMixin): method __init__ (line 132) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 156) | def __getitem__(self, index): FILE: lavis/datasets/datasets/snli_ve_datasets.py class __DisplMixin (line 17) | class __DisplMixin: method displ_item (line 18) | def displ_item(self, index): class SNLIVisualEntialmentDataset (line 31) | class SNLIVisualEntialmentDataset(MultimodalClassificationDataset, __Dis... method __init__ (line 32) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method _build_class_labels (line 37) | def _build_class_labels(self): method __getitem__ (line 40) | def __getitem__(self, index): FILE: lavis/datasets/datasets/vg_vqa_datasets.py class VGVQADataset (line 15) | class VGVQADataset(VQADataset): method __init__ (line 16) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 19) | def __getitem__(self, index): FILE: lavis/datasets/datasets/video_caption_datasets.py class VideoCaptionDataset (line 14) | class VideoCaptionDataset(CaptionDataset): method __init__ (line 15) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 23) | def __getitem__(self, index): class VideoCaptionEvalDataset (line 41) | class VideoCaptionEvalDataset(BaseDataset): method __init__ (line 42) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method __getitem__ (line 50) | def __getitem__(self, index): FILE: lavis/datasets/datasets/video_vqa_datasets.py class __DisplMixin (line 17) | class __DisplMixin: method displ_item (line 18) | def displ_item(self, index): class VideoQADataset (line 28) | class VideoQADataset(MultimodalClassificationDataset, __DisplMixin): method __init__ (line 29) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method _build_class_labels (line 32) | def _build_class_labels(self, ans_path): method _get_answer_label (line 37) | def _get_answer_label(self, answer): method __getitem__ (line 43) | def __getitem__(self, index): FILE: lavis/datasets/datasets/vqa_datasets.py class VQADataset (line 13) | class VQADataset(BaseDataset): method __init__ (line 14) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): method collater (line 17) | def collater(self, samples): class VQAEvalDataset (line 42) | class VQAEvalDataset(BaseDataset): method __init__ (line 43) | def __init__(self, vis_processor, text_processor, vis_root, ann_paths): FILE: lavis/datasets/download_scripts/DownloadConceptualCaptions/download_data_cc12m.py function _df_split_apply (line 34) | def _df_split_apply(tup_arg): function df_multiprocess (line 40) | def df_multiprocess(df, processes, chunk_size, func, dataset_name): function _file_name (line 82) | def _file_name(row): function check_mimetype (line 97) | def check_mimetype(row): function check_download (line 106) | def check_download(row): function resize_img (line 124) | def resize_img(req): function download_image (line 134) | def download_image(row): function open_tsv (line 174) | def open_tsv(fname, folder): function df_from_shelve (line 184) | def df_from_shelve(chunk_size, func, dataset_name): FILE: lavis/datasets/download_scripts/DownloadConceptualCaptions/download_data_cc3m.py function _df_split_apply (line 34) | def _df_split_apply(tup_arg): function df_multiprocess (line 40) | def df_multiprocess(df, processes, chunk_size, func, dataset_name): function _file_name (line 82) | def _file_name(row): function check_mimetype (line 97) | def check_mimetype(row): function check_download (line 106) | def check_download(row): function resize_img (line 124) | def resize_img(req): function download_image (line 134) | def download_image(row): function open_tsv (line 174) | def open_tsv(fname, folder): function df_from_shelve (line 184) | def df_from_shelve(chunk_size, func, dataset_name): FILE: lavis/datasets/download_scripts/download_coco.py function download_datasets (line 29) | def download_datasets(root, url): FILE: lavis/datasets/download_scripts/download_didemo.py function download_datasets (line 23) | def download_datasets(root, url): function move_files (line 31) | def move_files(download_path, storage_path): FILE: lavis/datasets/download_scripts/download_flickr.py function move_directory (line 32) | def move_directory(src_dir, dst_dir): FILE: lavis/datasets/download_scripts/download_gqa.py function download_datasets (line 24) | def download_datasets(root, url): FILE: lavis/datasets/download_scripts/download_msrvtt.py function download_datasets (line 38) | def download_datasets(root, url): function merge_datasets (line 46) | def merge_datasets(download_path, storage_path): FILE: lavis/datasets/download_scripts/download_msvd.py function download_datasets (line 24) | def download_datasets(root, url): function move_files (line 28) | def move_files(download_path, storage_path): FILE: lavis/datasets/download_scripts/download_nocaps.py function download_file (line 39) | def download_file(url, filename): function download_image_from_url_val (line 63) | def download_image_from_url_val(url): function download_image_from_url_test (line 70) | def download_image_from_url_test(url): FILE: lavis/datasets/download_scripts/download_sbu.py function fetch_single_image (line 28) | def fetch_single_image(image_url, timeout=None, retries=0): function download_and_save_image (line 44) | def download_and_save_image(ann, save_dir, timeout=None, retries=0): FILE: lavis/datasets/download_scripts/download_vg.py function download_datasets (line 27) | def download_datasets(root, url): FILE: lavis/models/__init__.py function load_model (line 91) | def load_model(name, model_type, is_eval=False, device="cpu", checkpoint... function load_preprocess (line 125) | def load_preprocess(config): function load_model_and_preprocess (line 177) | def load_model_and_preprocess(name, model_type, is_eval=False, device="c... class ModelZoo (line 226) | class ModelZoo: method __init__ (line 237) | def __init__(self) -> None: method __str__ (line 243) | def __str__(self) -> str: method __iter__ (line 258) | def __iter__(self): method __len__ (line 261) | def __len__(self): FILE: lavis/models/albef_models/__init__.py class AlbefBase (line 25) | class AlbefBase(BaseModel): method init_tokenizer (line 27) | def init_tokenizer(cls): method load_from_pretrained (line 30) | def load_from_pretrained(self, url_or_filename, rename_text_keys=True): function compute_sim_matrix (line 76) | def compute_sim_matrix(model, data_loader, **kwargs): FILE: lavis/models/albef_models/albef_classification.py class AlbefClassification (line 26) | class AlbefClassification(AlbefBase, MomentumDistilationMixin): method __init__ (line 31) | def __init__( method _rampup_factor (line 80) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 83) | def forward(self, samples, is_train=True): method predict (line 149) | def predict(self, samples): method from_config (line 154) | def from_config(cls, cfg=None): FILE: lavis/models/albef_models/albef_feature_extractor.py class AlbefFeatureExtractor (line 23) | class AlbefFeatureExtractor(AlbefBase): method __init__ (line 28) | def __init__(self, image_encoder, text_encoder, embed_dim=256, max_txt... method extract_features (line 49) | def extract_features(self, samples, mode="multimodal"): method from_config (line 175) | def from_config(cls, cfg=None): FILE: lavis/models/albef_models/albef_nlvr.py class AlbefNLVR (line 24) | class AlbefNLVR(AlbefBase, MomentumDistilationMixin): method __init__ (line 29) | def __init__( method _rampup_factor (line 76) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 79) | def forward(self, samples, is_train=True): method share_cross_attention (line 198) | def share_cross_attention(self, model): method predict (line 213) | def predict(self, samples): method load_from_pretrained (line 217) | def load_from_pretrained(self, url_or_filename, use_distill=True): method from_config (line 227) | def from_config(cls, cfg=None): FILE: lavis/models/albef_models/albef_outputs.py class AlbefSimilarity (line 20) | class AlbefSimilarity(ModelOutput): class AlbefIntermediateOutput (line 32) | class AlbefIntermediateOutput(ModelOutput): class AlbefOutput (line 54) | class AlbefOutput(ModelOutput): class AlbefOutputWithLogits (line 70) | class AlbefOutputWithLogits(AlbefOutput): class AlbefOutputFeatures (line 76) | class AlbefOutputFeatures(ModelOutput): FILE: lavis/models/albef_models/albef_pretrain.py class AlbefPretrain (line 29) | class AlbefPretrain(AlbefBase, MomentumDistilationMixin, SharedQueueMixin): method __init__ (line 41) | def __init__( method _rampup_factor (line 102) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 105) | def forward(self, samples): method mask (line 341) | def mask( method from_config (line 386) | def from_config(cls, cfg=None): FILE: lavis/models/albef_models/albef_retrieval.py class AlbefRetrieval (line 26) | class AlbefRetrieval(AlbefBase, MomentumDistilationMixin, SharedQueueMix... method __init__ (line 45) | def __init__( method _rampup_factor (line 104) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 107) | def forward(self, samples): method from_config (line 310) | def from_config(cls, cfg=None): method compute_sim_matrix (line 338) | def compute_sim_matrix(self, data_loader, task_cfg): FILE: lavis/models/albef_models/albef_vqa.py class AlbefVQA (line 25) | class AlbefVQA(AlbefBase, MomentumDistilationMixin): method __init__ (line 42) | def __init__( method _rampup_factor (line 80) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 83) | def forward(self, samples): method forward_encoder (line 137) | def forward_encoder(self, samples): method forward_decoder (line 167) | def forward_decoder(self, samples, encoder_out, **kwargs): method predict_answers (line 228) | def predict_answers(self, samples, answer_list, num_ans_candidates=128... method rank_answers (line 269) | def rank_answers(self, samples, answer_list, num_ans_candidates): method from_config (line 349) | def from_config(cls, cfg=None): method load_from_pretrained (line 381) | def load_from_pretrained(self, url_or_filename): FILE: lavis/models/alpro_models/__init__.py class AlproBase (line 19) | class AlproBase(BaseModel): method init_tokenizer (line 21) | def init_tokenizer(cls): method load_from_pretrained (line 24) | def load_from_pretrained(self, url_or_filename, num_frames, num_patches): function resize_spatial_embedding (line 78) | def resize_spatial_embedding(state_dict, key, num_patches): function resize_temporal_embedding (line 95) | def resize_temporal_embedding(state_dict, key, num_frames): FILE: lavis/models/alpro_models/alpro_outputs.py class AlproSimilarity (line 19) | class AlproSimilarity(ModelOutput): class AlproIntermediateOutput (line 28) | class AlproIntermediateOutput(ModelOutput): class AlproOutput (line 42) | class AlproOutput(ModelOutput): class AlproOutputWithLogits (line 58) | class AlproOutputWithLogits(AlproOutput): FILE: lavis/models/alpro_models/alpro_qa.py class AlproQA (line 25) | class AlproQA(AlproBase): method __init__ (line 31) | def __init__( method forward (line 53) | def forward(self, samples, is_train=True): method predict (line 109) | def predict(self, samples): method from_config (line 114) | def from_config(cls, cfg): FILE: lavis/models/alpro_models/alpro_retrieval.py class AlproRetrieval (line 30) | class AlproRetrieval(AlproBase): method __init__ (line 36) | def __init__( method forward (line 65) | def forward(self, samples): method compute_vtm (line 150) | def compute_vtm( method compute_sim_matrix (line 242) | def compute_sim_matrix(self, data_loader, task_cfg): method from_config (line 397) | def from_config(cls, cfg): FILE: lavis/models/base_model.py class BaseModel (line 19) | class BaseModel(nn.Module): method __init__ (line 22) | def __init__(self): method device (line 26) | def device(self): method load_checkpoint (line 29) | def load_checkpoint(self, url_or_filename): method from_pretrained (line 59) | def from_pretrained(cls, model_type): method default_config_path (line 75) | def default_config_path(cls, model_type): method load_checkpoint_from_config (line 81) | def load_checkpoint_from_config(self, cfg, **kwargs): method before_evaluation (line 102) | def before_evaluation(self, **kwargs): method show_n_params (line 105) | def show_n_params(self, return_str=True): class BaseEncoder (line 121) | class BaseEncoder(nn.Module): method __init__ (line 126) | def __init__(self): method forward_features (line 129) | def forward_features(self, samples, **kwargs): method device (line 133) | def device(self): class SharedQueueMixin (line 137) | class SharedQueueMixin: method _dequeue_and_enqueue (line 139) | def _dequeue_and_enqueue(self, image_feat, text_feat, idxs=None): class MomentumDistilationMixin (line 161) | class MomentumDistilationMixin: method copy_params (line 163) | def copy_params(self): method _momentum_update (line 172) | def _momentum_update(self): class GatherLayer (line 182) | class GatherLayer(torch.autograd.Function): method forward (line 189) | def forward(ctx, x): method backward (line 197) | def backward(ctx, *grads): function all_gather_with_grad (line 203) | def all_gather_with_grad(tensors): function concat_all_gather (line 221) | def concat_all_gather(tensor): function tile (line 239) | def tile(x, dim, n_tile): FILE: lavis/models/blip2_models/Qformer.py class BertEmbeddings (line 51) | class BertEmbeddings(nn.Module): method __init__ (line 54) | def __init__(self, config): method forward (line 78) | def forward( class BertSelfAttention (line 111) | class BertSelfAttention(nn.Module): method __init__ (line 112) | def __init__(self, config, is_cross_attention): method save_attn_gradients (line 149) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 152) | def get_attn_gradients(self): method save_attention_map (line 155) | def save_attention_map(self, attention_map): method get_attention_map (line 158) | def get_attention_map(self): method transpose_for_scores (line 161) | def transpose_for_scores(self, x): method forward (line 169) | def forward( class BertSelfOutput (line 278) | class BertSelfOutput(nn.Module): method __init__ (line 279) | def __init__(self, config): method forward (line 285) | def forward(self, hidden_states, input_tensor): class BertAttention (line 292) | class BertAttention(nn.Module): method __init__ (line 293) | def __init__(self, config, is_cross_attention=False): method prune_heads (line 299) | def prune_heads(self, heads): method forward (line 322) | def forward( class BertIntermediate (line 349) | class BertIntermediate(nn.Module): method __init__ (line 350) | def __init__(self, config): method forward (line 358) | def forward(self, hidden_states): class BertOutput (line 364) | class BertOutput(nn.Module): method __init__ (line 365) | def __init__(self, config): method forward (line 371) | def forward(self, hidden_states, input_tensor): class BertLayer (line 378) | class BertLayer(nn.Module): method __init__ (line 379) | def __init__(self, config, layer_num): method forward (line 402) | def forward( method feed_forward_chunk (line 476) | def feed_forward_chunk(self, attention_output): method feed_forward_chunk_query (line 481) | def feed_forward_chunk_query(self, attention_output): class BertEncoder (line 487) | class BertEncoder(nn.Module): method __init__ (line 488) | def __init__(self, config): method forward (line 495) | def forward( class BertPooler (line 592) | class BertPooler(nn.Module): method __init__ (line 593) | def __init__(self, config): method forward (line 598) | def forward(self, hidden_states): class BertPredictionHeadTransform (line 607) | class BertPredictionHeadTransform(nn.Module): method __init__ (line 608) | def __init__(self, config): method forward (line 617) | def forward(self, hidden_states): class BertLMPredictionHead (line 624) | class BertLMPredictionHead(nn.Module): method __init__ (line 625) | def __init__(self, config): method forward (line 638) | def forward(self, hidden_states): class BertOnlyMLMHead (line 644) | class BertOnlyMLMHead(nn.Module): method __init__ (line 645) | def __init__(self, config): method forward (line 649) | def forward(self, sequence_output): class BertPreTrainedModel (line 654) | class BertPreTrainedModel(PreTrainedModel): method _init_weights (line 664) | def _init_weights(self, module): class BertModel (line 677) | class BertModel(BertPreTrainedModel): method __init__ (line 687) | def __init__(self, config, add_pooling_layer=False): method get_input_embeddings (line 699) | def get_input_embeddings(self): method set_input_embeddings (line 702) | def set_input_embeddings(self, value): method _prune_heads (line 705) | def _prune_heads(self, heads_to_prune): method get_extended_attention_mask (line 713) | def get_extended_attention_mask( method forward (line 804) | def forward( class BertLMHeadModel (line 968) | class BertLMHeadModel(BertPreTrainedModel): method __init__ (line 973) | def __init__(self, config): method get_output_embeddings (line 981) | def get_output_embeddings(self): method set_output_embeddings (line 984) | def set_output_embeddings(self, new_embeddings): method forward (line 987) | def forward( method prepare_inputs_for_generation (line 1097) | def prepare_inputs_for_generation( method _reorder_cache (line 1120) | def _reorder_cache(self, past, beam_idx): class BertForMaskedLM (line 1131) | class BertForMaskedLM(BertPreTrainedModel): method __init__ (line 1136) | def __init__(self, config): method get_output_embeddings (line 1144) | def get_output_embeddings(self): method set_output_embeddings (line 1147) | def set_output_embeddings(self, new_embeddings): method forward (line 1150) | def forward( FILE: lavis/models/blip2_models/blip2.py class Blip2Base (line 27) | class Blip2Base(BaseModel): method init_tokenizer (line 29) | def init_tokenizer(cls): method init_Qformer (line 35) | def init_Qformer(cls, num_query_token, vision_width): method init_TemporalQFormer (line 52) | def init_TemporalQFormer(cls, num_of_frame): method init_vision_encoder (line 65) | def init_vision_encoder( method init_vision_encoder_sevila (line 75) | def init_vision_encoder_sevila( method load_from_pretrained (line 85) | def load_from_pretrained(self, url_or_filename): method load_qformer_loc (line 105) | def load_qformer_loc(self): function disabled_train (line 112) | def disabled_train(self, mode=True): class LayerNorm (line 118) | class LayerNorm(nn.LayerNorm): method forward (line 121) | def forward(self, x: torch.Tensor): function compute_sim_matrix (line 127) | def compute_sim_matrix(model, data_loader, **kwargs): FILE: lavis/models/blip2_models/blip2_fmr.py class Blip2FMR (line 20) | class Blip2FMR(Blip2Base): method __init__ (line 38) | def __init__( self, img_size=224, drop_path_rate=0, method forward (line 99) | def forward(self, samples): method generate (line 162) | def generate(self, method predict_answers (line 256) | def predict_answers( method _lemmatize (line 323) | def _lemmatize(self, answers): method lemmatizer (line 340) | def lemmatizer(self): method from_config (line 361) | def from_config(cls, cfg): FILE: lavis/models/blip2_models/blip2_image_text_matching.py class Blip2ITM (line 15) | class Blip2ITM(Blip2Qformer): method __init__ (line 27) | def __init__( method forward (line 49) | def forward(self, samples, match_head="itm"): FILE: lavis/models/blip2_models/blip2_opt.py class Blip2OPT (line 20) | class Blip2OPT(Blip2Base): method __init__ (line 40) | def __init__( method forward (line 95) | def forward(self, samples): method generate (line 151) | def generate( method from_config (line 260) | def from_config(cls, cfg): FILE: lavis/models/blip2_models/blip2_qformer.py class Blip2Qformer (line 27) | class Blip2Qformer(Blip2Base): method __init__ (line 43) | def __init__( method forward (line 86) | def forward(self, samples): method generate (line 257) | def generate( method forward_image (line 319) | def forward_image(self, image): method forward_text (line 335) | def forward_text(self, text_tokens): method compute_itm (line 343) | def compute_itm(self, image_inputs, text_ids, text_atts): method extract_features (line 366) | def extract_features(self, samples, mode="multimodal"): method from_config (line 476) | def from_config(cls, cfg): method compute_sim_matrix (line 500) | def compute_sim_matrix(self, data_loader, task_cfg): FILE: lavis/models/blip2_models/blip2_t5.py class Blip2T5 (line 20) | class Blip2T5(Blip2Base): method __init__ (line 38) | def __init__( method forward (line 99) | def forward(self, samples): method generate (line 154) | def generate( method predict_answers (line 262) | def predict_answers( method _lemmatize (line 329) | def _lemmatize(self, answers): method lemmatizer (line 346) | def lemmatizer(self): method from_config (line 367) | def from_config(cls, cfg): FILE: lavis/models/blip2_models/modeling_opt.py function _make_causal_mask (line 72) | def _make_causal_mask( function _expand_mask (line 93) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class OPTLearnedPositionalEmbedding (line 109) | class OPTLearnedPositionalEmbedding(nn.Embedding): method __init__ (line 114) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 120) | def forward( class OPTAttention (line 137) | class OPTAttention(nn.Module): method __init__ (line 140) | def __init__( method _shape (line 167) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 174) | def forward( class OPTDecoderLayer (line 308) | class OPTDecoderLayer(nn.Module): method __init__ (line 309) | def __init__(self, config: OPTConfig): method forward (line 327) | def forward( class OPTPreTrainedModel (line 432) | class OPTPreTrainedModel(PreTrainedModel): method _init_weights (line 440) | def _init_weights(self, module): method _set_gradient_checkpointing (line 451) | def _set_gradient_checkpointing(self, module, value=False): class OPTDecoder (line 518) | class OPTDecoder(OPTPreTrainedModel): method __init__ (line 526) | def __init__(self, config: OPTConfig): method get_input_embeddings (line 571) | def get_input_embeddings(self): method set_input_embeddings (line 574) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 578) | def _prepare_decoder_attention_mask( method forward (line 604) | def forward( class OPTModel (line 819) | class OPTModel(OPTPreTrainedModel): method __init__ (line 820) | def __init__(self, config: OPTConfig): method get_input_embeddings (line 826) | def get_input_embeddings(self): method set_input_embeddings (line 829) | def set_input_embeddings(self, value): method get_decoder (line 832) | def get_decoder(self): method forward (line 843) | def forward( class OPTForCausalLM (line 897) | class OPTForCausalLM(OPTPreTrainedModel): method __init__ (line 900) | def __init__(self, config): method get_input_embeddings (line 912) | def get_input_embeddings(self): method set_input_embeddings (line 915) | def set_input_embeddings(self, value): method get_output_embeddings (line 918) | def get_output_embeddings(self): method set_output_embeddings (line 921) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 924) | def set_decoder(self, decoder): method get_decoder (line 927) | def get_decoder(self): method forward (line 933) | def forward( method prepare_inputs_for_generation (line 1079) | def prepare_inputs_for_generation( method _reorder_cache (line 1105) | def _reorder_cache(past, beam_idx): FILE: lavis/models/blip2_models/modeling_t5.py function load_tf_weights_in_t5 (line 79) | def load_tf_weights_in_t5(model, config, tf_checkpoint_path): class T5LayerNorm (line 254) | class T5LayerNorm(nn.Module): method __init__ (line 255) | def __init__(self, hidden_size, eps=1e-6): method forward (line 263) | def forward(self, hidden_states): class T5DenseActDense (line 298) | class T5DenseActDense(nn.Module): method __init__ (line 299) | def __init__(self, config: T5Config): method forward (line 306) | def forward(self, hidden_states): class T5DenseGatedActDense (line 314) | class T5DenseGatedActDense(nn.Module): method __init__ (line 315) | def __init__(self, config: T5Config): method forward (line 323) | def forward(self, hidden_states): class T5LayerFF (line 332) | class T5LayerFF(nn.Module): method __init__ (line 333) | def __init__(self, config: T5Config): method forward (line 343) | def forward(self, hidden_states): class T5Attention (line 350) | class T5Attention(nn.Module): method __init__ (line 351) | def __init__(self, config: T5Config, has_relative_attention_bias=False): method prune_heads (line 376) | def prune_heads(self, heads): method _relative_position_bucket (line 393) | def _relative_position_bucket( method compute_bias (line 447) | def compute_bias(self, query_length, key_length, device=None): method forward (line 474) | def forward( class T5LayerSelfAttention (line 623) | class T5LayerSelfAttention(nn.Module): method __init__ (line 624) | def __init__(self, config, has_relative_attention_bias=False): method forward (line 632) | def forward( class T5LayerCrossAttention (line 659) | class T5LayerCrossAttention(nn.Module): method __init__ (line 660) | def __init__(self, config): method forward (line 666) | def forward( class T5Block (line 697) | class T5Block(nn.Module): method __init__ (line 698) | def __init__(self, config, has_relative_attention_bias=False): method forward (line 712) | def forward( class T5PreTrainedModel (line 829) | class T5PreTrainedModel(PreTrainedModel): method dummy_inputs (line 843) | def dummy_inputs(self): method _init_weights (line 853) | def _init_weights(self, module): method _set_gradient_checkpointing (line 915) | def _set_gradient_checkpointing(self, module, value=False): method _shift_right (line 919) | def _shift_right(self, input_ids): class T5Stack (line 951) | class T5Stack(T5PreTrainedModel): method __init__ (line 952) | def __init__(self, config, embed_tokens=None): method parallelize (line 977) | def parallelize(self, device_map=None): method deparallelize (line 1004) | def deparallelize(self): method get_input_embeddings (line 1015) | def get_input_embeddings(self): method set_input_embeddings (line 1018) | def set_input_embeddings(self, new_embeddings): method forward (line 1021) | def forward( class T5Model (line 1449) | class T5Model(T5PreTrainedModel): method __init__ (line 1458) | def __init__(self, config: T5Config): method parallelize (line 1482) | def parallelize(self, device_map=None): method deparallelize (line 1494) | def deparallelize(self): method get_input_embeddings (line 1503) | def get_input_embeddings(self): method set_input_embeddings (line 1506) | def set_input_embeddings(self, new_embeddings): method get_encoder (line 1511) | def get_encoder(self): method get_decoder (line 1514) | def get_decoder(self): method _prune_heads (line 1517) | def _prune_heads(self, heads_to_prune): method forward (line 1529) | def forward( class T5ForConditionalGeneration (line 1649) | class T5ForConditionalGeneration(T5PreTrainedModel): method __init__ (line 1659) | def __init__(self, config: T5Config): method parallelize (line 1687) | def parallelize(self, device_map=None): method deparallelize (line 1700) | def deparallelize(self): method get_input_embeddings (line 1710) | def get_input_embeddings(self): method set_input_embeddings (line 1713) | def set_input_embeddings(self, new_embeddings): method set_output_embeddings (line 1718) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 1721) | def get_output_embeddings(self): method get_encoder (line 1724) | def get_encoder(self): method get_decoder (line 1727) | def get_decoder(self): method forward (line 1734) | def forward( method prepare_inputs_for_generation (line 1895) | def prepare_inputs_for_generation( method prepare_decoder_input_ids_from_labels (line 1923) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method _reorder_cache (line 1926) | def _reorder_cache(self, past, beam_idx): class T5EncoderModel (line 1961) | class T5EncoderModel(T5PreTrainedModel): method __init__ (line 1966) | def __init__(self, config: T5Config): method parallelize (line 1983) | def parallelize(self, device_map=None): method deparallelize (line 1994) | def deparallelize(self): method get_input_embeddings (line 2001) | def get_input_embeddings(self): method set_input_embeddings (line 2004) | def set_input_embeddings(self, new_embeddings): method get_encoder (line 2008) | def get_encoder(self): method _prune_heads (line 2011) | def _prune_heads(self, heads_to_prune): method forward (line 2023) | def forward( FILE: lavis/models/blip_models/__init__.py function tie_encoder_decoder_weights (line 14) | def tie_encoder_decoder_weights( FILE: lavis/models/blip_models/blip.py class BlipBase (line 19) | class BlipBase(BaseModel): method init_tokenizer (line 21) | def init_tokenizer(cls): method load_from_pretrained (line 28) | def load_from_pretrained(self, url_or_filename): FILE: lavis/models/blip_models/blip_caption.py class BlipCaption (line 21) | class BlipCaption(BlipBase): method __init__ (line 40) | def __init__(self, image_encoder, text_decoder, prompt=None, max_txt_l... method forward_encoder (line 53) | def forward_encoder(self, samples): method forward_decoder (line 57) | def forward_decoder(self, samples, image_embeds): method forward (line 90) | def forward(self, samples): method generate (line 136) | def generate( method from_config (line 207) | def from_config(cls, cfg): FILE: lavis/models/blip_models/blip_classification.py class BlipClassification (line 25) | class BlipClassification(BlipBase, MomentumDistilationMixin): method __init__ (line 30) | def __init__( method _rampup_factor (line 74) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 77) | def forward(self, samples, is_train=True): method predict (line 142) | def predict(self, samples): method from_config (line 147) | def from_config(cls, cfg=None): FILE: lavis/models/blip_models/blip_feature_extractor.py class BlipFeatureExtractor (line 21) | class BlipFeatureExtractor(BlipBase): method __init__ (line 38) | def __init__(self, image_encoder, text_encoder, embed_dim, max_txt_len... method extract_features (line 58) | def extract_features(self, samples, mode="multimodal"): method from_config (line 190) | def from_config(cls, cfg=None): FILE: lavis/models/blip_models/blip_image_text_matching.py class BlipITM (line 19) | class BlipITM(BlipBase): method __init__ (line 38) | def __init__(self, image_encoder, text_encoder, embed_dim=256, max_txt... method forward (line 58) | def forward(self, samples, match_head="itm"): method itm_rank (line 101) | def itm_rank(self, image_embeds, image_atts, encoder_input_ids, match_... method from_config (line 132) | def from_config(cls, cfg=None): function compute_gradcam (line 151) | def compute_gradcam(model, visual_input, text_input, tokenized_text, blo... FILE: lavis/models/blip_models/blip_nlvr.py class BlipNLVR (line 25) | class BlipNLVR(BlipBase, MomentumDistilationMixin): method __init__ (line 42) | def __init__(self, image_encoder, text_encoder, num_classes): method forward (line 56) | def forward(self, samples, is_train=True): method predict (line 128) | def predict(self, samples): method from_config (line 133) | def from_config(cls, cfg=None): method load_from_pretrained (line 156) | def load_from_pretrained(self, url_or_filename): FILE: lavis/models/blip_models/blip_outputs.py class BlipSimilarity (line 20) | class BlipSimilarity(ModelOutput): class BlipIntermediateOutput (line 32) | class BlipIntermediateOutput(ModelOutput): class BlipOutput (line 73) | class BlipOutput(ModelOutput): class BlipOutputWithLogits (line 89) | class BlipOutputWithLogits(BlipOutput): class BlipOutputFeatures (line 95) | class BlipOutputFeatures(ModelOutput): FILE: lavis/models/blip_models/blip_pretrain.py class BlipPretrain (line 27) | class BlipPretrain(BlipBase, SharedQueueMixin, MomentumDistilationMixin): method __init__ (line 40) | def __init__( method _rampup_factor (line 111) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 114) | def forward(self, samples): method reset_queue_ptr (line 362) | def reset_queue_ptr(self): method from_config (line 366) | def from_config(cls, cfg=None): FILE: lavis/models/blip_models/blip_retrieval.py class BlipRetrieval (line 32) | class BlipRetrieval(BlipBase, MomentumDistilationMixin, SharedQueueMixin): method __init__ (line 51) | def __init__( method _rampup_factor (line 113) | def _rampup_factor(self, epoch, iters, num_iters_per_epoch): method forward (line 116) | def forward(self, samples): method reset_queue_ptr (line 357) | def reset_queue_ptr(self): method from_config (line 361) | def from_config(cls, cfg=None): method compute_sim_matrix (line 390) | def compute_sim_matrix(self, data_loader, task_cfg): FILE: lavis/models/blip_models/blip_vqa.py class BlipVQA (line 22) | class BlipVQA(BlipBase): method __init__ (line 43) | def __init__(self, image_encoder, text_encoder, text_decoder, max_txt_... method forward (line 54) | def forward(self, samples): method forward_encoder (line 104) | def forward_encoder(self, samples): method forward_decoder (line 123) | def forward_decoder(self, samples, encoder_out, **kwargs): method predict_answers (line 162) | def predict_answers( method _generate_answers (line 237) | def _generate_answers(self, samples, num_beams=3, max_length=10, min_l... method _rank_answers (line 277) | def _rank_answers(self, samples, answer_list, num_ans_candidates): method from_config (line 357) | def from_config(cls, cfg=None): FILE: lavis/models/blip_models/nlvr_encoder.py class BertEmbeddings (line 31) | class BertEmbeddings(nn.Module): method __init__ (line 34) | def __init__(self, config): method forward (line 58) | def forward( class BertSelfAttention (line 90) | class BertSelfAttention(nn.Module): method __init__ (line 91) | def __init__(self, config, is_cross_attention): method save_attn_gradients (line 128) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 131) | def get_attn_gradients(self): method save_attention_map (line 134) | def save_attention_map(self, attention_map): method get_attention_map (line 137) | def get_attention_map(self): method transpose_for_scores (line 140) | def transpose_for_scores(self, x): method forward (line 148) | def forward( class BertSelfOutput (line 256) | class BertSelfOutput(nn.Module): method __init__ (line 257) | def __init__(self, config, twin=False, merge=False): method forward (line 273) | def forward(self, hidden_states, input_tensor): class BertAttention (line 291) | class BertAttention(nn.Module): method __init__ (line 292) | def __init__(self, config, is_cross_attention=False, layer_num=-1): method prune_heads (line 306) | def prune_heads(self, heads): method forward (line 329) | def forward( class BertIntermediate (line 382) | class BertIntermediate(nn.Module): method __init__ (line 383) | def __init__(self, config): method forward (line 391) | def forward(self, hidden_states): class BertOutput (line 397) | class BertOutput(nn.Module): method __init__ (line 398) | def __init__(self, config): method forward (line 404) | def forward(self, hidden_states, input_tensor): class BertLayer (line 411) | class BertLayer(nn.Module): method __init__ (line 412) | def __init__(self, config, layer_num): method forward (line 428) | def forward( method feed_forward_chunk (line 483) | def feed_forward_chunk(self, attention_output): class BertEncoder (line 489) | class BertEncoder(nn.Module): method __init__ (line 490) | def __init__(self, config): method forward (line 498) | def forward( class BertPooler (line 593) | class BertPooler(nn.Module): method __init__ (line 594) | def __init__(self, config): method forward (line 599) | def forward(self, hidden_states): class BertPredictionHeadTransform (line 608) | class BertPredictionHeadTransform(nn.Module): method __init__ (line 609) | def __init__(self, config): method forward (line 618) | def forward(self, hidden_states): class BertLMPredictionHead (line 625) | class BertLMPredictionHead(nn.Module): method __init__ (line 626) | def __init__(self, config): method forward (line 639) | def forward(self, hidden_states): class BertOnlyMLMHead (line 645) | class BertOnlyMLMHead(nn.Module): method __init__ (line 646) | def __init__(self, config): method forward (line 650) | def forward(self, sequence_output): class BertPreTrainedModel (line 655) | class BertPreTrainedModel(PreTrainedModel): method _init_weights (line 665) | def _init_weights(self, module): class BertModel (line 678) | class BertModel(BertPreTrainedModel): method __init__ (line 688) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 700) | def get_input_embeddings(self): method set_input_embeddings (line 703) | def set_input_embeddings(self, value): method _prune_heads (line 706) | def _prune_heads(self, heads_to_prune): method get_extended_attention_mask (line 714) | def get_extended_attention_mask( method forward (line 792) | def forward( FILE: lavis/models/clip_models/clip_outputs.py class ClipOutputFeatures (line 19) | class ClipOutputFeatures(ModelOutput): class ClipOutput (line 38) | class ClipOutput(ModelOutput): FILE: lavis/models/clip_models/loss.py function gather_features (line 20) | def gather_features( class ClipLoss (line 78) | class ClipLoss(nn.Module): method __init__ (line 79) | def __init__( method forward (line 100) | def forward(self, image_features, text_features, logit_scale): FILE: lavis/models/clip_models/model.py class Bottleneck (line 50) | class Bottleneck(nn.Module): method __init__ (line 53) | def __init__(self, inplanes, planes, stride=1): method forward (line 93) | def forward(self, x: torch.Tensor): class AttentionPool2d (line 109) | class AttentionPool2d(nn.Module): method __init__ (line 110) | def __init__( method forward (line 123) | def forward(self, x): class ModifiedResNet (line 156) | class ModifiedResNet(nn.Module): method __init__ (line 164) | def __init__(self, layers, output_dim, heads, image_size=224, width=64): method _make_layer (line 195) | def _make_layer(self, planes, blocks, stride=1): method init_parameters (line 204) | def init_parameters(self): method lock (line 217) | def lock(self, unlocked_groups=0, freeze_bn_stats=False): method stem (line 226) | def stem(self, x): method forward (line 236) | def forward(self, x): class LayerNorm (line 247) | class LayerNorm(nn.LayerNorm): method forward (line 250) | def forward(self, x: torch.Tensor): class QuickGELU (line 256) | class QuickGELU(nn.Module): method forward (line 258) | def forward(self, x: torch.Tensor): class ResidualAttentionBlock (line 262) | class ResidualAttentionBlock(nn.Module): method __init__ (line 263) | def __init__(self, d_model: int, n_head: int, act_layer: Callable = nn... method attention (line 279) | def attention(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor]... method forward (line 282) | def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] =... class Transformer (line 288) | class Transformer(nn.Module): method __init__ (line 289) | def __init__( method forward (line 302) | def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] =... class VisualTransformer (line 308) | class VisualTransformer(nn.Module): method __init__ (line 309) | def __init__( method lock (line 342) | def lock(self, unlocked_groups=0, freeze_bn_stats=False): method forward (line 349) | def forward(self, x: torch.Tensor): class CLIPVisionCfg (line 379) | class CLIPVisionCfg: class CLIPTextCfg (line 399) | class CLIPTextCfg: class CLIP (line 409) | class CLIP(BaseModel): method __init__ (line 418) | def __init__( method loss (line 501) | def loss(self): method init_parameters (line 516) | def init_parameters(self): method build_attention_mask (line 538) | def build_attention_mask(self): method lock_image_tower (line 546) | def lock_image_tower(self, unlocked_groups=0, freeze_bn_stats=False): method encode_image (line 552) | def encode_image(self, image): method encode_text (line 555) | def encode_text(self, text): method forward (line 571) | def forward(self, samples): method extract_features (line 603) | def extract_features(self, samples): method predict (line 640) | def predict(self, samples): method before_evaluation (line 651) | def before_evaluation(self, dataset, task_type, **kwargs): method zero_shot_classifier (line 658) | def zero_shot_classifier(self, classnames, templates): method default_config_path (line 675) | def default_config_path(cls, model_type="base"): method from_config (line 686) | def from_config(cls, cfg=None): method zero_shot_predict (line 696) | def zero_shot_predict(self, image_path, categories): method compute_sim_matrix (line 720) | def compute_sim_matrix(self, data_loader, **kwargs): function convert_weights_to_fp16 (line 763) | def convert_weights_to_fp16(model: nn.Module): function build_model_from_openai_state_dict (line 792) | def build_model_from_openai_state_dict(state_dict: dict): function trace_model (line 873) | def trace_model(model, batch_size=256, device=torch.device("cpu")): function _natural_key (line 892) | def _natural_key(string_): function _rescan_model_configs (line 896) | def _rescan_model_configs(): function load_state_dict (line 923) | def load_state_dict(checkpoint_path: str, map_location="cpu"): function create_model (line 934) | def create_model( function create_model_and_transforms (line 1009) | def create_model_and_transforms( function list_models (line 1032) | def list_models(): function add_model_config (line 1037) | def add_model_config(path): function list_openai_models (line 1045) | def list_openai_models() -> List[str]: function load_openai_model (line 1050) | def load_openai_model( FILE: lavis/models/clip_models/pretrained.py function list_pretrained (line 92) | def list_pretrained(as_str: bool = False): function list_pretrained_tag_models (line 103) | def list_pretrained_tag_models(tag: str): function list_pretrained_model_tags (line 112) | def list_pretrained_model_tags(model: str): function get_pretrained_url (line 120) | def get_pretrained_url(model: str, tag: str): function download_pretrained (line 130) | def download_pretrained(url: str, root: str = os.path.expanduser("~/.cac... FILE: lavis/models/clip_models/timm_model.py class TimmModel (line 37) | class TimmModel(nn.Module): method __init__ (line 42) | def __init__( method lock (line 91) | def lock(self, unlocked_groups=0, freeze_bn_stats=False): method forward (line 124) | def forward(self, x): class RotAttentionPool2d (line 130) | class RotAttentionPool2d(nn.Module): method __init__ (line 139) | def __init__( method forward (line 161) | def forward(self, x): class AttentionPool2d (line 192) | class AttentionPool2d(nn.Module): method __init__ (line 200) | def __init__( method forward (line 227) | def forward(self, x): function pixel_freq_bands (line 250) | def pixel_freq_bands( function inv_freq_bands (line 266) | def inv_freq_bands( function build_sincos2d_pos_embed (line 280) | def build_sincos2d_pos_embed( function build_fourier_pos_embed (line 329) | def build_fourier_pos_embed( class FourierEmbed (line 386) | class FourierEmbed(nn.Module): method __init__ (line 387) | def __init__( method forward (line 403) | def forward(self, x): function rot (line 430) | def rot(x): function apply_rot_embed (line 434) | def apply_rot_embed(x: torch.Tensor, sin_emb, cos_emb): function apply_rot_embed_list (line 438) | def apply_rot_embed_list(x: List[torch.Tensor], sin_emb, cos_emb): function apply_rot_embed_split (line 444) | def apply_rot_embed_split(x: torch.Tensor, emb): function build_rotary_pos_embed (line 449) | def build_rotary_pos_embed( class RotaryEmbedding (line 479) | class RotaryEmbedding(nn.Module): method __init__ (line 488) | def __init__(self, dim, max_res=224, linear_bands: bool = False): method get_embed (line 497) | def get_embed(self, shape: List[int]): method forward (line 500) | def forward(self, x): function _no_grad_trunc_normal_ (line 506) | def _no_grad_trunc_normal_(tensor, mean, std, a, b): function trunc_normal_ (line 544) | def trunc_normal_(tensor, mean=0.0, std=1.0, a=-2.0, b=2.0): FILE: lavis/models/clip_models/tokenizer.py function default_bpe (line 25) | def default_bpe(): function bytes_to_unicode (line 32) | def bytes_to_unicode(): function get_pairs (line 58) | def get_pairs(word): function basic_clean (line 70) | def basic_clean(text): function whitespace_clean (line 76) | def whitespace_clean(text): class SimpleTokenizer (line 82) | class SimpleTokenizer(object): method __init__ (line 83) | def __init__(self, bpe_path: str = default_bpe(), special_tokens=None): method bpe (line 111) | def bpe(self, token): method encode (line 152) | def encode(self, text): method decode (line 162) | def decode(self, tokens): function tokenize (line 175) | def tokenize( FILE: lavis/models/clip_models/transform.py class ResizeMaxSize (line 28) | class ResizeMaxSize(nn.Module): method __init__ (line 29) | def __init__( method forward (line 40) | def forward(self, img): function _convert_to_rgb (line 64) | def _convert_to_rgb(image): function image_transform (line 68) | def image_transform( FILE: lavis/models/clip_models/utils.py function freeze_batch_norm_2d (line 14) | def freeze_batch_norm_2d(module, module_match={}, name=""): FILE: lavis/models/eva_vit.py function _cfg (line 20) | def _cfg(url='', **kwargs): class DropPath (line 30) | class DropPath(nn.Module): method __init__ (line 33) | def __init__(self, drop_prob=None): method forward (line 37) | def forward(self, x): method extra_repr (line 40) | def extra_repr(self) -> str: class Mlp (line 44) | class Mlp(nn.Module): method __init__ (line 45) | def __init__(self, in_features, hidden_features=None, out_features=Non... method forward (line 54) | def forward(self, x): class Attention (line 64) | class Attention(nn.Module): method __init__ (line 65) | def __init__( method forward (line 118) | def forward(self, x, rel_pos_bias=None): class Block (line 151) | class Block(nn.Module): method __init__ (line 153) | def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_sc... method forward (line 173) | def forward(self, x, rel_pos_bias=None): class PatchEmbed (line 183) | class PatchEmbed(nn.Module): method __init__ (line 186) | def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=... method forward (line 198) | def forward(self, x, **kwargs): class RelativePositionBias (line 207) | class RelativePositionBias(nn.Module): method __init__ (line 209) | def __init__(self, window_size, num_heads): method forward (line 238) | def forward(self): class VisionTransformer (line 246) | class VisionTransformer(nn.Module): method __init__ (line 249) | def __init__(self, img_size=224, patch_size=16, in_chans=3, num_classe... method fix_init_weight (line 300) | def fix_init_weight(self): method _init_weights (line 308) | def _init_weights(self, m): method get_classifier (line 317) | def get_classifier(self): method reset_classifier (line 320) | def reset_classifier(self, num_classes, global_pool=''): method forward_features (line 324) | def forward_features(self, x): method forward (line 349) | def forward(self, x): method get_intermediate_layers (line 354) | def get_intermediate_layers(self, x): function interpolate_pos_embed (line 373) | def interpolate_pos_embed(model, checkpoint_model): function convert_weights_to_fp16 (line 397) | def convert_weights_to_fp16(model: nn.Module): function create_eva_vit_g (line 415) | def create_eva_vit_g(img_size=224,drop_path_rate=0.4,use_checkpoint=Fals... FILE: lavis/models/gpt_models/gpt_dialogue.py class GPTDialogue (line 18) | class GPTDialogue(BaseModel, GPT2LMHeadModel): method __init__ (line 22) | def __init__(self, config, len_video_ft=4224): method forward (line 36) | def forward( method from_config (line 107) | def from_config(cls, cfg): FILE: lavis/models/img2prompt_models/img2prompt_vqa.py class Img2PromptVQA (line 25) | class Img2PromptVQA(BaseModel): method __init__ (line 46) | def __init__( method forward_itm (line 63) | def forward_itm(self, samples, block_num=7): method itm_rank (line 98) | def itm_rank(self, image_embeds, image_atts, encoder_input_ids, match_... method forward_cap (line 133) | def forward_cap( method answer_extraction (line 247) | def answer_extraction(self, caption, num_question_generation=30): method forward_qa_generation (line 307) | def forward_qa_generation(self, samples): method create_context_prompt (line 344) | def create_context_prompt(self, samples, num_caps_per_img=30): method create_task_prompt (line 363) | def create_task_prompt( method prompts_construction (line 432) | def prompts_construction( method prepare_LLM_input (line 459) | def prepare_LLM_input( method from_config (line 550) | def from_config(cls, model_config): FILE: lavis/models/med.py class BertEmbeddings (line 56) | class BertEmbeddings(nn.Module): method __init__ (line 59) | def __init__(self, config): method forward (line 88) | def forward( class BertSelfAttention (line 126) | class BertSelfAttention(nn.Module): method __init__ (line 127) | def __init__(self, config, is_cross_attention): method save_attn_gradients (line 164) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 167) | def get_attn_gradients(self): method save_attention_map (line 170) | def save_attention_map(self, attention_map): method get_attention_map (line 173) | def get_attention_map(self): method transpose_for_scores (line 176) | def transpose_for_scores(self, x): method forward (line 184) | def forward( class BertSelfOutput (line 292) | class BertSelfOutput(nn.Module): method __init__ (line 293) | def __init__(self, config): method forward (line 299) | def forward(self, hidden_states, input_tensor): class BertAttention (line 306) | class BertAttention(nn.Module): method __init__ (line 307) | def __init__(self, config, is_cross_attention=False): method prune_heads (line 313) | def prune_heads(self, heads): method forward (line 336) | def forward( class BertIntermediate (line 362) | class BertIntermediate(nn.Module): method __init__ (line 363) | def __init__(self, config): method forward (line 371) | def forward(self, hidden_states): class BertOutput (line 377) | class BertOutput(nn.Module): method __init__ (line 378) | def __init__(self, config): method forward (line 384) | def forward(self, hidden_states, input_tensor): class BertLayer (line 391) | class BertLayer(nn.Module): method __init__ (line 392) | def __init__(self, config, layer_num): method forward (line 422) | def forward( method feed_forward_chunk (line 499) | def feed_forward_chunk(self, attention_output): class BertEncoder (line 505) | class BertEncoder(nn.Module): method __init__ (line 506) | def __init__(self, config): method forward (line 514) | def forward( class BertPooler (line 633) | class BertPooler(nn.Module): method __init__ (line 634) | def __init__(self, config): method forward (line 639) | def forward(self, hidden_states): class BertPredictionHeadTransform (line 648) | class BertPredictionHeadTransform(nn.Module): method __init__ (line 649) | def __init__(self, config): method forward (line 658) | def forward(self, hidden_states): class BertLMPredictionHead (line 665) | class BertLMPredictionHead(nn.Module): method __init__ (line 666) | def __init__(self, config): method forward (line 679) | def forward(self, hidden_states): class BertOnlyMLMHead (line 685) | class BertOnlyMLMHead(nn.Module): method __init__ (line 686) | def __init__(self, config): method forward (line 690) | def forward(self, sequence_output): class BertPreTrainedModel (line 695) | class BertPreTrainedModel(PreTrainedModel): method _init_weights (line 705) | def _init_weights(self, module): class BertModel (line 718) | class BertModel(BertPreTrainedModel): method __init__ (line 728) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 740) | def get_input_embeddings(self): method set_input_embeddings (line 743) | def set_input_embeddings(self, value): method _prune_heads (line 746) | def _prune_heads(self, heads_to_prune): method get_extended_attention_mask (line 754) | def get_extended_attention_mask( method forward (line 832) | def forward( class BertForMaskedLM (line 1005) | class BertForMaskedLM(BertPreTrainedModel): method __init__ (line 1010) | def __init__(self, config): method get_output_embeddings (line 1018) | def get_output_embeddings(self): method set_output_embeddings (line 1021) | def set_output_embeddings(self, new_embeddings): method forward (line 1024) | def forward( method prepare_inputs_for_generation (line 1106) | def prepare_inputs_for_generation( class BertLMHeadModel (line 1131) | class BertLMHeadModel(BertPreTrainedModel): method __init__ (line 1136) | def __init__(self, config): method get_output_embeddings (line 1144) | def get_output_embeddings(self): method set_output_embeddings (line 1147) | def set_output_embeddings(self, new_embeddings): method forward (line 1150) | def forward( method prepare_inputs_for_generation (line 1266) | def prepare_inputs_for_generation( method _reorder_cache (line 1287) | def _reorder_cache(self, past, beam_idx): class XBertLMHeadDecoder (line 1298) | class XBertLMHeadDecoder(BertLMHeadModel): method from_config (line 1306) | def from_config(cls, cfg, from_pretrained=False): method generate_from_encoder (line 1316) | def generate_from_encoder( class XBertEncoder (line 1374) | class XBertEncoder(BertModel, BaseEncoder): method from_config (line 1376) | def from_config(cls, cfg, from_pretrained=False): method forward_automask (line 1388) | def forward_automask(self, tokenized_text, visual_embeds, **kwargs): method forward_text (line 1404) | def forward_text(self, tokenized_text, **kwargs): FILE: lavis/models/pnp_vqa_models/__init__.py function prepare_qa_input (line 11) | def prepare_qa_input(sample, num_captions, num_captions_fid): FILE: lavis/models/pnp_vqa_models/pnp_unifiedqav2_fid.py class PNPUnifiedQAv2FiD (line 20) | class PNPUnifiedQAv2FiD(T5ForConditionalGeneration, BaseModel): method __init__ (line 24) | def __init__(self, config, model_path): method forward (line 29) | def forward(self, input_ids=None, attention_mask=None, **kwargs): method generate (line 43) | def generate(self, input_ids, attention_mask, num_beams=1, min_length=... method load_unifiedqa (line 54) | def load_unifiedqa(self, state_dict): method from_config (line 59) | def from_config(cls, cfg): class T5EncoderWrapper (line 69) | class T5EncoderWrapper(torch.nn.Module): method __init__ (line 71) | def __init__(self, encoder): method forward (line 79) | def forward(self, input_ids=None, attention_mask=None, **kwargs): FILE: lavis/models/pnp_vqa_models/pnp_vqa.py class PNPVQA (line 21) | class PNPVQA(BaseModel): method __init__ (line 45) | def __init__(self, image_question_matching_model, image_captioning_model, method forward_itm (line 54) | def forward_itm(self, samples, block_num=7): method forward_cap (line 84) | def forward_cap( method forward_qa (line 174) | def forward_qa( method predict_answers (line 232) | def predict_answers( method from_config (line 321) | def from_config(cls, model_config): FILE: lavis/models/sevila_models/sevila.py class SeViLA (line 20) | class SeViLA(Blip2Base): method __init__ (line 37) | def __init__( self, img_size=224, drop_path_rate=0, method forward (line 126) | def forward(self, samples, method generate (line 438) | def generate(self, method generate_demo (line 691) | def generate_demo(self, method predict_answers (line 872) | def predict_answers( method _lemmatize (line 939) | def _lemmatize(self, answers): method lemmatizer (line 956) | def lemmatizer(self): method from_config (line 977) | def from_config(cls, cfg): FILE: lavis/models/timesformer/conv2d_same.py function pad_same (line 24) | def pad_same(x, k: List[int], s: List[int], d: List[int] = (1, 1), value... function get_same_padding (line 39) | def get_same_padding(x: int, k: int, s: int, d: int): function get_padding_value (line 43) | def get_padding_value(padding, kernel_size, **kwargs) -> Tuple[Tuple, bo... function conv2d_same (line 66) | def conv2d_same( class Conv2dSame (line 79) | class Conv2dSame(nn.Conv2d): method __init__ (line 82) | def __init__( method forward (line 97) | def forward(self, x): function create_conv2d_pad (line 109) | def create_conv2d_pad(in_chs, out_chs, kernel_size, **kwargs): FILE: lavis/models/timesformer/features.py class FeatureInfo (line 21) | class FeatureInfo: method __init__ (line 22) | def __init__(self, feature_info: List[Dict], out_indices: Tuple[int]): method from_other (line 33) | def from_other(self, out_indices: Tuple[int]): method get (line 36) | def get(self, key, idx=None): method get_dicts (line 49) | def get_dicts(self, keys=None, idx=None): method channels (line 66) | def channels(self, idx=None): method reduction (line 70) | def reduction(self, idx=None): method module_name (line 74) | def module_name(self, idx=None): method __getitem__ (line 78) | def __getitem__(self, item): method __len__ (line 81) | def __len__(self): class FeatureHooks (line 85) | class FeatureHooks: method __init__ (line 92) | def __init__(self, hooks, named_modules, out_map=None, default_hook_ty... method _collect_output_hook (line 109) | def _collect_output_hook(self, hook_id, *args): method get_output (line 117) | def get_output(self, device) -> Dict[str, torch.tensor]: function _module_list (line 123) | def _module_list(module, flatten_sequential=False): function _get_feature_info (line 137) | def _get_feature_info(net, out_indices): function _get_return_layers (line 147) | def _get_return_layers(feature_info, out_map): class FeatureDictNet (line 157) | class FeatureDictNet(nn.ModuleDict): method __init__ (line 178) | def __init__( method _collect (line 207) | def _collect(self, x) -> (Dict[str, torch.Tensor]): method forward (line 221) | def forward(self, x) -> Dict[str, torch.Tensor]: class FeatureListNet (line 225) | class FeatureListNet(FeatureDictNet): method __init__ (line 231) | def __init__( method forward (line 247) | def forward(self, x) -> (List[torch.Tensor]): class FeatureHookNet (line 251) | class FeatureHookNet(nn.ModuleDict): method __init__ (line 261) | def __init__( method forward (line 304) | def forward(self, x): FILE: lavis/models/timesformer/helpers.py function load_state_dict (line 24) | def load_state_dict(checkpoint_path, use_ema=False): function load_checkpoint (line 57) | def load_checkpoint(model, checkpoint_path, use_ema=False, strict=True): function load_pretrained (line 102) | def load_pretrained( function load_pretrained_imagenet (line 235) | def load_pretrained_imagenet( function load_pretrained_kinetics (line 299) | def load_pretrained_kinetics( function resize_spatial_embedding (line 353) | def resize_spatial_embedding(state_dict, key, num_patches): function resize_temporal_embedding (line 370) | def resize_temporal_embedding(state_dict, key, num_frames): function detach_variable (line 381) | def detach_variable(inputs): function check_backward_validity (line 396) | def check_backward_validity(inputs): FILE: lavis/models/timesformer/linear.py class Linear (line 15) | class Linear(nn.Linear): method forward (line 16) | def forward(self, input: torch.Tensor) -> torch.Tensor: FILE: lavis/models/timesformer/vit.py function _cfg (line 35) | def _cfg(url="", **kwargs): class Mlp (line 60) | class Mlp(nn.Module): method __init__ (line 61) | def __init__( method forward (line 77) | def forward(self, x): class Attention (line 86) | class Attention(nn.Module): method __init__ (line 87) | def __init__( method forward (line 108) | def forward(self, x): class Block (line 134) | class Block(nn.Module): method __init__ (line 135) | def __init__( method forward (line 202) | def forward(self, x, B, T, W): class PatchEmbed (line 263) | class PatchEmbed(nn.Module): method __init__ (line 266) | def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=... method forward (line 279) | def forward(self, x): class VisionTransformer (line 288) | class VisionTransformer(nn.Module): method __init__ (line 291) | def __init__( method _init_weights (line 385) | def _init_weights(self, m): method no_weight_decay (line 395) | def no_weight_decay(self): method get_classifier (line 398) | def get_classifier(self): method reset_classifier (line 401) | def reset_classifier(self, num_classes, global_pool=""): method remove_classifier (line 407) | def remove_classifier(self): method forward_features (line 411) | def forward_features(self, x): method forward (line 464) | def forward(self, x): function _conv_filter (line 470) | def _conv_filter(state_dict, patch_size=16): class vit_base_patch16_224 (line 482) | class vit_base_patch16_224(nn.Module): method __init__ (line 483) | def __init__(self, cfg, **kwargs): method forward (line 523) | def forward(self, x): class TimeSformer (line 528) | class TimeSformer(nn.Module): method __init__ (line 529) | def __init__( method forward (line 592) | def forward(self, x): method forward_features (line 596) | def forward_features(self, x): method load_state_dict (line 614) | def load_state_dict(self, pretrained_ckpt_path): FILE: lavis/models/timesformer/vit_utils.py function _no_grad_trunc_normal_ (line 31) | def _no_grad_trunc_normal_(tensor, mean, std, a, b): function trunc_normal_ (line 67) | def trunc_normal_(tensor, mean=0.0, std=1.0, a=-2.0, b=2.0): function _ntuple (line 88) | def _ntuple(n): function get_padding (line 100) | def get_padding(kernel_size: int, stride: int = 1, dilation: int = 1, **... function get_padding_value (line 105) | def get_padding_value(padding, kernel_size, **kwargs): function get_same_padding (line 129) | def get_same_padding(x: int, k: int, s: int, d: int): function is_static_pad (line 134) | def is_static_pad(kernel_size: int, stride: int = 1, dilation: int = 1, ... function pad_same (line 140) | def pad_same(x, k, s, d=(1, 1), value=0): function adaptive_pool_feat_mult (line 154) | def adaptive_pool_feat_mult(pool_type="avg"): function drop_path (line 161) | def drop_path(x, drop_prob: float = 0.0, training: bool = False): class DropPath (line 181) | class DropPath(nn.Module): method __init__ (line 184) | def __init__(self, drop_prob=None): method forward (line 188) | def forward(self, x): FILE: lavis/models/topk.py class PerturbedTopK (line 18) | class PerturbedTopK(nn.Module): method __init__ (line 19) | def __init__(self, k: int, num_samples: int = 1000): method __call__ (line 24) | def __call__(self, x, sigma): class PerturbedTopKFunction (line 28) | class PerturbedTopKFunction(torch.autograd.Function): method forward (line 30) | def forward(ctx, x, k: int, num_samples: int = 1000, sigma: float = 0.... method backward (line 59) | def backward(ctx, grad_output): function HardTopK (line 78) | def HardTopK(k, x): function batched_index_select (line 85) | def batched_index_select(input, dim, index): function extract_frames_from_indices (line 95) | def extract_frames_from_indices(x, indices): function extract_frames_from_indicators (line 104) | def extract_frames_from_indicators(x, indicators): class ModalityEmbeddingsID (line 111) | class ModalityEmbeddingsID(IntEnum): class ModalityEmbeddings (line 118) | class ModalityEmbeddings(nn.Module): method __init__ (line 122) | def __init__(self, method forward (line 142) | def forward(self, x, num_frame): class ATPConfig (line 168) | class ATPConfig: method default_args (line 188) | def default_args(cls): method from_args (line 204) | def from_args(cls, args): class ATPEncoder (line 217) | class ATPEncoder(nn.Module): method __init__ (line 223) | def __init__(self, config: ATPConfig): method forward (line 249) | def forward(self, x_inputs: torch.tensor, vis_L): class TopK_Selector (line 262) | class TopK_Selector(nn.Module): method __init__ (line 269) | def __init__(self, config=ATPConfig, num_select=4): method forward (line 285) | def forward(self, FILE: lavis/models/vit.py class Mlp (line 26) | class Mlp(nn.Module): method __init__ (line 29) | def __init__( method forward (line 45) | def forward(self, x): class Attention (line 54) | class Attention(nn.Module): method __init__ (line 55) | def __init__( method save_attn_gradients (line 76) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 79) | def get_attn_gradients(self): method save_attention_map (line 82) | def save_attention_map(self, attention_map): method get_attention_map (line 85) | def get_attention_map(self): method forward (line 88) | def forward(self, x, register_hook=False): class Block (line 115) | class Block(nn.Module): method __init__ (line 116) | def __init__( method forward (line 155) | def forward(self, x, register_hook=False): class VisionTransformer (line 161) | class VisionTransformer(nn.Module): method __init__ (line 167) | def __init__( method _init_weights (line 252) | def _init_weights(self, m): method no_weight_decay (line 262) | def no_weight_decay(self): method forward (line 265) | def forward(self, x, register_blk=-1): method load_pretrained (line 284) | def load_pretrained(self, checkpoint_path, prefix=""): function _load_weights (line 289) | def _load_weights(model: VisionTransformer, checkpoint_path: str, prefix... function resize_pos_embed (line 402) | def resize_pos_embed(posemb, posemb_new, num_tokens=1, gs_new=()): function interpolate_pos_embed (line 426) | def interpolate_pos_embed(pos_embed_checkpoint, visual_encoder): class VisionTransformerEncoder (line 458) | class VisionTransformerEncoder(VisionTransformer, BaseEncoder): method from_config (line 460) | def from_config(cls, cfg, from_pretrained=False): method forward_features (line 526) | def forward_features(self, x, register_blk=-1): FILE: lavis/processors/__init__.py function load_processor (line 45) | def load_processor(name, cfg=None): FILE: lavis/processors/alpro_processors.py class AlproVideoBaseProcessor (line 21) | class AlproVideoBaseProcessor(BaseProcessor): method __init__ (line 22) | def __init__(self, mean=None, std=None, n_frms=MAX_INT): class ToUint8 (line 33) | class ToUint8(object): method __init__ (line 34) | def __init__(self): method __call__ (line 37) | def __call__(self, tensor): method __repr__ (line 40) | def __repr__(self): class ToTHWC (line 44) | class ToTHWC(object): method __init__ (line 52) | def __init__(self): method __call__ (line 55) | def __call__(self, tensor): method __repr__ (line 58) | def __repr__(self): class ResizeVideo (line 62) | class ResizeVideo(object): method __init__ (line 63) | def __init__(self, target_size, interpolation_mode="bilinear"): method __call__ (line 67) | def __call__(self, clip): method __repr__ (line 77) | def __repr__(self): class AlproVideoTrainProcessor (line 82) | class AlproVideoTrainProcessor(AlproVideoBaseProcessor): method __init__ (line 83) | def __init__( method __call__ (line 128) | def __call__(self, vpath): method from_config (line 146) | def from_config(cls, cfg=None): class AlproVideoEvalProcessor (line 171) | class AlproVideoEvalProcessor(AlproVideoBaseProcessor): method __init__ (line 172) | def __init__(self, image_size=256, mean=None, std=None, n_frms=MAX_INT): method __call__ (line 188) | def __call__(self, vpath): method from_config (line 205) | def from_config(cls, cfg=None): FILE: lavis/processors/base_processor.py class BaseProcessor (line 11) | class BaseProcessor: method __init__ (line 12) | def __init__(self): method __call__ (line 16) | def __call__(self, item): method from_config (line 20) | def from_config(cls, cfg=None): method build (line 23) | def build(self, **kwargs): FILE: lavis/processors/blip_processors.py class ToUint8 (line 21) | class ToUint8(object): method __init__ (line 22) | def __init__(self): method __call__ (line 25) | def __call__(self, tensor): method __repr__ (line 28) | def __repr__(self): class ToTHWC (line 32) | class ToTHWC(object): method __init__ (line 40) | def __init__(self): method __call__ (line 43) | def __call__(self, tensor): method __repr__ (line 46) | def __repr__(self): class BlipImageBaseProcessor (line 49) | class BlipImageBaseProcessor(BaseProcessor): method __init__ (line 50) | def __init__(self, mean=None, std=None): class BlipVideoBaseProcessor (line 58) | class BlipVideoBaseProcessor(BaseProcessor): method __init__ (line 59) | def __init__(self, mean=None, std=None, n_frms=MAX_INT): class BlipCaptionProcessor (line 70) | class BlipCaptionProcessor(BaseProcessor): method __init__ (line 71) | def __init__(self, prompt="", max_words=50): method __call__ (line 75) | def __call__(self, caption): method from_config (line 81) | def from_config(cls, cfg=None): method pre_caption (line 90) | def pre_caption(self, caption): class BlipQuestionProcessor (line 112) | class BlipQuestionProcessor(BaseProcessor): method __init__ (line 113) | def __init__(self, max_words=50): method __call__ (line 116) | def __call__(self, question): method from_config (line 120) | def from_config(cls, cfg=None): method pre_question (line 128) | def pre_question(self, question): class BlipImageTrainProcessor (line 146) | class BlipImageTrainProcessor(BlipImageBaseProcessor): method __init__ (line 147) | def __init__( method __call__ (line 182) | def __call__(self, item): method from_config (line 186) | def from_config(cls, cfg=None): class BlipImageEvalProcessor (line 208) | class BlipImageEvalProcessor(BlipImageBaseProcessor): method __init__ (line 209) | def __init__(self, image_size=384, mean=None, std=None): method __call__ (line 222) | def __call__(self, item): method from_config (line 226) | def from_config(cls, cfg=None): class Blip2ImageTrainProcessor (line 239) | class Blip2ImageTrainProcessor(BlipImageBaseProcessor): method __init__ (line 240) | def __init__( method __call__ (line 258) | def __call__(self, item): method from_config (line 262) | def from_config(cls, cfg=None): class Blip2VideoTrainProcessor (line 283) | class Blip2VideoTrainProcessor(BlipVideoBaseProcessor): method __init__ (line 284) | def __init__( method __call__ (line 312) | def __call__(self, vpath, clip_proposal=None): method from_config (line 326) | def from_config(cls, cfg=None): class BlipVideoEvalProcessor (line 350) | class BlipVideoEvalProcessor(BlipVideoBaseProcessor): method __init__ (line 351) | def __init__(self, image_size=384, mean=None, std=None, n_frms=MAX_INT): method __call__ (line 365) | def __call__(self, vpath, clip_proposal=None): method from_config (line 378) | def from_config(cls, cfg=None): FILE: lavis/processors/clip_processors.py function _convert_to_rgb (line 15) | def _convert_to_rgb(image): class ClipImageTrainProcessor (line 20) | class ClipImageTrainProcessor(BlipImageBaseProcessor): method __init__ (line 21) | def __init__( method from_config (line 41) | def from_config(cls, cfg=None): class ClipImageEvalProcessor (line 63) | class ClipImageEvalProcessor(BlipImageBaseProcessor): method __init__ (line 64) | def __init__(self, image_size=224, mean=None, std=None): method from_config (line 79) | def from_config(cls, cfg=None): FILE: lavis/processors/functional_video.py function _is_tensor_video_clip (line 13) | def _is_tensor_video_clip(clip): function crop (line 23) | def crop(clip, i, j, h, w): function resize (line 33) | def resize(clip, target_size, interpolation_mode): function resized_crop (line 43) | def resized_crop(clip, i, j, h, w, size, interpolation_mode="bilinear"): function center_crop (line 63) | def center_crop(clip, crop_size): function to_tensor (line 76) | def to_tensor(clip): function normalize (line 93) | def normalize(clip, mean, std, inplace=False): function hflip (line 112) | def hflip(clip): FILE: lavis/processors/gpt_processors.py class GPTVideoFeatureBaseProcessor (line 39) | class GPTVideoFeatureBaseProcessor(BaseProcessor): method __init__ (line 40) | def __init__(self, visual_ft=["i3d_rgb"], audio_ft=["vggish"]): class GPTDialogueProcessor (line 46) | class GPTDialogueProcessor(BaseProcessor): method __init__ (line 47) | def __init__(self, max_turns=3, use_caption=True): method sample_sequence (line 53) | def sample_sequence(self, caption, history, answer): method padding (line 77) | def padding(self, seq, pad_token=-1): method get_attention_mask (line 85) | def get_attention_mask(self, seq, pad_token=-1): method __call__ (line 90) | def __call__(self, ann): method from_config (line 111) | def from_config(cls, cfg=None): class GPTVideoFeatureProcessor (line 122) | class GPTVideoFeatureProcessor(GPTVideoFeatureBaseProcessor): method __init__ (line 123) | def __init__(self, visual_ft, audio_ft): method padding (line 128) | def padding(self, seq): method get_attention_mask (line 134) | def get_attention_mask(self, seq): method __call__ (line 137) | def __call__(self, ft_root, vname): method from_config (line 164) | def from_config(cls, cfg=None): FILE: lavis/processors/randaugment.py function identity_func (line 15) | def identity_func(img): function autocontrast_func (line 19) | def autocontrast_func(img, cutoff=0): function equalize_func (line 52) | def equalize_func(img): function rotate_func (line 76) | def rotate_func(img, degree, fill=(0, 0, 0)): function solarize_func (line 87) | def solarize_func(img, thresh=128): function color_func (line 97) | def color_func(img, factor): function contrast_func (line 115) | def contrast_func(img, factor): function brightness_func (line 129) | def brightness_func(img, factor): function sharpness_func (line 138) | def sharpness_func(img, factor): function shear_x_func (line 159) | def shear_x_func(img, factor, fill=(0, 0, 0)): function translate_x_func (line 168) | def translate_x_func(img, offset, fill=(0, 0, 0)): function translate_y_func (line 180) | def translate_y_func(img, offset, fill=(0, 0, 0)): function posterize_func (line 192) | def posterize_func(img, bits): function shear_y_func (line 200) | def shear_y_func(img, factor, fill=(0, 0, 0)): function cutout_func (line 209) | def cutout_func(img, pad_size, replace=(0, 0, 0)): function enhance_level_to_args (line 223) | def enhance_level_to_args(MAX_LEVEL): function shear_level_to_args (line 230) | def shear_level_to_args(MAX_LEVEL, replace_value): function translate_level_to_args (line 240) | def translate_level_to_args(translate_const, MAX_LEVEL, replace_value): function cutout_level_to_args (line 250) | def cutout_level_to_args(cutout_const, MAX_LEVEL, replace_value): function solarize_level_to_args (line 258) | def solarize_level_to_args(MAX_LEVEL): function none_level_to_args (line 266) | def none_level_to_args(level): function posterize_level_to_args (line 270) | def posterize_level_to_args(MAX_LEVEL): function rotate_level_to_args (line 278) | def rotate_level_to_args(MAX_LEVEL, replace_value): class RandomAugment (line 326) | class RandomAugment(object): method __init__ (line 327) | def __init__(self, N=2, M=10, isPIL=False, augs=[]): method get_random_ops (line 336) | def get_random_ops(self): method __call__ (line 340) | def __call__(self, img): class VideoRandomAugment (line 352) | class VideoRandomAugment(object): method __init__ (line 353) | def __init__(self, N=2, M=10, p=0.0, tensor_in_tensor_out=True, augs=[]): method get_random_ops (line 363) | def get_random_ops(self): method __call__ (line 367) | def __call__(self, frames): method _aug (line 386) | def _aug(self, img, ops, apply_or_not): FILE: lavis/processors/transforms_video.py class RandomCropVideo (line 31) | class RandomCropVideo(RandomCrop): method __init__ (line 32) | def __init__(self, size): method __call__ (line 38) | def __call__(self, clip): method __repr__ (line 49) | def __repr__(self) -> str: class RandomResizedCropVideo (line 53) | class RandomResizedCropVideo(RandomResizedCrop): method __init__ (line 54) | def __init__( method __call__ (line 74) | def __call__(self, clip): method __repr__ (line 85) | def __repr__(self) -> str: class CenterCropVideo (line 89) | class CenterCropVideo: method __init__ (line 90) | def __init__(self, crop_size): method __call__ (line 96) | def __call__(self, clip): method __repr__ (line 106) | def __repr__(self) -> str: class NormalizeVideo (line 110) | class NormalizeVideo: method __init__ (line 119) | def __init__(self, mean, std, inplace=False): method __call__ (line 124) | def __call__(self, clip): method __repr__ (line 131) | def __repr__(self) -> str: class ToTensorVideo (line 135) | class ToTensorVideo: method __init__ (line 141) | def __init__(self): method __call__ (line 144) | def __call__(self, clip): method __repr__ (line 153) | def __repr__(self) -> str: class RandomHorizontalFlipVideo (line 157) | class RandomHorizontalFlipVideo: method __init__ (line 164) | def __init__(self, p=0.5): method __call__ (line 167) | def __call__(self, clip): method __repr__ (line 178) | def __repr__(self) -> str: FILE: lavis/runners/runner_base.py class RunnerBase (line 39) | class RunnerBase: method __init__ (line 47) | def __init__(self, cfg, task, model, datasets, job_id): method device (line 69) | def device(self): method use_distributed (line 76) | def use_distributed(self): method model (line 80) | def model(self): method optimizer (line 102) | def optimizer(self): method scaler (line 134) | def scaler(self): method lr_scheduler (line 144) | def lr_scheduler(self): method dataloaders (line 176) | def dataloaders(self) -> dict: method cuda_enabled (line 275) | def cuda_enabled(self): method max_epoch (line 279) | def max_epoch(self): method log_freq (line 283) | def log_freq(self): method init_lr (line 288) | def init_lr(self): method min_lr (line 292) | def min_lr(self): method accum_grad_iters (line 296) | def accum_grad_iters(self): method valid_splits (line 300) | def valid_splits(self): method test_splits (line 309) | def test_splits(self): method train_splits (line 315) | def train_splits(self): method evaluate_only (line 324) | def evaluate_only(self): method use_dist_eval_sampler (line 331) | def use_dist_eval_sampler(self): method resume_ckpt_path (line 335) | def resume_ckpt_path(self): method train_loader (line 339) | def train_loader(self): method setup_output_dir (line 344) | def setup_output_dir(self): method train (line 359) | def train(self): method evaluate (line 418) | def evaluate(self, cur_epoch="best", skip_reload=False): method train_epoch (line 429) | def train_epoch(self, epoch): method eval_epoch (line 446) | def eval_epoch(self, split_name, cur_epoch, skip_reload=False): method unwrap_dist_model (line 480) | def unwrap_dist_model(self, model): method create_loaders (line 486) | def create_loaders( method _save_checkpoint (line 568) | def _save_checkpoint(self, cur_epoch, is_best=False): method _reload_best_model (line 597) | def _reload_best_model(self, model): method _load_checkpoint (line 617) | def _load_checkpoint(self, url_or_filename): method log_stats (line 642) | def log_stats(self, stats, split_name): method log_config (line 651) | def log_config(self): FILE: lavis/runners/runner_iter.py class RunnerIter (line 25) | class RunnerIter(RunnerBase): method __init__ (line 41) | def __init__(self, cfg, task, model, datasets, job_id): method max_epoch (line 57) | def max_epoch(self): method cur_epoch (line 61) | def cur_epoch(self): method _progress (line 68) | def _progress(self, cur_iters): method train (line 71) | def train(self): method train_iters (line 137) | def train_iters(self, epoch, start_iters): method _save_checkpoint (line 156) | def _save_checkpoint(self, cur_iters, is_best=False): method _load_checkpoint (line 171) | def _load_checkpoint(self, url_or_filename): method dataloaders (line 196) | def dataloaders(self) -> dict: FILE: lavis/tasks/__init__.py function setup_task (line 21) | def setup_task(cfg): FILE: lavis/tasks/base_task.py class BaseTask (line 19) | class BaseTask: method __init__ (line 20) | def __init__(self, **kwargs): method setup_task (line 26) | def setup_task(cls, **kwargs): method build_model (line 29) | def build_model(self, cfg): method build_datasets (line 35) | def build_datasets(self, cfg): method train_step (line 61) | def train_step(self, model, samples): method valid_step (line 65) | def valid_step(self, model, samples): method before_evaluation (line 68) | def before_evaluation(self, model, dataset, **kwargs): method after_evaluation (line 71) | def after_evaluation(self, **kwargs): method inference_step (line 74) | def inference_step(self): method evaluation (line 77) | def evaluation(self, model, data_loader, cuda_enabled=True): method train_epoch (line 97) | def train_epoch( method train_iters (line 122) | def train_iters( method _train_inner_loop (line 150) | def _train_inner_loop( method save_result (line 244) | def save_result(result, result_dir, filename, remove_duplicate=""): FILE: lavis/tasks/captioning.py class CaptionTask (line 17) | class CaptionTask(BaseTask): method __init__ (line 18) | def __init__(self, num_beams, max_len, min_len, evaluate, report_metri... method setup_task (line 29) | def setup_task(cls, cfg): method valid_step (line 47) | def valid_step(self, model, samples): method after_evaluation (line 65) | def after_evaluation(self, val_result, split_name, epoch, **kwargs): method _report_metrics (line 83) | def _report_metrics(self, eval_result_file, split_name): function coco_caption_eval (line 109) | def coco_caption_eval(coco_gt_root, results_file, split): FILE: lavis/tasks/dialogue.py class DialogueTask (line 21) | class DialogueTask(BaseTask): method __init__ (line 22) | def __init__(self, num_beams, max_len, min_len, evaluate, report_metri... method setup_task (line 33) | def setup_task(cls, cfg): method valid_step (line 51) | def valid_step(self, model, samples): method after_evaluation (line 57) | def after_evaluation(self, val_result, split_name, epoch, **kwargs): method _report_metrics (line 68) | def _report_metrics(self, eval_result_file, split_name): function coco_dialogue_eval (line 93) | def coco_dialogue_eval(coco_gt_root, results_file, split): FILE: lavis/tasks/image_text_pretrain.py class ImageTextPretrainTask (line 13) | class ImageTextPretrainTask(BaseTask): method __init__ (line 14) | def __init__(self): method evaluation (line 17) | def evaluation(self, model, data_loader, cuda_enabled=True): FILE: lavis/tasks/multimodal_classification.py class MultimodalClassificationTask (line 20) | class MultimodalClassificationTask(BaseTask): method __init__ (line 21) | def __init__(self): method valid_step (line 24) | def valid_step(self, model, samples): method after_evaluation (line 51) | def after_evaluation(self, val_result, split_name, epoch, **kwargs): method _report_metrics (line 66) | def _report_metrics(self, eval_result_file, split_name): FILE: lavis/tasks/retrieval.py class RetrievalTask (line 20) | class RetrievalTask(BaseTask): method __init__ (line 21) | def __init__(self, cfg): method setup_task (line 27) | def setup_task(cls, cfg): method evaluation (line 32) | def evaluation(self, model, data_loader, **kwargs): method after_evaluation (line 49) | def after_evaluation(self, val_result, **kwargs): method _report_metrics (line 54) | def _report_metrics(scores_i2t, scores_t2i, txt2img, img2txt): FILE: lavis/tasks/vqa.py class VQATask (line 23) | class VQATask(BaseTask): method __init__ (line 24) | def __init__( method setup_task (line 51) | def setup_task(cls, cfg): method build_datasets (line 74) | def build_datasets(self, cfg): method valid_step (line 100) | def valid_step(self, model, samples): method after_evaluation (line 120) | def after_evaluation(self, val_result, split_name, **kwargs): method _report_metrics (line 133) | def _report_metrics(self, result_file, split): class GQATask (line 173) | class GQATask(VQATask): method valid_step (line 174) | def valid_step(self, model, samples): method _report_metrics (line 197) | def _report_metrics(self, result_file, split): class AOKVQATask (line 237) | class AOKVQATask(VQATask): method valid_step (line 238) | def valid_step(self, model, samples): method _report_metrics (line 262) | def _report_metrics(self, result_file, split): method _save_result_leaderboard (line 299) | def _save_result_leaderboard(self, results): class FrameQA (line 320) | class FrameQA(BaseTask): method __init__ (line 321) | def __init__(self): method valid_step (line 325) | def valid_step(self, model, samples): method after_evaluation (line 351) | def after_evaluation(self, val_result, split_name, epoch, **kwargs): method _report_metrics (line 365) | def _report_metrics(self, eval_result_file, split_name): class VideoQA (line 419) | class VideoQA(BaseTask): method __init__ (line 420) | def __init__(self): method valid_step (line 424) | def valid_step(self, model, samples): method after_evaluation (line 454) | def after_evaluation(self, val_result, split_name, epoch, **kwargs): method _report_metrics (line 468) | def _report_metrics(self, eval_result_file, split_name): class MR (line 509) | class MR(BaseTask): method __init__ (line 510) | def __init__(self): method valid_step (line 514) | def valid_step(self, model, samples): method after_evaluation (line 541) | def after_evaluation(self, val_result, split_name, epoch, **kwargs): method _report_metrics (line 555) | def _report_metrics(self, eval_result_file, split_name): FILE: lavis/tasks/vqa_reading_comprehension.py class VQARCTask (line 23) | class VQARCTask(VQATask): method __init__ (line 24) | def __init__( method setup_task (line 39) | def setup_task(cls, cfg): method valid_step (line 61) | def valid_step(self, model, samples): method after_evaluation (line 93) | def after_evaluation(self, val_result, split_name, **kwargs): method save_gradcam (line 122) | def save_gradcam(self, result, result_dir, filename, remove_duplicate=... class GQARCTask (line 157) | class GQARCTask(VQARCTask): method valid_step (line 158) | def valid_step(self, model, samples): method _report_metrics (line 193) | def _report_metrics(self, result_file, split): method _save_result_leaderboard (line 232) | def _save_result_leaderboard(self, results): FILE: setup.py function fetch_requirements (line 16) | def fetch_requirements(filename): FILE: train.py function parse_args (line 35) | def parse_args(): function setup_seeds (line 54) | def setup_seeds(config): function get_runner_class (line 65) | def get_runner_class(cfg): function main (line 74) | def main():