python_code stringlengths 0 992k | repo_name stringlengths 8 46 | file_path stringlengths 5 162 |
|---|---|---|
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from collections import OrderedDict
import json
import os
import torch
from PIL import Image
fro... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/aok_vqa_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from collections import OrderedDict
from lavis.datasets.datasets.multimodal_classificat... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/snli_ve_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
from lavis.datasets.datasets.base_dataset import BaseDataset
class VQADataset(Base... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/vqa_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
import json
from PIL import Image
from lavis.datasets.datasets.vqa_datasets import VQA... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/coco_vqa_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
import json
from PIL import Image
from lavis.datasets.datasets.vqa_datasets import VQA... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/gqa_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
from lavis.datasets.datasets.dialogue_datasets import (
DialogueDataset,
Dial... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/avsd_dialogue_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from collections import OrderedDict
from lavis.datasets.datasets.base_dataset import Ba... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/caption_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from collections import OrderedDict
from lavis.datasets.datasets.base_dataset import Ba... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/datasets/retrieval_datasets.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from pathlib import Path
from omegaconf import OmegaConf
from lavis.common.utils impor... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_flickr.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from pathlib import Path
from omegaconf import OmegaConf
from lavis.common.utils impor... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_msvd.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import json
import logging
import os
import time
from multiprocessing import Pool
import numpy as... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_nocaps.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from pathlib import Path
from omegaconf import OmegaConf
from lavis.common.utils impor... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_gqa.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from pathlib import Path
from omegaconf import OmegaConf
from lavis.common.utils impor... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_didemo.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from pathlib import Path
from omegaconf import OmegaConf
from lavis.common.utils impor... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_coco.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from pathlib import Path
from omegaconf import OmegaConf
from lavis.common.utils impor... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_vg.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
from pathlib import Path
from omegaconf import OmegaConf
from lavis.common.utils impor... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_msrvtt.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import io
import os
import pathlib
import urllib
import tqdm
from concurrent.futures import Threa... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/download_sbu.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import time
from PIL import Image
from lavis.common.utils import get_abs_path, get_cache_path
from... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/DownloadConceptualCaptions/download_data_cc12m.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import glob
from pathlib import Path
import time
from omegaconf import OmegaConf
import pandas as ... | EXA-1-master | exa/libraries/LAVIS/lavis/datasets/download_scripts/DownloadConceptualCaptions/download_data_cc3m.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on huggingface code base
https://github.com/huggingface/transformers/blob/v4.15.0/src/transfo... | EXA-1-master | exa/libraries/LAVIS/lavis/models/med.py |
from collections import OrderedDict
from itertools import repeat
import collections.abc
import math
import torch
import torch.nn.functional as F
from torch import nn
from fairscale.nn.checkpoint.checkpoint_activations import checkpoint_wrapper
from lavis.models.eva_vit import convert_weights_to_fp16
from lavis.commo... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_vit.py |
# Based on EVA, BEIT, timm and DeiT code bases
# https://github.com/baaivision/EVA
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/facebookresearch/deit/
# https://github.com/facebookresearch/dino
# -------------------------... | EXA-1-master | exa/libraries/LAVIS/lavis/models/eva_vit.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import torch
from omegaconf import OmegaConf
from lavis.common.registry import regi... | EXA-1-master | exa/libraries/LAVIS/lavis/models/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import os
import numpy as np
import torch
import torch.nn as nn
from lavis.common.... | EXA-1-master | exa/libraries/LAVIS/lavis/models/base_model.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on timm code base
https://github.com/rwightman/pytorch-image-models/tree/master/timm
"""
imp... | EXA-1-master | exa/libraries/LAVIS/lavis/models/vit.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
import torch.nn as nn
from itertools import chain
from lavis.common.registry import r... | EXA-1-master | exa/libraries/LAVIS/lavis/models/pnp_vqa_models/pnp_vqa.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
def prepare_qa_input(sample, num_captions, num_captions_fid):
sample_question_c... | EXA-1-master | exa/libraries/LAVIS/lavis/models/pnp_vqa_models/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on facebookresearch code base
https://github.com/facebookresearch/FiD
"""
import torch
import... | EXA-1-master | exa/libraries/LAVIS/lavis/models/pnp_vqa_models/pnp_unifiedqav2_fid.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from copy import deepcopy
import torch
import torch.nn.functional as F
from lavis.common.registry... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/albef_retrieval.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from dataclasses import dataclass
from typing import Optional
import torch
from transformers.mode... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/albef_outputs.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import datetime
import logging
import os
import time
import lavis.common.dist_utils as dist_utils... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import warnings
import torch
import torch.nn.functional as F
from lavis.common.registry import re... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/albef_feature_extractor.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import os
from copy import deepcopy
import torch
import torch.nn.functional as F
f... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/albef_vqa.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from copy import deepcopy
import torch
import torch.nn.functional as F
from lavis.common.registry... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/albef_nlvr.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import warnings
from copy import deepcopy
import torch
import torch.nn.functional as F
from lavis... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/albef_classification.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from copy import deepcopy
import numpy as np
import torch
import torch.nn.functional as F
from la... | EXA-1-master | exa/libraries/LAVIS/lavis/models/albef_models/albef_pretrain.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
import torch.nn as nn
from lavis.common.registry import registry
from lavis.models.ba... | EXA-1-master | exa/libraries/LAVIS/lavis/models/gpt_models/gpt_dialogue.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
| EXA-1-master | exa/libraries/LAVIS/lavis/models/img2prompt_models/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
(CVPR 23') From Images to Textual Prompts: Zero-shot VQA with Frozen Large Language Models,
by Jiaxi... | EXA-1-master | exa/libraries/LAVIS/lavis/models/img2prompt_models/img2prompt_vqa.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from copy import deepcopy
import torch
import torch.nn.functional as F
from lavis.common.registry... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_classification.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
import torch.nn.functional as F
from lavis.common.registry import registry
from lavis... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_vqa.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
from typing import List
from torch import nn
def tie_encoder_decoder_weights(
... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
import torch.nn.functional as F
from lavis.common.registry import registry
from lavis... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_image_text_matching.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import os
import torch
from lavis.common.dist_utils import download_cached_file
fr... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import math
from typing import Tuple
import torch
import torch.utils.checkpoint
from torch import... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/nlvr_encoder.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
from lavis.common.registry import registry
from lavis.models.blip_models.blip import... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_caption.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import warnings
import torch
import torch.nn.functional as F
from lavis.common.registry import re... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_feature_extractor.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from copy import deepcopy
import torch
import torch.nn.functional as F
from lavis.common.registry... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_retrieval.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from dataclasses import dataclass
from typing import Optional
import torch
from transformers.mode... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_outputs.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
import torch
import torch.nn.functional as F
from lavis.common.dist_utils import downlo... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_nlvr.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from copy import deepcopy
import torch
import torch.nn.functional as F
from lavis.common.registry... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip_models/blip_pretrain.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/facebookresearch/TimeSformer
"""
# Copyright 2020 Ross Wightman
# Conv2d... | EXA-1-master | exa/libraries/LAVIS/lavis/models/timesformer/conv2d_same.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
""" Linear layer (alternate definition)
"""
import torch
import torch.nn.functional as F
from torc... | EXA-1-master | exa/libraries/LAVIS/lavis/models/timesformer/linear.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/facebookresearch/TimeSformer
"""
| EXA-1-master | exa/libraries/LAVIS/lavis/models/timesformer/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/facebookresearch/TimeSformer
"""
# Copyright 2020 Ross Wightman
from co... | EXA-1-master | exa/libraries/LAVIS/lavis/models/timesformer/features.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/facebookresearch/TimeSformer
"""
# Copyright (c) Facebook, Inc. and its ... | EXA-1-master | exa/libraries/LAVIS/lavis/models/timesformer/vit.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/facebookresearch/TimeSformer
"""
# Copyright 2020 Ross Wightman
# Variou... | EXA-1-master | exa/libraries/LAVIS/lavis/models/timesformer/vit_utils.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/facebookresearch/TimeSformer
"""
# Copyright (c) Facebook, Inc. and its ... | EXA-1-master | exa/libraries/LAVIS/lavis/models/timesformer/helpers.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
import torch.nn.functional as F
from lavis.common.registry import registry
from lavis... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/blip2_image_text_matching.py |
"""
Copyright (c) 2023, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import torch
import torch.nn as nn
from torch.cuda.amp import autocast as autocast
... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/blip2_t5.py |
"""
Copyright (c) 2023, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.cuda... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/blip2_qformer.py |
EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/__init__.py | |
"""
Copyright (c) 2023, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import torch
from torch.cuda.amp import autocast as autocast
import torch.nn as nn
... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/blip2_opt.py |
# coding=utf-8
# Copyright 2018 Mesh TensorFlow authors, T5 Authors and HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/modeling_t5.py |
# coding=utf-8
# Copyright 2022 The Fairseq Authors and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/modeling_opt.py |
"""
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
* By Junnan Li
* Based on huggingface code base
* https://github.com/huggingface/transformer... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/Qformer.py |
"""
Copyright (c) 2023, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import contextlib
import logging
import os
import time
import datetime
import torch
import torch.n... | EXA-1-master | exa/libraries/LAVIS/lavis/models/blip2_models/blip2.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
from dataclasses import dataclass
from typi... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/clip_outputs.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
import hashlib
import os
import urllib
impor... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/pretrained.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
""" OpenAI pretrained model functions
Adapte... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
""" CLIP Model
Adapted from https://github.c... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/model.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
""" CLIP tokenizer
Copied from https://githu... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/tokenizer.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import torch
import torch.distributed.nn
from torch import distributed as dist, nn ... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/loss.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
from torch import nn as nn
from torchvision.... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/utils.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
from typing import Optional, Sequence, Tuple... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/transform.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
Based on https://github.com/mlfoundations/open_clip
"""
""" timm model adapter
Wraps timm (https://g... | EXA-1-master | exa/libraries/LAVIS/lavis/models/clip_models/timm_model.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from dataclasses import dataclass
from typing import Optional
import torch
from transformers.mode... | EXA-1-master | exa/libraries/LAVIS/lavis/models/alpro_models/alpro_outputs.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import os
import torch
import torch.nn.functional as F
from lavis.common.dist_util... | EXA-1-master | exa/libraries/LAVIS/lavis/models/alpro_models/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import datetime
import logging
import time
import lavis.common.dist_utils as dist_utils
import nu... | EXA-1-master | exa/libraries/LAVIS/lavis/models/alpro_models/alpro_retrieval.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from warnings import warn
import torch
import torch.nn.functional as F
from lavis.common.config i... | EXA-1-master | exa/libraries/LAVIS/lavis/models/alpro_models/alpro_qa.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import warnings
import torch
def _is_tensor_video_clip(clip):
if not torch.is_tensor(clip):... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/functional_video.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import re
from lavis.common.registry import registry
from lavis.processors.base_processor import ... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/blip_processors.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from lavis.common.registry import registry
from lavis.processors.blip_processors import BlipImageB... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/clip_processors.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import torch
from lavis.common.registry import registry
from lavis.datasets.data_utils import load... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/alpro_processors.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from lavis.processors.base_processor import BaseProcessor
from lavis.processors.alpro_processors ... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import re
from lavis.common.registry import registry
from lavis.processors.base_processor import ... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/gpt_processors.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from omegaconf import OmegaConf
class BaseProcessor:
def __init__(self):
self.transf... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/base_processor.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import cv2
import numpy as np
import torch
## aug functions
def identity_func(img):
return ... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/randaugment.py |
#!/usr/bin/env python3
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import numbers
import random
from torchvision.transforms import (
Ran... | EXA-1-master | exa/libraries/LAVIS/lavis/processors/transforms_video.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import math
from lavis.common.registry import registry
@registry.register_lr_scheduler("linear_... | EXA-1-master | exa/libraries/LAVIS/lavis/common/optims.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import logging
import json
from typing import Dict
from omegaconf import OmegaConf
from lavis.com... | EXA-1-master | exa/libraries/LAVIS/lavis/common/config.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
class Registry:
mapping = {
"builder_name_mapping": {},
"task_name_mapping": ... | EXA-1-master | exa/libraries/LAVIS/lavis/common/registry.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import datetime
import logging
import time
from collections import defaultdict, deque
import torc... | EXA-1-master | exa/libraries/LAVIS/lavis/common/logger.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import io
import json
import logging
import os
import pickle
import re
import shutil
import urllib... | EXA-1-master | exa/libraries/LAVIS/lavis/common/utils.py |
import numpy as np
from matplotlib import pyplot as plt
from scipy.ndimage import filters
from skimage import transform as skimage_transform
def getAttMap(img, attMap, blur=True, overlap=True):
attMap -= attMap.min()
if attMap.max() > 0:
attMap /= attMap.max()
attMap = skimage_transform.resize(att... | EXA-1-master | exa/libraries/LAVIS/lavis/common/gradcam.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import datetime
import functools
import os
import torch
import torch.distributed as dist
import t... | EXA-1-master | exa/libraries/LAVIS/lavis/common/dist_utils.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
__author__ = "aagrawal"
| EXA-1-master | exa/libraries/LAVIS/lavis/common/vqa_tools/__init__.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
# coding=utf-8
__author__ = "aagrawal"
# This code is based on the code written by Tsung-Yi Lin ... | EXA-1-master | exa/libraries/LAVIS/lavis/common/vqa_tools/vqa_eval.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
__author__ = "aagrawal"
__version__ = "0.9"
# Interface for accessing the VQA dataset.
# This co... | EXA-1-master | exa/libraries/LAVIS/lavis/common/vqa_tools/vqa.py |
"""
Copyright (c) 2022, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
from lavis.runners.runner_base import RunnerBase
from lavis.runners.runner_iter import RunnerIter
... | EXA-1-master | exa/libraries/LAVIS/lavis/runners/__init__.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.