text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, Optional, Tuple
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_deco... | COCO-LM/fairseq/fairseq/model_parallel/modules/multihead_attention.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/model_parallel/modules/multihead_attention.py",
"repo_id": "COCO-LM",
"token_count": 6561
} | 200 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import math
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import checkpoint_utils
... | COCO-LM/fairseq/fairseq/models/fconv_self_att.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/fconv_self_att.py",
"repo_id": "COCO-LM",
"token_count": 12353
} | 201 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq.utils import new_arange
# -------------- Helper Functions --------------------------------------------------- #
... | COCO-LM/fairseq/fairseq/models/nat/levenshtein_utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/nat/levenshtein_utils.py",
"repo_id": "COCO-LM",
"token_count": 4925
} | 202 |
#!/usr/bin/env python3
import logging
import math
from typing import Dict, List, Optional, Tuple
import torch.nn as nn
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.models import (
FairseqEncoder,
FairseqEncoderDecoderModel,
register_m... | COCO-LM/fairseq/fairseq/models/speech_to_text/s2t_transformer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/speech_to_text/s2t_transformer.py",
"repo_id": "COCO-LM",
"token_count": 8097
} | 203 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import List, Tuple
import torch
import torch.nn.functional as F
from fairseq.data import Dictionary
from torch imp... | COCO-LM/fairseq/fairseq/modules/character_token_embedder.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/character_token_embedder.py",
"repo_id": "COCO-LM",
"token_count": 3591
} | 204 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import List, Optional
import torch.nn as nn
import torch.nn.functional as F
logger = logging.getLogger(__name__)... | COCO-LM/fairseq/fairseq/modules/fairseq_dropout.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/fairseq_dropout.py",
"repo_id": "COCO-LM",
"token_count": 761
} | 205 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_decoding_utils import wi... | COCO-LM/fairseq/fairseq/modules/lightweight_convolution.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/lightweight_convolution.py",
"repo_id": "COCO-LM",
"token_count": 5052
} | 206 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .qact import ActivationQuantizer # NOQA
from .qconv import IntConv2d # NOQA
from .qemb import IntEmbedding # NOQA
from .qlinear import... | COCO-LM/fairseq/fairseq/modules/quantization/scalar/modules/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/quantization/scalar/modules/__init__.py",
"repo_id": "COCO-LM",
"token_count": 105
} | 207 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
transpose last 2 dimensions of the input
"""
import torch.nn as nn
class TransposeLast(nn.Module):
def __init__(self, deconstruct_id... | COCO-LM/fairseq/fairseq/modules/transpose_last.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/transpose_last.py",
"repo_id": "COCO-LM",
"token_count": 208
} | 208 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import defaultdict
from itertools import chain
import torch
from fairseq import optim
from omegaconf import DictConfig
from... | COCO-LM/fairseq/fairseq/optim/fp16_optimizer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/fp16_optimizer.py",
"repo_id": "COCO-LM",
"token_count": 10159
} | 209 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict
from fairseq.distributed import utils
try:
from fairscale.optim import OSS
_has_fairscale = True
exce... | COCO-LM/fairseq/fairseq/optim/shard.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/shard.py",
"repo_id": "COCO-LM",
"token_count": 721
} | 210 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from fairseq import utils
from fairseq.data import (
AppendTokenDataset,
DenoisingDataset,
Dictionary,
... | COCO-LM/fairseq/fairseq/tasks/denoising.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/denoising.py",
"repo_id": "COCO-LM",
"token_count": 4395
} | 211 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
import torch
from fairseq import utils
from fairseq.data import LanguagePairDataset
from fairseq.data... | COCO-LM/fairseq/fairseq/tasks/translation_lev.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/translation_lev.py",
"repo_id": "COCO-LM",
"token_count": 3542
} | 212 |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
from argparse import Namespace
from itertools import chain
import torch
from fa... | COCO-LM/fairseq/fairseq_cli/validate.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq_cli/validate.py",
"repo_id": "COCO-LM",
"token_count": 2273
} | 213 |
import torch
import fused_xentropy_cuda
class SoftmaxCrossEntropyLoss(torch.autograd.Function):
@staticmethod
def forward(ctx, logits, labels, padding_idx=0, half_to_float=False):
losses, max_log_sum_exp = fused_xentropy_cuda.forward(
logits, labels, half_to_float)
if padding_idx >=... | COCO-LM/fairseq/fused_ops/fused_ops/xentropy/softmax_xentropy.py/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/fused_ops/xentropy/softmax_xentropy.py",
"repo_id": "COCO-LM",
"token_count": 464
} | 214 |
#!/usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Extracts random constraints from reference files."""
import argparse
import random
import sys
from sacrebleu imp... | COCO-LM/fairseq/scripts/constraints/extract.py/0 | {
"file_path": "COCO-LM/fairseq/scripts/constraints/extract.py",
"repo_id": "COCO-LM",
"token_count": 1451
} | 215 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import collections
import os
import shutil
import tempfile
import unittest
import numpy as np
import torch
from scripts.average_checkpoints i... | COCO-LM/fairseq/tests/test_average_checkpoints.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_average_checkpoints.py",
"repo_id": "COCO-LM",
"token_count": 2279
} | 216 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from fairseq.data import iterators
class TestIterators(unittest.TestCase):
def test_counting_iterator(self, ref=None, i... | COCO-LM/fairseq/tests/test_iterators.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_iterators.py",
"repo_id": "COCO-LM",
"token_count": 2293
} | 217 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import tests.utils as test_utils
import torch
from fairseq.data import TokenBlockDataset
class TestTokenBlockDataset(unitte... | COCO-LM/fairseq/tests/test_token_block_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_token_block_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1830
} | 218 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
## The script is largely adapted from the huggingface transformers library.
""" GLUE processors and helpers """
import logging
import os
import csv
import sys
import copy
import json
from scipy.stats import pearsonr, spearmanr
from sklearn.metri... | COCO-LM/huggingface/utils_for_glue.py/0 | {
"file_path": "COCO-LM/huggingface/utils_for_glue.py",
"repo_id": "COCO-LM",
"token_count": 11442
} | 219 |
_base_ = [
'../_base_/models/upernet_cswin.py', '../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
model = dict(
backbone=dict(
type='CSWin',
embed_dim=96,
depth=[2,4,32,2],
num_heads=[4,8,16,32],
split_size=[1,2,7... | CSWin-Transformer/segmentation/configs/cswin/upernet_cswin_base.py/0 | {
"file_path": "CSWin-Transformer/segmentation/configs/cswin/upernet_cswin_base.py",
"repo_id": "CSWin-Transformer",
"token_count": 691
} | 220 |
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
name = "ClimaX"
version = "0.3.1"
authors =[
{name="Tung Nguyen", email="tungnd@g.ucla.edu"},
{name="Jayesh K. Gupta", email="mail@rejuvyesh.com"}
]
description = ""
readme = "README.md"
requires-python... | ClimaX/pyproject.toml/0 | {
"file_path": "ClimaX/pyproject.toml",
"repo_id": "ClimaX",
"token_count": 253
} | 221 |
datadir: /data/CMIP6/HAMMOZ
name: 10m_u_component_of_wind
cmip_name: uas
era_name: u10
run: r1i1p1f1
version: v20190627
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/HAMMOZ/config_10m_u_component_of_wind.yml/0 | {
"file_path": "ClimaX/snakemake_configs/HAMMOZ/config_10m_u_component_of_wind.yml",
"repo_id": "ClimaX",
"token_count": 77
} | 222 |
datadir: /data/CMIP6/MPI-ESM
server_prefix: http://esgf-data1.llnl.gov/thredds/fileServer/css03_data/CMIP6/CMIP
name: v_component_of_wind
cmip_name: va
era_name: v
output_type: 6hrPlevPt
run: r1i1p1f1
version: v20190815
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/MPI-ESM/config_v_component_of_wind.yml/0 | {
"file_path": "ClimaX/snakemake_configs/MPI-ESM/config_v_component_of_wind.yml",
"repo_id": "ClimaX",
"token_count": 122
} | 223 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import math
import warnings
from typing import List
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
class LinearWarmupCosineAnnealingLR(_LRScheduler):
"""Sets the learning rate of each parameter group to... | ClimaX/src/climax/utils/lr_scheduler.py/0 | {
"file_path": "ClimaX/src/climax/utils/lr_scheduler.py",
"repo_id": "ClimaX",
"token_count": 1811
} | 224 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import sys
import random
import argparse
import pickle
import numpy as np
import torch
import models
import data
from util import util
class BaseOptions():
def __init__(self):
self.initialized = False
def initialize(s... | CoCosNet-v2/options/base_options.py/0 | {
"file_path": "CoCosNet-v2/options/base_options.py",
"repo_id": "CoCosNet-v2",
"token_count": 3817
} | 225 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import cv2
import torch
import numpy as np
from PIL import Image
from skimage import feature
from data.pix2pix_dataset import Pix2pixDataset
from data.base_dataset import get_params, get_transform
class CelebAHQEdgeDataset(Pix2pixDatas... | CoCosNet/data/celebahqedge_dataset.py/0 | {
"file_path": "CoCosNet/data/celebahqedge_dataset.py",
"repo_id": "CoCosNet",
"token_count": 2971
} | 226 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#08.09 change pad
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
from models.networks.base_network import BaseNetwork
from models.networks.normalization import get_nonspad... | CoCosNet/models/networks/generator.py/0 | {
"file_path": "CoCosNet/models/networks/generator.py",
"repo_id": "CoCosNet",
"token_count": 5757
} | 227 |
source_lang=python
target_lang=python
python run.py \
--model_name_or_path microsoft/unixcoder-base \
--query_data_file ../data/code_to_code_search_test.json \
--candidate_data_file ../data/code_to_code_search_test.json \
--trace_file ../saved_models/code_to_code_search/preds.txt \
--query_lang ${s... | CodeBERT/CodeExecutor/downstream/run.sh/0 | {
"file_path": "CodeBERT/CodeExecutor/downstream/run.sh",
"repo_id": "CodeBERT",
"token_count": 173
} | 228 |
import os
import torch
import logging
import argparse
import random
import json
from tqdm import tqdm
import multiprocessing
import time
from itertools import cycle
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from torch.utils.data import ConcatDataset
from torch.utils.data.distributed impo... | CodeBERT/CodeReviewer/code/run_finetune_msg.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/run_finetune_msg.py",
"repo_id": "CodeBERT",
"token_count": 5785
} | 229 |
# Clone Detection
## Task Definition
Given two codes as the input, the task is to do binary classification (0/1), where 1 stands for semantic equivalence and 0 for others. Models are evaluated by F1 score.
## Updates
2021-9-13: We have update the evaluater script. Since it's a binary classification, we use binary F... | CodeBERT/GraphCodeBERT/clonedetection/README.md/0 | {
"file_path": "CodeBERT/GraphCodeBERT/clonedetection/README.md",
"repo_id": "CodeBERT",
"token_count": 1655
} | 230 |
model=../../../../pretrained-model/UniXcoder-base
mkdir saved_models
CUDA_VISIBLE_DEVICES=0,1,2,3 python run.py \
--output_dir=./saved_models \
--model_type=roberta \
--model_name_or_path=$model \
--do_train \
--train_data_file=../../dataset/train.txt \
--eval_data_file=../../dataset/valid.txt \... | CodeBERT/UniXcoder/downstream-tasks/clone-detection/BCB/run.sh/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/clone-detection/BCB/run.sh",
"repo_id": "CodeBERT",
"token_count": 570
} | 231 |
# 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... | CodeBERT/UniXcoder/downstream-tasks/code-search/run.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-search/run.py",
"repo_id": "CodeBERT",
"token_count": 7582
} | 232 |
{
"train_micro_batch_size_per_gpu": 8,
"gradient_accumulation_steps": 1,
"fp16": {
"enabled": false
},
"zero_optimization": {
"stage": 1,
"reduce_bucket_size": 5e8
}
} | CodeT/DIVERSE/code/src/ds_config.json/0 | {
"file_path": "CodeT/DIVERSE/code/src/ds_config.json",
"repo_id": "CodeT",
"token_count": 111
} | 233 |
include CONTRIBUTING.md
include LICENSE-IMAGE.md
include LICENSE.md
include README.md
include ThirdPartyNotices.txt
| Cognitive-Face-Python/MANIFEST.in/0 | {
"file_path": "Cognitive-Face-Python/MANIFEST.in",
"repo_id": "Cognitive-Face-Python",
"token_count": 37
} | 234 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: test_face.py
Description: Unittests for Face section of the Cognitive Face API.
"""
import unittest
import cognitive_face as CF
from . import util
class TestFace(unittest.TestCase):
"""Unittests for Face section."""
def test_detect(self):
"""... | Cognitive-Face-Python/cognitive_face/tests/test_face.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/tests/test_face.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1903
} | 235 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: __init__.py
Description: View components for Python SDK sample.
"""
import wx
import wx.lib.agw.labelbook as LB
from wx.lib.agw.fmresources import INB_FIT_LABELTEXT
from wx.lib.agw.fmresources import INB_LEFT
from wx.lib.agw.fmresources import INB_NO_RESIZE
fro... | Cognitive-Face-Python/sample/view/__init__.py/0 | {
"file_path": "Cognitive-Face-Python/sample/view/__init__.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1361
} | 236 |
export CUDA_VISIBLE_DEVICES=0
python t5_run_train.py \
--model_name_or_path t5-base \
--subtask Com \
--method MainExp \
--train_file pretrain \
--max_steps 100000 \
--save_steps 100000 \
--batch_size 8 \
--ebatch_size 16 \
--gas 1 \
--seed 1 \
--set set1 | ContextualSP/abstraction_probing/code/t5_code/Com_MainExp_pretrain.sh/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/Com_MainExp_pretrain.sh",
"repo_id": "ContextualSP",
"token_count": 103
} | 237 |
import pdb
import subprocess
import argparse
import os
def run_command(bash_command):
process = subprocess.Popen(bash_command.split())
output, error = process.communicate()
print(error)
print(output)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model_n... | ContextualSP/abstraction_probing/code/t5_code/t5_run_train.py/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/t5_run_train.py",
"repo_id": "ContextualSP",
"token_count": 1451
} | 238 |
# define common functions | ContextualSP/adaptershare/experiments/__init__.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/__init__.py",
"repo_id": "ContextualSP",
"token_count": 4
} | 239 |
#pretrain config
mlm:
data_format: MLM
enable_san: false
metric_meta:
- ACC
n_class: 30522
task_type: MaskLM
loss: MlmCriterion
kd_loss: MseCriterion
adv_loss: SymKlCriterion | ContextualSP/adaptershare/experiments/mlm/mlm.yml/0 | {
"file_path": "ContextualSP/adaptershare/experiments/mlm/mlm.yml",
"repo_id": "ContextualSP",
"token_count": 80
} | 240 |
import os
import argparse
import random
from sys import path
path.append(os.getcwd())
from experiments.common_utils import dump_rows
from data_utils.task_def import DataFormat
from data_utils.log_wrapper import create_logger
from experiments.glue.glue_utils import *
logger = create_logger(__name__, to_disk=True, log_... | ContextualSP/adaptershare/experiments/xnli/xnli_prepro.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/xnli/xnli_prepro.py",
"repo_id": "ContextualSP",
"token_count": 1177
} | 241 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
# This is a quick hack of adamaxw by xiaodong liu
import math
import torch
from torch.optim import Optimizer
class AdamaxW(Optimizer):
r"""Implements AdamaxW algorithm.
The original Adam algorithm was proposed in `Adam: A Method for Stochastic Opti... | ContextualSP/adaptershare/mt_dnn/optim.py/0 | {
"file_path": "ContextualSP/adaptershare/mt_dnn/optim.py",
"repo_id": "ContextualSP",
"token_count": 2034
} | 242 |
import os
import argparse
import torch
import json
from models import *
from utils import *
from tqdm import tqdm
def load_model_and_data_iter(args):
ckpt_path = args.checkpoint
device = torch.device(args.device)
config = json.load(open(os.path.join(os.path.dirname(ckpt_path), 'config.json'), 'r', encoding... | ContextualSP/awakening_latent_grounding/predict.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/predict.py",
"repo_id": "ContextualSP",
"token_count": 5850
} | 243 |
import numpy as np
import torch
from utils.data_types import *
from utils.nlp_utils import *
class GreedyLinker:
schema: SpiderSchema
question: Utterance
matched_values: List[ValueMatch]
threshold: float
identify_results: Dict[SQLTokenType, List[float]]
alignment_dict: Dict[Tuple[SQLTokenType, ... | ContextualSP/awakening_latent_grounding/utils/schema_linker.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/utils/schema_linker.py",
"repo_id": "ContextualSP",
"token_count": 15121
} | 244 |
import torch
from torch import nn
class LstmRnn(nn.Module):
def __init__(self, input_dim, hidden_dim):
super().__init__()
self.i_dim = input_dim
self.h_dim = hidden_dim
self.lstm = nn.LSTMCell(input_dim, hidden_dim)
self.h0 = nn.Parameter(torch.empty(size=(1, hidden_dim), d... | ContextualSP/compositional_generalization/modules/LstmRnn.py/0 | {
"file_path": "ContextualSP/compositional_generalization/modules/LstmRnn.py",
"repo_id": "ContextualSP",
"token_count": 732
} | 245 |
{
"random_seed": 42,
"numpy_seed": 42,
"pytorch_seed": 42,
"dataset_reader": {
"type": "rewrite",
"lazy": false,
"super_mode": "before",
"joint_encoding": true,
"use_bert": true,
"language": "zh",
"extra_stop_words": ["的", "是", "我", "了", "去"]
},
"model": {
"type": "rewrite",
"word_embedder": {
... | ContextualSP/incomplete_utterance_rewriting/configs/multi_bert.jsonnet/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/configs/multi_bert.jsonnet",
"repo_id": "ContextualSP",
"token_count": 801
} | 246 |
"""
Utility functions for reading the standardised text2sql datasets presented in
`"Improving Text to SQL Evaluation Methodology" <https://arxiv.org/abs/1806.09029>`_
"""
import json
import os
import sqlite3
from collections import defaultdict
from typing import List, Dict, Optional
from allennlp.common import JsonDic... | ContextualSP/interactive_text_to_sql/src/context/utils.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/context/utils.py",
"repo_id": "ContextualSP",
"token_count": 3155
} | 247 |
Code and dataset are under cleaning. Coming soon.
| ContextualSP/knowledge_intensive_text_to_sql/README.md/0 | {
"file_path": "ContextualSP/knowledge_intensive_text_to_sql/README.md",
"repo_id": "ContextualSP",
"token_count": 11
} | 248 |
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import defaultdict, Counter
import numpy as np
from numpy.testing import assert_approx_equal
def last_k(tokens, k):
"""Get the last k elements of a list as a tuple."""
if not (0 <= k <= len(tokens)):
raise ValueError('k must b... | ContextualSP/lemon/executor/gtd/lm.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/lm.py",
"repo_id": "ContextualSP",
"token_count": 4219
} | 249 |
from abc import abstractmethod
from collections import Sequence, Mapping
import numpy as np
import pytest
import tensorflow as tf
from keras.engine import Input
from keras.layers import Dense
from numpy.testing import assert_array_almost_equal
from gtd.ml.framework import Feedable, KerasModel
from gtd.ml.utils impor... | ContextualSP/lemon/executor/gtd/tests/ml/test_framework.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/tests/ml/test_framework.py",
"repo_id": "ContextualSP",
"token_count": 2267
} | 250 |
from collections import namedtuple
import numpy as np
from gtd.utils import flatten
from strongsup.case_weighter import get_case_weighter
from strongsup.value_function import get_value_function, ValueFunctionExample
class NormalizationOptions(object):
"""Constants for normalization options"""
LOCAL = 'local... | ContextualSP/lemon/executor/strongsup/decoder.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/decoder.py",
"repo_id": "ContextualSP",
"token_count": 3240
} | 251 |
class EntrySelector(object):
"""Given a list of Entries, returns single Entry based on some
criteria.
Args:
entries (list[Entry]): the entries
"""
def __init__(self, entries):
self._entries = entries
@property
def best_any_seed(self):
"""Returns the Entry with the b... | ContextualSP/lemon/executor/strongsup/results/entry_selector.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/results/entry_selector.py",
"repo_id": "ContextualSP",
"token_count": 295
} | 252 |
import itertools
import time
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import deque
import logging
from strongsup.parse_case import ParseCase
from strongsup.value import check_denotation
class StaticCase(object, metaclass=ABCMeta):
"""Like a ParseCase, but only statically analyze... | ContextualSP/lemon/executor/strongsup/static_exploration.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/static_exploration.py",
"repo_id": "ContextualSP",
"token_count": 4914
} | 253 |
# import pytest
import sys
sys.path.append('../../../')
from strongsup.example import Example, Context
from strongsup.rlong.exploration_policy import AlchemyOraclePathFinder
from strongsup.rlong.state import RLongAlchemyState
from strongsup.rlong.world import RLongAlchemyWorld
from strongsup.rlong.value import RLongSt... | ContextualSP/lemon/executor/strongsup/tests/rlong/test_exploration_policy.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tests/rlong/test_exploration_policy.py",
"repo_id": "ContextualSP",
"token_count": 634
} | 254 |
import abc
import sys
from collections import namedtuple
import numpy as np
import tensorflow as tf
from gtd.ml.framework import Feedable, Model
from keras.layers import Dense
from strongsup.utils import OptimizerOptions, get_optimizer
from strongsup.value import check_denotation
class ValueFunctionExample(namedtup... | ContextualSP/lemon/executor/strongsup/value_function.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/value_function.py",
"repo_id": "ContextualSP",
"token_count": 2757
} | 255 |
The file [dummy-predictions.csv](dummy-predictions.csv) is a valid example prediction file that can be submitted to the [ARC Challenge Leaderboard](https://leaderboard.allenai.org/).
This is a prediction that every question's correct answer is the first choice (either `A` or `1`), and scores about 23% correct.
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/data-challenge/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/data-challenge/README.md",
"repo_id": "ContextualSP",
"token_count": 83
} | 256 |
import os
import evaluator
import unittest
import tempfile
import typing
class TestAccuracy(unittest.TestCase):
def test_EverythingCorrect(self):
qa = {"Q1": "A", "Q2": "A", "Q3": "A"}
p = {"Q1": ["A"], "Q2": ["A"], "Q3": ["A"]}
self.assertEqual(3.0 / 3.0, evaluator.calculate_accuracy(qa... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/evaluator/test_evaluator.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/evaluator/test_evaluator.py",
"repo_id": "ContextualSP",
"token_count": 2567
} | 257 |
The mapping of chain ids to correct labels for the dev and test splits are in
these files:
* dev: chainid_to_label_dev.json
* test: chainid_to_label_test.json
## Dummy predictions
As a convenienece for testing the evaluator, two "dummy" prediction files
are provided which give a score of 0.5 to all chains for both s... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/data/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/data/README.md",
"repo_id": "ContextualSP",
"token_count": 369
} | 258 |
**/__pycache__
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/.dockerignore/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/.dockerignore",
"repo_id": "ContextualSP",
"token_count": 7
} | 259 |
from typing import List, NamedTuple, Dict
from process.constants import NO_LOCATION, CREATE, DESTROY, MOVE
class Input(NamedTuple):
participants: str
class Output(NamedTuple):
participants: str
class Conversion(NamedTuple):
created: str
destroyed: str
locations: str
step_id: str
class M... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/process/process.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/process/process.py",
"repo_id": "ContextualSP",
"token_count": 3392
} | 260 |
#!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team 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.ap... | ContextualSP/logigan/pre-training/hf_generation_multi_es.py/0 | {
"file_path": "ContextualSP/logigan/pre-training/hf_generation_multi_es.py",
"repo_id": "ContextualSP",
"token_count": 13662
} | 261 |
import numpy as np
from collections import defaultdict
import re
from nltk.corpus import stopwords
from enum import Enum
from itertools import permutations
import re
import json
import random
# words = stopwords.words('english')
from collections import defaultdict
from functools import reduce
class ResType(Enum):
... | ContextualSP/poset_decoding/data/generate_phrase_table.py/0 | {
"file_path": "ContextualSP/poset_decoding/data/generate_phrase_table.py",
"repo_id": "ContextualSP",
"token_count": 16375
} | 262 |
coverage:
status:
project:
default:
# basic
target: auto
threshold: 3%
base: auto
# advanced
branches: null
if_no_uploads: error
if_not_found: success
if_ci_failed: error
only_pulls: false
flags: null
paths: null... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/.codecov.yml/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/.codecov.yml",
"repo_id": "ContextualSP",
"token_count": 193
} | 263 |
# -*- 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 ------------------------------------------------------------... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/docs/source/conf.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/docs/source/conf.py",
"repo_id": "ContextualSP",
"token_count": 1869
} | 264 |
from . import callbacks
from .dataset import Dataset
from .dataloader import DataLoader
from .dataloader_builder import DataLoaderBuilder
from .dataset_builder import DatasetBuilder
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/__init__.py",
"repo_id": "ContextualSP",
"token_count": 52
} | 265 |
from .embedding import Embedding
from .embedding import load_from_file
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/embedding/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/embedding/__init__.py",
"repo_id": "ContextualSP",
"token_count": 20
} | 266 |
"""Average precision metric for ranking."""
import numpy as np
from matchzoo.engine.base_metric import RankingMetric
from . import Precision
class AveragePrecision(RankingMetric):
"""Average precision metric."""
ALIAS = ['average_precision', 'ap']
def __init__(self, threshold: float = 0.):
"""
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/metrics/average_precision.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/metrics/average_precision.py",
"repo_id": "ContextualSP",
"token_count": 596
} | 267 |
"""A simple densely connected baseline model."""
import typing
import torch
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine import hyper_spaces
class DenseBaseline(BaseModel):
"""
A simple densely connected baseline model.
Example... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/dense_baseline.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/dense_baseline.py",
"repo_id": "ContextualSP",
"token_count": 802
} | 268 |
"""Attention module."""
import typing
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
"""
Attention module.
:param input_size: Size of input.
:param mask: An integer to mask the invalid values. Defaults to 0.
Examples:
>>> import torch
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/attention.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/attention.py",
"repo_id": "ContextualSP",
"token_count": 1550
} | 269 |
from matchzoo.data_pack import DataPack
from .units import Vocabulary
from .build_unit_from_data_pack import build_unit_from_data_pack
def build_vocab_unit(
data_pack: DataPack,
mode: str = 'both',
verbose: int = 1
) -> Vocabulary:
"""
Build a :class:`preprocessor.units.Vocabulary` given `data_pac... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/build_vocab_unit.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/build_vocab_unit.py",
"repo_id": "ContextualSP",
"token_count": 348
} | 270 |
import typing
import numpy as np
from .unit import Unit
class TruncatedLength(Unit):
"""
TruncatedLengthUnit Class.
Process unit to truncate the text that exceeds the set length.
Examples:
>>> from matchzoo.preprocessors.units import TruncatedLength
>>> truncatedlen = TruncatedLeng... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/truncated_length.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/truncated_length.py",
"repo_id": "ContextualSP",
"token_count": 803
} | 271 |
import typing
import torch
from torch import nn
from torch import optim
import matchzoo
from matchzoo.engine.base_metric import (
BaseMetric, RankingMetric, ClassificationMetric
)
activation = nn.ModuleDict([
['relu', nn.ReLU()],
['hardtanh', nn.Hardtanh()],
['relu6', nn.ReLU6()],
['sigmoid', nn.... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/parse.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/parse.py",
"repo_id": "ContextualSP",
"token_count": 3624
} | 272 |
"""
These tests are simplied because the original verion takes too much time to
run, making CI fails as it reaches the time limit.
"""
import torch
import pytest
from pathlib import Path
import shutil
import matchzoo as mz
@pytest.fixture(scope='module', params=[
mz.tasks.Ranking(losses=mz.losses.RankCrossEntrop... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/models/test_models.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/models/test_models.py",
"repo_id": "ContextualSP",
"token_count": 839
} | 273 |
<jupyter_start><jupyter_code>%run init.ipynb
preprocessor = mz.models.Bert.get_default_preprocessor()
train_pack_processed = preprocessor.transform(train_pack_raw)
dev_pack_processed = preprocessor.transform(dev_pack_raw)
test_pack_processed = preprocessor.transform(test_pack_raw)
trainset = mz.dataloader.Dataset(
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/bert.ipynb/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/bert.ipynb",
"repo_id": "ContextualSP",
"token_count": 752
} | 274 |
<jupyter_start><jupyter_code>import pandas as pd
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import numpy as np
import torch
from torch.nn.functional import softmax
from copy import deepcopy
import enchant
from sklearn.metrics.pairwise import cosine_similarity
from scipy import sparse
fro... | ContextualSP/robustness_of_text_to_sql/CTA/pipeline.ipynb/0 | {
"file_path": "ContextualSP/robustness_of_text_to_sql/CTA/pipeline.ipynb",
"repo_id": "ContextualSP",
"token_count": 15976
} | 275 |
# Robustness of Text-to-SQL Models
This repository contains the data and code in the following paper:
> [**Towards Robustness of Text-to-SQL Models Against Natural and Realistic Adversarial Table Perturbation**](https://aclanthology.org/2022.acl-long.142.pdf) <br/>
> Xinyu Pi*, Bing Wang*, Yan Gao, Jiaqi Guo, Zhoujun... | ContextualSP/robustness_of_text_to_sql/README.md/0 | {
"file_path": "ContextualSP/robustness_of_text_to_sql/README.md",
"repo_id": "ContextualSP",
"token_count": 927
} | 276 |
set seed=1
set config_file=train_configs/concat.none.jsonnet
set model_file=checkpoints_sparc/sparc_concat_none_model
set tables_file=dataset_sparc/tables.json
set database_path=dataset_sparc/database
set dataset_path=dataset_sparc
set train_data_path=dataset_sparc/train.json
set validation_data_path=dataset_sparc/dev.... | ContextualSP/semantic_parsing_in_context/bash_files/windows/train_sparc.bat/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/bash_files/windows/train_sparc.bat",
"repo_id": "ContextualSP",
"token_count": 384
} | 277 |
from allennlp.models.archival import load_archive
from allennlp.predictors.predictor import Predictor
# WARNING: Do not exclude these imports
from predictor.sparc_predictor import SparcPredictor
from dataset_reader.sparc_reader import SparcDatasetReader
from models.sparc_parser import SparcParser
class PredictManager... | ContextualSP/semantic_parsing_in_context/predict.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/predict.py",
"repo_id": "ContextualSP",
"token_count": 605
} | 278 |
# pylint: disable=anomalous-backslash-in-string
"""
A ``Text2SqlTableContext`` represents the SQL context in which an utterance appears
for the any of the text2sql datasets, with the grammar and the valid actions.
"""
from typing import List, Dict
from dataset_readers.dataset_util.spider_utils import Table
GRAMMAR_D... | ContextualSP/unified_parser_text_to_sql/semparse/contexts/spider_db_grammar.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/semparse/contexts/spider_db_grammar.py",
"repo_id": "ContextualSP",
"token_count": 3733
} | 279 |
import os, sys
import json
import sqlite3
import traceback
import argparse
import tqdm
from ..process_sql import get_sql
from .schema import Schema, get_schemas_from_json
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--input", required=True)
parser.add_argument("--tab... | ContextualSP/unified_parser_text_to_sql/third_party/spider/preprocess/parse_raw_json.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/third_party/spider/preprocess/parse_raw_json.py",
"repo_id": "ContextualSP",
"token_count": 568
} | 280 |
from PIL import Image
import io
import torch
from torch.utils.data import Dataset
import torchvision.transforms as transforms
class ImageNet_Withhold(Dataset):
def __init__(self, data_root, ann_file='', transform=None, train=True, task ='train'):
super(ImageNet_Withhold, self).__init__()
ann_fil... | Cream/AutoFormer/lib/imagenet_withhold.py/0 | {
"file_path": "Cream/AutoFormer/lib/imagenet_withhold.py",
"repo_id": "Cream",
"token_count": 1420
} | 281 |
import logging
import torch.nn as nn
import torch.utils.checkpoint as cp
from ..runner import load_checkpoint
from .weight_init import constant_init, kaiming_init
def conv3x3(in_planes, out_planes, stride=1, dilation=1):
"3x3 convolution with padding"
return nn.Conv2d(
in_planes,
out_planes,... | Cream/CDARTS/CDARTS_detection/mmcv/cnn/resnet.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/cnn/resnet.py",
"repo_id": "Cream",
"token_count": 5249
} | 282 |
import numpy as np
from .colorspace import bgr2rgb, rgb2bgr
def imnormalize(img, mean, std, to_rgb=True):
img = img.astype(np.float32)
if to_rgb:
img = bgr2rgb(img)
return (img - mean) / std
def imdenormalize(img, mean, std, to_bgr=True):
img = (img * std) + mean
if to_bgr:
img ... | Cream/CDARTS/CDARTS_detection/mmcv/image/transforms/normalize.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/image/transforms/normalize.py",
"repo_id": "Cream",
"token_count": 167
} | 283 |
class Hook(object):
def before_run(self, runner):
pass
def after_run(self, runner):
pass
def before_epoch(self, runner):
pass
def after_epoch(self, runner):
pass
def before_iter(self, runner):
pass
def after_iter(self, runner):
pass
def ... | Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/hook.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/hook.py",
"repo_id": "Cream",
"token_count": 608
} | 284 |
from .config import ConfigDict, Config
from .misc import (is_str, iter_cast, list_cast, tuple_cast, is_seq_of,
is_list_of, is_tuple_of, slice_list, concat_list,
check_prerequisites, requires_package, requires_executable)
from .path import (is_filepath, fopen, check_file_exist, mkdi... | Cream/CDARTS/CDARTS_detection/mmcv/utils/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/utils/__init__.py",
"repo_id": "Cream",
"token_count": 387
} | 285 |
from .color import Color, color_val
from .image import imshow, imshow_bboxes, imshow_det_bboxes
from .optflow import flowshow, flow2rgb, make_color_wheel
__all__ = [
'Color', 'color_val', 'imshow', 'imshow_bboxes', 'imshow_det_bboxes',
'flowshow', 'flow2rgb', 'make_color_wheel'
]
| Cream/CDARTS/CDARTS_detection/mmcv/visualization/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/visualization/__init__.py",
"repo_id": "Cream",
"token_count": 112
} | 286 |
from .anchor_generator import AnchorGenerator
from .anchor_target import anchor_target, anchor_inside_flags
from .guided_anchor_target import ga_loc_target, ga_shape_target
__all__ = [
'AnchorGenerator', 'anchor_target', 'anchor_inside_flags', 'ga_loc_target',
'ga_shape_target'
]
| Cream/CDARTS/CDARTS_detection/mmdet/core/anchor/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/anchor/__init__.py",
"repo_id": "Cream",
"token_count": 103
} | 287 |
import numpy as np
import torch
from .random_sampler import RandomSampler
class InstanceBalancedPosSampler(RandomSampler):
def _sample_pos(self, assign_result, num_expected, **kwargs):
pos_inds = torch.nonzero(assign_result.gt_inds > 0)
if pos_inds.numel() != 0:
pos_inds = pos_inds.s... | Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/samplers/instance_balanced_pos_sampler.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/samplers/instance_balanced_pos_sampler.py",
"repo_id": "Cream",
"token_count": 959
} | 288 |
import copy
import torch
import torch.nn as nn
from mmcv.runner import OptimizerHook
from .utils import cast_tensor_type
from ..utils.dist_utils import allreduce_grads
class Fp16OptimizerHook(OptimizerHook):
"""FP16 optimizer hook.
The steps of fp16 optimizer is as follows.
1. Scale the loss value.
... | Cream/CDARTS/CDARTS_detection/mmdet/core/fp16/hooks.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/fp16/hooks.py",
"repo_id": "Cream",
"token_count": 1997
} | 289 |
import numpy as np
from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
from .registry import DATASETS
@DATASETS.register_module
class ConcatDataset(_ConcatDataset):
"""A wrapper of concatenated dataset.
Same as :obj:`torch.utils.data.dataset.ConcatDataset`, but
concat the group flag for... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/dataset_wrappers.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/dataset_wrappers.py",
"repo_id": "Cream",
"token_count": 682
} | 290 |
from .backbones import * # noqa: F401,F403
from .necks import * # noqa: F401,F403
from .roi_extractors import * # noqa: F401,F403
from .anchor_heads import * # noqa: F401,F403
from .shared_heads import * # noqa: F401,F403
from .bbox_heads import * # noqa: F401,F403
from .mask_heads import * # noqa: F401,F403
fro... | Cream/CDARTS/CDARTS_detection/mmdet/models/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/__init__.py",
"repo_id": "Cream",
"token_count": 419
} | 291 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import time
import numpy as np
from .fbnet_blocks import *
from .fbnet_arch import predefine_archs
import logging
from torch.nn.modules.batchnorm import _BatchNorm
from mmcv.cnn import constant_init, kaiming_init
from .utils import load_... | Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/fbnet.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/fbnet.py",
"repo_id": "Cream",
"token_count": 1263
} | 292 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
norm_cfg_ = {
'BN': nn.BatchNorm2d,
'SyncBN': nn.SyncBatchNorm,
'GN': nn.GroupNorm,
}
OPS = {
'skip': lambda input_size, in_channels, out_channels, stride, bn='BN': Identity(input_size, in_channels, out_channels,... | Cream/CDARTS/CDARTS_detection/mmdet/models/bbox_heads/auto_head/mbblock_ops.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/bbox_heads/auto_head/mbblock_ops.py",
"repo_id": "Cream",
"token_count": 3853
} | 293 |
from .single_stage import SingleStageDetector
from ..registry import DETECTORS
@DETECTORS.register_module
class RetinaNet(SingleStageDetector):
def __init__(self,
backbone,
neck,
bbox_head,
train_cfg=None,
test_cfg=None,
... | Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/retinanet.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/retinanet.py",
"repo_id": "Cream",
"token_count": 262
} | 294 |
import mmcv
import numpy as np
import pycocotools.mask as mask_util
import torch
import torch.nn as nn
from ..builder import build_loss
from ..registry import HEADS
from ..utils import ConvModule
from mmdet.core import mask_target, force_fp32, auto_fp16
@HEADS.register_module
class FCNMaskHead(nn.Module):
def _... | Cream/CDARTS/CDARTS_detection/mmdet/models/mask_heads/fcn_mask_head.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/mask_heads/fcn_mask_head.py",
"repo_id": "Cream",
"token_count": 3664
} | 295 |
from .non_local import NonLocal2D
from .generalized_attention import GeneralizedAttention
__all__ = ['NonLocal2D', 'GeneralizedAttention']
| Cream/CDARTS/CDARTS_detection/mmdet/models/plugins/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/plugins/__init__.py",
"repo_id": "Cream",
"token_count": 42
} | 296 |
from .functions.deform_conv import deform_conv, modulated_deform_conv
from .functions.deform_pool import deform_roi_pooling
from .modules.deform_conv import (DeformConv, ModulatedDeformConv,
DeformConvPack, ModulatedDeformConvPack)
from .modules.deform_pool import (DeformRoIPooling, De... | Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/__init__.py",
"repo_id": "Cream",
"token_count": 289
} | 297 |
import math
import torch
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from .. import masked_conv2d_cuda
class MaskedConv2dFunction(Function):
@staticmethod
def forward(ctx, features, mask, weight, bias, padding=0, stride=1):
assert mask.dim() == 3 and mask.size(0) == 1... | Cream/CDARTS/CDARTS_detection/mmdet/ops/masked_conv/functions/masked_conv.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/masked_conv/functions/masked_conv.py",
"repo_id": "Cream",
"token_count": 1284
} | 298 |
from torch.autograd import Function
from .. import roi_align_cuda
class RoIAlignFunction(Function):
@staticmethod
def forward(ctx, features, rois, out_size, spatial_scale, sample_num=0):
if isinstance(out_size, int):
out_h = out_size
out_w = out_size
elif isinstance(o... | Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_align/functions/roi_align.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_align/functions/roi_align.py",
"repo_id": "Cream",
"token_count": 1059
} | 299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.