repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/modeling/roi_heads/keypoint_head/keypoint_head.py | import torch
from .roi_keypoint_feature_extractors import make_roi_keypoint_feature_extractor
from .roi_keypoint_predictors import make_roi_keypoint_predictor
from .inference import make_roi_keypoint_post_processor
from .loss import make_roi_keypoint_loss_evaluator
class ROIKeypointHead(torch.nn.Module):
def __i... | 2,057 | 38.576923 | 86 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/modeling/roi_heads/keypoint_head/roi_keypoint_predictors.py | from torch import nn
from maskrcnn_benchmark import layers
from maskrcnn_benchmark.modeling import registry
@registry.ROI_KEYPOINT_PREDICTOR.register("KeypointRCNNPredictor")
class KeypointRCNNPredictor(nn.Module):
def __init__(self, cfg, in_channels):
super(KeypointRCNNPredictor, self).__init__()
... | 1,273 | 31.666667 | 81 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/structures/image_list.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from __future__ import division
import torch
class ImageList(object):
"""
Structure that holds a list of images (of possibly
varying sizes) as a single tensor.
This works by padding the images to the same size,
and storing in... | 2,485 | 33.054795 | 87 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/structures/segmentation_mask.py | import cv2
import copy
import torch
import numpy as np
from maskrcnn_benchmark.layers.misc import interpolate
from maskrcnn_benchmark.utils import cv2_util
import pycocotools.mask as mask_utils
# transpose
FLIP_LEFT_RIGHT = 0
FLIP_TOP_BOTTOM = 1
""" ABSTRACT
Segmentations come in either:
1) Binary masks
2) Polygons
... | 18,792 | 31.513841 | 94 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/structures/bounding_box.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
# transpose
FLIP_LEFT_RIGHT = 0
FLIP_TOP_BOTTOM = 1
class BoxList(object):
"""
This class represents a set of bounding boxes.
The bounding boxes are represented as a Nx4 Tensor.
In order to uniquely determine the bou... | 9,645 | 35.127341 | 92 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/structures/bounding_box_pair.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license.
import torch
from .bounding_box import BoxList
# transpose
FLIP_LEFT_RIGHT = 0
FLIP_TOP_BOTTOM = 1
class BoxPairList(object):
"""
This class represents a set of ... | 10,477 | 35.894366 | 97 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/structures/boxlist_ops.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license.
import torch
from .bounding_box import BoxList
from maskrcnn_benchmark.layers import nms as _box_nms
def boxlist_nms(boxlist, nms_thresh, max_proposals=-1, score_field... | 4,740 | 28.447205 | 97 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/maskrcnn_benchmark/structures/keypoint.py | import torch
# transpose
FLIP_LEFT_RIGHT = 0
FLIP_TOP_BOTTOM = 1
class Keypoints(object):
def __init__(self, keypoints, size, mode=None):
# FIXME remove check once we have better integration with device
# in my version this would consistently return a CPU tensor
device = keypoints.device ... | 6,555 | 33.687831 | 97 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/checkpoint.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from collections import OrderedDict
import os
from tempfile import TemporaryDirectory
import unittest
import torch
from torch import nn
from maskrcnn_benchmark.utils.model_serialization import load_state_dict
from maskrcnn_benchmark.utils.checkpo... | 4,645 | 38.042017 | 88 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_detectors.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import glob
import os
import copy
import torch
from maskrcnn_benchmark.modeling.detector import build_detection_model
from maskrcnn_benchmark.structures.image_list import to_image_list
import utils
CONFIG_FILES = [
# bbox
... | 4,223 | 28.333333 | 71 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_nms.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import numpy as np
import torch
from maskrcnn_benchmark.layers import nms as box_nms
class TestNMS(unittest.TestCase):
def test_nms_cpu(self):
""" Match unit test UtilsNMSTest.TestNMS in
caffe2/operators/... | 7,612 | 33.292793 | 76 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_backbones.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import copy
import torch
# import modules to to register backbones
from maskrcnn_benchmark.modeling.backbone import build_backbone # NoQA
from maskrcnn_benchmark.modeling import registry
from maskrcnn_benchmark.config import cfg as... | 1,914 | 33.196429 | 75 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_feature_extractors.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import copy
import torch
# import modules to to register feature extractors
from maskrcnn_benchmark.modeling.backbone import build_backbone # NoQA
from maskrcnn_benchmark.modeling.roi_heads.roi_heads import build_roi_heads # NoQA
f... | 3,070 | 31.670213 | 82 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_fbnet.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import numpy as np
import torch
import maskrcnn_benchmark.modeling.backbone.fbnet_builder as fbnet_builder
TEST_CUDA = torch.cuda.is_available()
def _test_primitive(self, device, op_name, op_func, N, C_in, C_out, expand, strid... | 2,845 | 32.482353 | 84 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_predictors.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import copy
import torch
# import modules to to register predictors
from maskrcnn_benchmark.modeling.backbone import build_backbone # NoQA
from maskrcnn_benchmark.modeling.roi_heads.roi_heads import build_roi_heads # NoQA
from mask... | 3,214 | 31.474747 | 82 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_data_samplers.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import itertools
import random
import unittest
from torch.utils.data.sampler import BatchSampler
from torch.utils.data.sampler import Sampler
from torch.utils.data.sampler import SequentialSampler
from torch.utils.data.sampler import RandomSampler... | 5,532 | 34.928571 | 88 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_rpn_heads.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import copy
import torch
# import modules to to register rpn heads
from maskrcnn_benchmark.modeling.backbone import build_backbone # NoQA
from maskrcnn_benchmark.modeling.rpn.rpn import build_rpn # NoQA
from maskrcnn_benchmark.mode... | 1,992 | 30.634921 | 71 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_segmentation_mask.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import torch
from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask
class TestSegmentationMask(unittest.TestCase):
def __init__(self, method_name='runTest'):
super(TestSegmentationMask, self).__in... | 2,414 | 33.5 | 76 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/tests/test_box_coder.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import numpy as np
import torch
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
class TestBoxCoder(unittest.TestCase):
def test_box_decoder(self):
""" Match unit test UtilsBoxesTest.TestBboxTransformRandom... | 3,112 | 27.3 | 80 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/demo/webcam.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import argparse
import cv2
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
import time
def main():
parser = argparse.ArgumentParser(description="PyTorch Object Detection Webcam Demo")
parser.add_argument(
... | 2,329 | 27.765432 | 88 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/scene_graph_benchmark/demo/predictor.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import cv2
import torch
from torchvision import transforms as T
from torchvision.transforms import functional as F
from maskrcnn_benchmark.modeling.detector import build_detection_model
from maskrcnn_benchmark.utils.checkpoint import DetectronCheck... | 16,555 | 34.076271 | 91 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/run_oscarplus_pretrain.py | from __future__ import absolute_import, division, print_function
import argparse
import datetime
import json
import logging
import os
import random
import sys
import time
import math
import shutil
sys.path.insert(0, '.')
import numpy as np
import torch
from oscar.modeling.modeling_bert import BertImgForPreTraining
... | 24,128 | 42.870909 | 143 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/run_captioning.py | # Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license.
import argparse
import base64
import numpy as np
import os
import os.path as op
import random, time, json
import torch
import torch.distributed as dist
from torch.utils.data import Dataset
from tqdm import tqdm
from oscar.utils.logger import ... | 46,733 | 44.727984 | 113 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/run_nlvr.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not... | 48,792 | 51.749189 | 695 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/run_retrieval.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
from __future__ import absolute_import, division, print_function
import argparse
import os
import base64
import os.path as op
import random, json
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, Data... | 34,588 | 51.013534 | 111 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/run_vqa.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
from __future__ import absolute_import, division, print_function
import argparse
import glob
import logging
import os
import copy, time, json
import base64
import sys
sys.path.insert(0, '.')
import numpy as np
import torch
import torch.nn a... | 62,932 | 50.373878 | 188 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/run_gqa.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
from __future__ import absolute_import, division, print_function
import argparse
import glob
import logging
import os
import copy, time, json
import sys
sys.path.insert(0, '.')
import numpy as np
import torch
import torch.nn as nn
from torc... | 56,065 | 50.673733 | 171 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/datasets/oscar_tsv.py | import os
import time
import json
import logging
import random
import glob
import base64
from tqdm import tqdm
import numpy as np
import torch
from torch.utils.data import Dataset
from oscar.utils.tsv_file import TSVFile
from oscar.utils.misc import load_from_yaml_file
class OscarTSVDataset(Dataset):
def __init__... | 36,789 | 44.872818 | 162 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/datasets/build.py | import os
import logging
import torch
from oscar.utils.misc import get_world_size
from .oscar_tsv import OscarTSVDataset
from transformers2.pytorch_transformers import BertTokenizer
class BatchCollator(object):
"""
From a list of samples from the dataset,
returns the images and targets.
"""
def __... | 4,952 | 31.801325 | 80 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/utils/caption_evaluate.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
from collections import OrderedDict, defaultdict
import json
import numpy as np
import os.path as op
from pprint import pprint
import torch
import re
import subprocess
import tempfile
import time
from typing import Dict, Optional
from coco_c... | 12,968 | 37.369822 | 111 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/utils/metric_logger.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from collections import defaultdict
from collections import deque
import os
import torch
from .misc import is_main_process
class SmoothedValue(object):
"""Track a series of values and provide access to smoothed values over a
window or t... | 6,884 | 36.016129 | 82 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/utils/misc.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
import errno
import os
import os.path as op
import yaml
import random
import torch
import numpy as np
import torch.distributed as dist
def mkdir(path):
# if it is the current folder, skip.
if path == '':
return
try:
... | 1,394 | 19.820896 | 77 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/utils/task_utils.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
from __future__ import absolute_import, division, print_function
import csv, json
import logging
import os
import sys
from io import open
import _pickle as cPickle
import torch
logger = logging.getLogger(__name__)
class InputInstance(obje... | 24,589 | 40.327731 | 154 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/utils/cbs.py | # Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license.
# Copyright (c) 2019, Yufei Wang, Karan Desai. Licensed under the MIT license.
# Code is modified from https://github.com/nocaps-org/updown-baseline
import anytree
import base64
import json
import numpy as np
import os.path as op
import torch... | 39,639 | 45.200466 | 132 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/modeling/modeling_utils.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import logging
import torch
import torch.nn.functional as F
from transformers2.pytorch_transformers.modeling_bert import (BertConfig,
load_... | 43,413 | 48.616 | 245 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/oscar/modeling/modeling_bert.py | # Copyright (c) 2020 Microsoft Corporation. Licensed under the MIT license.
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss, MSELoss
from transformers2.... | 50,651 | 48.610186 | 175 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/setup.py | """
Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py
To create the package for pypi.
1. Change the version in __init__.py and setup.py.
2. Commit these changes with the message: "Release: VERSION"
3. Add a tag in git to mark the release: "git tag VERSION -m'Adds tag VER... | 2,907 | 38.835616 | 120 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/hubconf.py | dependencies = ['torch', 'tqdm', 'boto3', 'requests', 'regex']
from hubconfs.bert_hubconf import (
bertTokenizer,
bertModel,
bertForNextSentencePrediction,
bertForPreTraining,
bertForMaskedLM,
bertForSequenceClassification,
bertForMultipleChoice,
bertForQuestionAnswering,
bertForTok... | 723 | 22.354839 | 62 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/hubconfs/bert_hubconf.py | from pytorch_transformers.tokenization_bert import BertTokenizer
from pytorch_transformers.modeling_bert import (
BertModel,
BertForNextSentencePrediction,
BertForMaskedLM,
BertForMultipleChoice,
BertForPreTraining,
BertForQuestionAnswering,
BertForSequenceClassif... | 17,259 | 46.811634 | 137 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/hubconfs/xlm_hubconf.py | from pytorch_transformers.tokenization_xlm import XLMTokenizer
from pytorch_transformers.modeling_xlm import (
XLMConfig,
XLMModel,
XLMWithLMHeadModel,
XLMForSequenceClassification,
XLMForQuestionAnswering
)
# A lot of models share the same param doc. Use a decorator
# to save typing
xlm_start_docs... | 6,790 | 39.422619 | 125 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/hubconfs/xlnet_hubconf.1.py | from pytorch_transformers.tokenization_xlnet import XLNetTokenizer
from pytorch_transformers.modeling_xlnet import (
XLNetConfig,
XLNetModel,
XLNetLMHeadModel,
# XLNetForSequenceClassification
)
# A lot of models share the same param doc. Use a decorator
# to save typing
xlnet_docstring = """
Param... | 7,337 | 42.164706 | 127 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/hubconfs/gpt2_hubconf.py | from pytorch_transformers.tokenization_gpt2 import GPT2Tokenizer
from pytorch_transformers.modeling_gpt2 import (
GPT2Model,
GPT2LMHeadModel,
GPT2DoubleHeadsModel
)
# A lot of models share the same param doc. Use a decorator
# to save typing
gpt2_docstring = """
Params:
pretrained_model_name_or... | 7,025 | 40.573964 | 118 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/hubconfs/transformer_xl_hubconf.py | from pytorch_transformers.tokenization_transfo_xl import TransfoXLTokenizer
from pytorch_transformers.modeling_transfo_xl import (
TransfoXLModel,
TransfoXLLMHeadModel
)
# A lot of models share the same param doc. Use a decorator
# to save typing
transformer_xl_docstring = """
Transformer XL use a relative... | 5,835 | 43.549618 | 120 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/hubconfs/gpt_hubconf.py | from pytorch_transformers.tokenization_openai import OpenAIGPTTokenizer
from pytorch_transformers.modeling_openai import (
OpenAIGPTModel,
OpenAIGPTLMHeadModel,
OpenAIGPTDoubleHeadsModel
)
# Dependecies that are not specified in global hubconf.py
specific_dependencies = ['spacy', 'ftfy']
# A lot of models share th... | 8,254 | 43.144385 | 142 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/run_squad.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | 28,754 | 53.98088 | 154 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/run_glue.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | 25,262 | 51.962264 | 163 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/run_bertology.py | #!/usr/bin/env python3
# Copyright 2018 CMU and The 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.0
#
# Unless requir... | 18,159 | 51.334294 | 177 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/run_generation.py | #!/usr/bin/env python3
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... | 9,558 | 47.770408 | 144 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/utils_squad.py |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 co... | 41,529 | 40.654965 | 112 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/single_model_scripts/run_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 6,735 | 42.74026 | 111 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/single_model_scripts/run_swag.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | 24,318 | 42.739209 | 134 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/single_model_scripts/run_openai_gpt.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 14,369 | 48.723183 | 132 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/lm_finetuning/simple_lm_finetuning.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | 27,716 | 42.24025 | 134 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/lm_finetuning/finetune_on_pregenerated.py | from argparse import ArgumentParser
from pathlib import Path
import os
import torch
import logging
import json
import random
import numpy as np
from collections import namedtuple
from tempfile import TemporaryDirectory
from torch.utils.data import DataLoader, Dataset, RandomSampler
from torch.utils.data.distributed im... | 15,759 | 46.613293 | 136 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/examples/lm_finetuning/pregenerate_training_data.py | from argparse import ArgumentParser
from pathlib import Path
from tqdm import tqdm, trange
from tempfile import TemporaryDirectory
import shelve
from multiprocessing import Pool
from random import random, randrange, randint, shuffle, choice
from pytorch_transformers.tokenization_bert import BertTokenizer
import numpy ... | 16,272 | 44.839437 | 120 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/docs/source/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 5,651 | 29.06383 | 83 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The 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/LICEN... | 8,635 | 44.452632 | 130 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/__main__.py | # coding: utf8
def main():
import sys
if (len(sys.argv) < 4 or len(sys.argv) > 6) or sys.argv[1] not in ["bert", "gpt", "transfo_xl", "gpt2", "xlnet", "xlm"]:
print(
"Should be used as one of: \n"
">> pytorch_transformers bert TF_CHECKPOINT TF_CONFIG PYTORCH_DUMP_OUTPUT, \n"
">> ... | 7,021 | 53.434109 | 143 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/convert_gpt2_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The 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.0
#
# Unless required by applicable... | 3,078 | 39.513158 | 111 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/convert_openai_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The 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.0
#
# Unless required by applicable... | 3,167 | 40.684211 | 118 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_utils.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | 44,321 | 48.632699 | 157 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | 67,084 | 52.411624 | 187 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_gpt2.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... | 36,512 | 48.677551 | 136 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_openai.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... | 34,885 | 47.520167 | 140 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tokenization_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The 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/LICEN... | 19,377 | 43.343249 | 183 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/convert_xlnet_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The 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.0
#
# Unless required by applicable... | 4,354 | 40.47619 | 126 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/convert_xlm_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The 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.0
#
# Unless required by applicable... | 2,955 | 37.894737 | 117 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/convert_transfo_xl_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The 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.0
#
# Unless required by applicable... | 5,696 | 46.87395 | 121 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/file_utils.py | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
import sys
import json
import logging
import os
impor... | 8,876 | 33.142308 | 98 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/convert_tf_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The 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.0
#
# Unless required by applicable... | 2,596 | 38.348485 | 102 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 58,655 | 41.814599 | 157 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_xlnet.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 63,858 | 48.464756 | 169 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_xlm.py | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and the 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.0
#
# Un... | 45,113 | 47.930586 | 151 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tokenization_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 21,482 | 36.623468 | 110 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/convert_pytorch_checkpoint_to_tf.py | # coding=utf-8
# Copyright 2018 The 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.0
#
# Unless required by applicable... | 4,343 | 32.160305 | 87 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/modeling_transfo_xl_utilities.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 13,568 | 39.747748 | 132 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/modeling_transfo_xl_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 8,536 | 38.706977 | 93 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/tokenization_transfo_xl_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 2,583 | 37.567164 | 126 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/modeling_openai_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 2,001 | 39.857143 | 122 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/tokenization_utils_test.py | # coding=utf-8
# Copyright 2018 HuggingFace Inc..
#
# 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.0
#
# Unless required by applicable law or a... | 1,838 | 38.12766 | 77 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/modeling_common_test.py | # coding=utf-8
# Copyright 2019 HuggingFace Inc.
#
# 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.0
#
# Unless required by applicable law or ag... | 26,105 | 43.702055 | 138 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/tokenization_xlm_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 2,524 | 38.453125 | 103 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/modeling_bert_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 14,581 | 45.587859 | 162 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/optimization_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 6,088 | 42.492857 | 115 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/modeling_xlnet_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 14,185 | 42.919505 | 135 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/tokenization_bert_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 4,681 | 36.758065 | 104 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/tokenization_xlnet_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 4,612 | 53.270588 | 130 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/modeling_xlm_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 12,674 | 42.112245 | 171 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/modeling_gpt2_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 1,934 | 38.489796 | 112 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/tokenization_gpt2_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 2,571 | 39.825397 | 126 | py |
Retrieval-Augmented-Visual-Question-Answering | Retrieval-Augmented-Visual-Question-Answering-main/materials/Oscar/transformers2/pytorch_transformers/tests/tokenization_openai_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.0
#
# Unless required by ... | 2,555 | 38.323077 | 109 | py |
MSRP | MSRP-master/LanguageModel.py | import torch
import numpy as np
from tqdm import tqdm
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers import OpenAIGPTTokenizer, OpenAIGPTModel, OpenAIGPTLMHeadModel
class LanguageModel:
def __init__(self, div_val=1000, model_name='anonsubms/lm_giga'):
self.t... | 2,463 | 33.704225 | 112 | py |
MSRP | MSRP-master/evaluate.py | #!/usr/bin/env python
# coding: utf-8
import os
import sys
import torch
import numpy as np
from tqdm import tqdm
from torch import nn
os.environ["TOKENIZERS_PARALLELISM"] = "false"
from LanguageModel import LanguageModel
from SemanticSimilarity import SemanticSimilarity
from pythonrouge.pythonrouge import Pythonroug... | 10,312 | 38.665385 | 144 | py |
MSRP | MSRP-master/evaluate_outputs.py | import os
import sys
sys.path.insert(0,'..')
os.environ["TOKENIZERS_PARALLELISM"] = "false"
import numpy as np
import torch
from torch import nn
from pythonrouge.pythonrouge import Pythonrouge
from LanguageModel import LanguageModel
from SemanticSimilarity import SemanticSimilarity
from sentence_transformers import ... | 3,962 | 30.959677 | 115 | py |
MSRP | MSRP-master/pretrain_t5.py | import sys
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
import nltk
import torch
import numpy as np
from datasets import load_dataset, load_metric
from transformers import T5ForConditionalGeneration, AutoTokenizer, AutoModelForSeq2SeqLM, T5Config
from transformers import MT5ForConditionalGeneration
from tr... | 3,535 | 26.625 | 106 | py |
MSRP | MSRP-master/SemanticSimilarity.py | import torch
import numpy as np
import torch.nn.functional as F
from torch import nn
from tqdm import tqdm
from torch.nn import Embedding
from torch.nn.utils.rnn import pad_sequence
from sentence_transformers import SentenceTransformer
# This code and file are based on https://github.com/raphael-sch/HC_Sentence_Summ... | 5,481 | 38.157143 | 121 | py |
MSRP | MSRP-master/train.py | # coding=utf-8
import sys
import wandb
import gc
import pdb
import warnings
import time
import copy
import math
import string
import argparse
import glob
import os
import pickle
import random
import re
import shutil
import pandas as pd
from functools import partial
from typing import Dict, List, Tuple
from itertool... | 42,121 | 41.720081 | 157 | py |
benchmark-rrc | benchmark-rrc-master/python/pybullet_planning/utils/transformations.py | # -*- coding: utf-8 -*-
# transformations.py
# Copyright (c) 2006, Christoph Gohlke
# Copyright (c) 2006-2009, The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | 58,641 | 35.355859 | 79 | py |
benchmark-rrc | benchmark-rrc-master/python/residual_learning/residual_state.py |
from mp.states import State
from .residual_sac import ResidualSAC
import dl
from dl import nest
import torch
import numpy as np
import os
def load_policy(logdir):
config = os.path.join(logdir, 'logs/config.gin')
dl.load_config(config)
alg = ResidualSAC(logdir)
pi = alg.pi
pi.eval()
frameskip... | 4,627 | 36.322581 | 92 | py |
benchmark-rrc | benchmark-rrc-master/python/residual_learning/modules.py | """Define networks and ResidualPPO2."""
from dl.modules import TanhDiagGaussian, ProductDistribution
from dl import nest
import torch
import torch.nn as nn
import numpy as np
class ObservationFilter(object):
"""Filters information to policy and value networks for residual_learning
and domain randomization.... | 3,488 | 35.726316 | 95 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.