python_code
stringlengths
0
992k
repo_name
stringlengths
8
46
file_path
stringlengths
5
162
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch import nn fro...
EXA-1-master
exa/libraries/multimodal-main/tests/models/flava/test_image_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from math import inf import pytest import torch from tests.test_utils import assert_expected, set_rng_seed fro...
EXA-1-master
exa/libraries/multimodal-main/tests/models/clip/test_text_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/models/clip/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.mode...
EXA-1-master
exa/libraries/multimodal-main/tests/models/clip/test_clip.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.mode...
EXA-1-master
exa/libraries/multimodal-main/tests/models/clip/test_checkpoint.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch import Tensor...
EXA-1-master
exa/libraries/multimodal-main/tests/models/clip/test_image_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch i...
EXA-1-master
exa/libraries/multimodal-main/tests/models/albef/test_albef.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/models/albef/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch import Tensor ...
EXA-1-master
exa/libraries/multimodal-main/tests/models/albef/test_multimodal_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch import Tensor...
EXA-1-master
exa/libraries/multimodal-main/tests/models/albef/test_image_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.mo...
EXA-1-master
exa/libraries/multimodal-main/tests/models/mdetr/test_text_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.mod...
EXA-1-master
exa/libraries/multimodal-main/tests/models/mdetr/test_mdetr.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/models/mdetr/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.mod...
EXA-1-master
exa/libraries/multimodal-main/tests/models/mdetr/test_transformer.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.m...
EXA-1-master
exa/libraries/multimodal-main/tests/models/mdetr/test_image_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.tra...
EXA-1-master
exa/libraries/multimodal-main/tests/transforms/test_video_transform.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/transforms/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.tra...
EXA-1-master
exa/libraries/multimodal-main/tests/transforms/test_bert_text_transform.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, get_asset_path, set_rng_seed from tor...
EXA-1-master
exa/libraries/multimodal-main/tests/transforms/test_clip_transform.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.tran...
EXA-1-master
exa/libraries/multimodal-main/tests/transforms/test_flava_transform.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/modules/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch import Tensor...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/losses/test_albef.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/modules/losses/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import random import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/losses/test_mdetr_losses.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from tests.test_utils import assert_expected from torchmultimodal.modules.losses....
EXA-1-master
exa/libraries/multimodal-main/tests/modules/losses/test_commitment.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from itertools import chain from typing import List import pytest import torch import torch.multiprocessing a...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/losses/test_contrastive_loss_with_temperature.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/modules/fusions/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from torch import nn from torchmultimodal.modules.fusions.deepset_fusion import (...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/fusions/test_deepset_fusion.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from torchmultimodal.modules.fusions.attention_fusion import AttentionFusionModul...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/fusions/test_attention_fusion.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from functools import partial import torch from tests.test_utils import assert_expected, set_r...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_mlp.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected from torch import nn from torchmultimod...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_multi_head_attention.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import torch from tests.test_utils import assert_expected from torchmultimodal.modules.layers.activation impor...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_activation.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import torch from torchmultimodal.modules.layers.normalizations import Fp32GroupNorm, Fp32LayerNorm def test_...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_normalizations.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected from torch import nn from torchmultimo...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_position_embedding.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import warnings from collections import OrderedDict import pytest import torch from tests.test_utils import a...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_codebook.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from itertools import repeat import pytest import torch from tests.test_utils import assert_expected, set_rng...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_attention.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torchmultimodal.modu...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_text_embedding.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch import nn fro...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_transformer.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import warnings from itertools import product import torch from tests.test_utils import assert...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/layers/test_conv.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from torch import nn from torchmultimodal.modules.encoders.mil_encoder import MIL...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/encoders/test_mil_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from tests.test_utils import assert_expected from torch import nn from torchmulti...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/encoders/test_weighted_embedding_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from tests.test_utils import set_rng_seed from torchmultimodal.modules.encoders....
EXA-1-master
exa/libraries/multimodal-main/tests/modules/encoders/test_swin_transformer_3d_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/tests/modules/encoders/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from tests.test_utils import assert_expected, set_rng_seed from torch import Tensor ...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/encoders/test_bert_text_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from tests.test_utils import assert_expected from torch import nn from torchmulti...
EXA-1-master
exa/libraries/multimodal-main/tests/modules/encoders/test_embedding_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import torch from torch import nn class LSTMEncoder(nn.Module): """An LSTM encoder. Stacks an LSTM on an ...
EXA-1-master
exa/libraries/multimodal-main/examples/cnn_lstm/lstm_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List from examples.cnn_lstm.cnn_encoder import CNNEncoder from examples.cnn_lstm.lstm_encod...
EXA-1-master
exa/libraries/multimodal-main/examples/cnn_lstm/cnn_lstm.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List import torch from torch import nn class CNNEncoder(nn.Module): """A CNN encoder....
EXA-1-master
exa/libraries/multimodal-main/examples/cnn_lstm/cnn_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from examples.cnn_lstm.cnn_lstm import cnn_lstm_classifier from tests.test_utils im...
EXA-1-master
exa/libraries/multimodal-main/examples/cnn_lstm/tests/test_cnn_lstm.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from examples.cnn_lstm.cnn_encoder import CNNEncoder from tests.test_utils import a...
EXA-1-master
exa/libraries/multimodal-main/examples/cnn_lstm/tests/test_cnn_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from examples.cnn_lstm.lstm_encoder import LSTMEncoder from tests.test_utils import...
EXA-1-master
exa/libraries/multimodal-main/examples/cnn_lstm/tests/test_lstm_encoder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Tuple from omegaconf im...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/definitions.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/flava/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Tuple import torch from pytorch_lightning import LightningModule from torchmetrics imp...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/model.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import torch from flava.data.transforms import ( default_image_pretraining_...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/coco_zero_shot.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from flava.definitions import ( FLAVAArguments, TrainingArguments, TrainingSingleDatasetInfo, ) fro...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/utils.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from common.data import MultiDataModule from flava.callbacks.multimodal_eval import MultimodalEvalCallback from...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/train.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from flava.data import TextDataModule, TorchVisionDataModule from flava.data.datamodules import VLDataModule fr...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/finetune.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import argparse import torch from torchmultimodal.models.flava.model import flava_model_for_pretraining KEY_R...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/tools/convert_weights.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/flava/native/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Tuple import torch from torch import nn from torchmultimodal.models.flava.model import...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/native/model.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import random from typing import Any import torch from flava.data.imagenet_zeroshot_data import ( ...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/native/utils.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # example command to train: # `torchrun --nproc_per_node=8 -m flava.native.train config=flava/native/configs/pr...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/native/train.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os from functools import partial from typing import Any, Callable, Dict, List, Optional, Tuple, Union i...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/native/data.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import logging import torch from flava.data import default_text_transform, VL_MAX_LENGTH_DEFAULT from flava.da...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/callbacks/multimodal_eval.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from .multimodal_eval import * # noqa F401
EXA-1-master
exa/libraries/multimodal-main/examples/flava/callbacks/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import random from functools import partial from typing import Any, Callable, Optional import torch from torch...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/data/transforms.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from .transforms import * # noqa F401 from .utils import * # noqa F401 from .imagenet_zeroshot_data import * ...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/data/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import time from concurrent.futures import ThreadPoolExecutor from functools import partial from typing import ...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/data/utils.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os from functools import partial from typing import Any, Callable, Dict, List, Optional, Tuple, Union i...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/data/datamodules.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # File taken from https://github.com/mlfoundations/open_clip/ imagenet_classnames = [ "tench", "goldf...
EXA-1-master
exa/libraries/multimodal-main/examples/flava/data/imagenet_zeroshot_data.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy import hashlib import os from typing import Optional import torch from torch import nn def store...
EXA-1-master
exa/libraries/multimodal-main/examples/utils/common.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # This file is modified from: # https://github.com/pytorch/vision/blob/main/references/classification/utils.py ...
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/utils.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # Based on https://github.com/pytorch/vision/blob/main/references/classification/train.py import argparse impo...
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/train.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # Modified from https://github.com/pytorch/vision/blob/main/references/classification/transforms.py import mat...
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/data/transforms.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import omnivore.data.transforms as CT # custom transforms import torch import torchvision.transforms as T from...
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/data/presets.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os from pathlib import Path import PIL import scipy.io import torch import torchvision import torchvisi...
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/data/datasets.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/data/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # This file, data_builder.py, consists of functions to build the dataset # for training in torchmultimodal/exam...
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/data/data_builder.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import math from typing import List, Optional import torch from torch import Tensor from torchvision.transform...
EXA-1-master
exa/libraries/multimodal-main/examples/omnivore/data/rand_aug3d.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/common/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import random import warnings from functools import partial from typing import Callable, List, Optional import...
EXA-1-master
exa/libraries/multimodal-main/examples/common/data/multidata.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from .multidata import * # noqa F401
EXA-1-master
exa/libraries/multimodal-main/examples/common/data/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/albef/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import argparse import datetime import os import random import time import ruamel.yaml as yaml import torch im...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/finetune_vqa.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import copy from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch import torch.nn....
EXA-1-master
exa/libraries/multimodal-main/examples/albef/model.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed un...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/utils.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import argparse import datetime import os import random import time import ruamel.yaml as yaml import torch im...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/finetune_retrieval.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import re from typing import List, Tuple, Union import torch from torchtext.transforms import PadTransform, S...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/data/transforms.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List, Optional, Tuple import torch from data.transforms import ( ALBEFTextTransform, ...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/data/vqa_datamodules.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree.
EXA-1-master
exa/libraries/multimodal-main/examples/albef/data/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import json import os from typing import Callable, List, Tuple, Union from PIL import Image from torch import ...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/data/retrieval_dataset.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List, Optional, Tuple import torch from data.retrieval_dataset import ( ImageToTextRetr...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/data/retrieval_datamodule.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import json import os from typing import Callable, List, Tuple, Union import torch from PIL import Image from...
EXA-1-master
exa/libraries/multimodal-main/examples/albef/data/vqa_dataset.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from typing import List, Tuple import torch import torch.nn.functional as F from scipy.optimize import linear_...
EXA-1-master
exa/libraries/multimodal-main/examples/mdetr/matcher.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import argparse import datetime import json import math import random import sys import time from copy import d...
EXA-1-master
exa/libraries/multimodal-main/examples/mdetr/vqa_finetune.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import argparse import json import random from copy import deepcopy from pathlib import Path import numpy as n...
EXA-1-master
exa/libraries/multimodal-main/examples/mdetr/phrase_grounding.py