text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import cv2
import torch
import numpy as np
import math
import random
from PIL import Image
from data.pix2pix_dataset import Pix2pixDataset
from data.base_dataset import get_params, get_transform
class DeepFashionHDDataset(Pix2pixData... | CoCosNet-v2/data/deepfashionHD_dataset.py/0 | {
"file_path": "CoCosNet-v2/data/deepfashionHD_dataset.py",
"repo_id": "CoCosNet-v2",
"token_count": 3401
} | 233 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import re
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.spectral_norm as spectral_norm
def get_nonspade_norm_layer(opt, norm_type='instance'):
def get_out_channel(layer):
if hasattr(layer, 'out_channel... | CoCosNet-v2/models/networks/normalization.py/0 | {
"file_path": "CoCosNet-v2/models/networks/normalization.py",
"repo_id": "CoCosNet-v2",
"token_count": 1931
} | 234 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from data.pix2pix_dataset import Pix2pixDataset
from data.image_folder import make_dataset
class ADE20KDataset(Pix2pixDataset):
@staticmethod
def modify_commandline_options(parser, is_train):
parser = Pix2pixDataset.m... | CoCosNet/data/ade20k_dataset.py/0 | {
"file_path": "CoCosNet/data/ade20k_dataset.py",
"repo_id": "CoCosNet",
"token_count": 1032
} | 235 |
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import torch
from models.networks.base_network import BaseNetwork
from models.networks.loss import *
from models.networks.discriminator import *... | CoCosNet/models/networks/__init__.py/0 | {
"file_path": "CoCosNet/models/networks/__init__.py",
"repo_id": "CoCosNet",
"token_count": 1010
} | 236 |
# 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/CodeBERT/codesearch/run_classifier.py/0 | {
"file_path": "CodeBERT/CodeBERT/codesearch/run_classifier.py",
"repo_id": "CodeBERT",
"token_count": 13700
} | 237 |
import os
import argparse
from evaluator.smooth_bleu import bleu_fromstr
import nltk
import re
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--path', type=str, required=True)
args = parser.parse_args()
ref = os.path.join(args.path, 'golds.txt')
hyp = os.path.join(args.path, '... | CodeBERT/CodeReviewer/code/bleu.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/bleu.py",
"repo_id": "CodeBERT",
"token_count": 740
} | 238 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | CodeBERT/CodeReviewer/code/evaluator/bleu.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/evaluator/bleu.py",
"repo_id": "CodeBERT",
"token_count": 1767
} | 239 |
# batch size 6 for 16 GB GPU
mnt_dir="/home/codereview"
# You may change the following block for multiple gpu training
MASTER_HOST=localhost && echo MASTER_HOST: ${MASTER_HOST}
MASTER_PORT=23333 && echo MASTER_PORT: ${MASTER_PORT}
RANK=0 && echo RANK: ${RANK}
PER_NODE_GPU=1 && echo PER_NODE_GPU: ${PER_NODE_GPU}
WORL... | CodeBERT/CodeReviewer/code/sh/test-msg.sh/0 | {
"file_path": "CodeBERT/CodeReviewer/code/sh/test-msg.sh",
"repo_id": "CodeBERT",
"token_count": 438
} | 240 |
import re
from io import StringIO
import tokenize
def remove_comments_and_docstrings(source,lang):
if lang in ['python']:
"""
Returns 'source' minus comments and docstrings.
"""
io_obj = StringIO(source)
out = ""
prev_toktype = tokenize.INDENT
last_lineno = -... | CodeBERT/GraphCodeBERT/clonedetection/parser/utils.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/clonedetection/parser/utils.py",
"repo_id": "CodeBERT",
"token_count": 1812
} | 241 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from tree_sitter import Language, Parser
from .utils import (remove_comments_and_docstrings,
tree_to_token_index,
index_to_code_token,
tree_to_variable_index)
def DFG_python(root_node,in... | CodeBERT/GraphCodeBERT/refinement/parser/DFG.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/refinement/parser/DFG.py",
"repo_id": "CodeBERT",
"token_count": 28921
} | 242 |
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), ... | CodeBERT/SECURITY.md/0 | {
"file_path": "CodeBERT/SECURITY.md",
"repo_id": "CodeBERT",
"token_count": 701
} | 243 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torch
from torch.autograd import Variable
import copy
class Seq2Seq(nn.Module):
"""
Build Seqence-to-Sequence.
Parameters:
* `encoder`- encoder of seq2seq model. e.g... | CodeBERT/UniXcoder/downstream-tasks/code-generation/model.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-generation/model.py",
"repo_id": "CodeBERT",
"token_count": 4178
} | 244 |
# 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/zero-shot-search/run.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/zero-shot-search/run.py",
"repo_id": "CodeBERT",
"token_count": 5116
} | 245 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import json
import pickle
class Tools:
@staticmethod
def load_jsonl(file_path):
json_objects = []
with open(file_path, 'r', encoding='utf8') as f:
for line in f:
json_objects.append(json.loads(... | CodeT/CodeT/src/io_utils.py/0 | {
"file_path": "CodeT/CodeT/src/io_utils.py",
"repo_id": "CodeT",
"token_count": 454
} | 246 |
$schema: http://azureml/sdk-2-0/CommandComponent.json
name: microsoft.msra.dki.verifier_data_preparing
display_name: Verifier Data Preparing
version: 0.1.8-dev2
type: CommandComponent
is_deterministic: true
description: Verifier Data Preparing
tags: {category: Verifier Data Preparing, contact: Zeqi.Lin@microsoft.com}
i... | CodeT/DIVERSE/code/verifier_data_prepare.yaml/0 | {
"file_path": "CodeT/DIVERSE/code/verifier_data_prepare.yaml",
"repo_id": "CodeT",
"token_count": 955
} | 247 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import editdistance
from collections import defaultdict
from utils import Tools
def compute_EM(target, predictions, passk):
target_lines = [line.strip() for line in target.splitlines() if line.strip()]
EM_scores = []
for prediction ... | CodeT/RepoCoder/compute_score.py/0 | {
"file_path": "CodeT/RepoCoder/compute_score.py",
"repo_id": "CodeT",
"token_count": 1165
} | 248 |
#!/bin/zsh
#
# A shell script to setup Codex CLI for zsh
#
# You can pass the following arguments to the script:
# -o: Your OpenAI organization id.
# -k: Your OpenAI API key.
# -e: The OpenAI engine id that provides access to a model.
#
# For example:
# ./zsh_setup.sh -o <YOUR_ORG_ID> -k <YOUR_API_KEY> -e <ENGINE... | Codex-CLI/scripts/zsh_setup.sh/0 | {
"file_path": "Codex-CLI/scripts/zsh_setup.sh",
"repo_id": "Codex-CLI",
"token_count": 1449
} | 249 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: large_person_group_person_face.py
Description: Large Person Group Person Face section of the Cognitive Face API.
"""
from . import util
def add(image,
large_person_group_id,
person_id,
user_data=None,
target_face=None):
"""Add... | Cognitive-Face-Python/cognitive_face/large_person_group_person_face.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/large_person_group_person_face.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1559
} | 250 |
export CUDA_VISIBLE_DEVICES=3
python t5_run_train.py \
--model_name_or_path t5-base \
--subtask Com \
--method ContrastExp \
--train_file pretrain_contrast \
--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_ContrastExp_pretrain.sh/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/Com_ContrastExp_pretrain.sh",
"repo_id": "ContextualSP",
"token_count": 106
} | 251 |
import absl
import nltk
import numpy
import six
import datasets
import pdb
_CITATION = ""
_DESCRIPTION = ""
_KWARGS_DESCRIPTION = ""
def simple_accuracy(preds, labels):
correct_list = [1. if pred == label else 0. for (pred, label) in zip(preds, labels)]
return sum(correct_list) / len(correct_list)
@dat... | ContextualSP/abstraction_probing/code/t5_code/seq_acc/seq_acc.py/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/seq_acc/seq_acc.py",
"repo_id": "ContextualSP",
"token_count": 487
} | 252 |
# Copyright (c) Microsoft. All rights reserved.
from enum import IntEnum
class TaskType(IntEnum):
Classification = 1
Regression = 2
Ranking = 3
Span = 4 # squad v1
SpanYN = 5 # squad v2
SeqenceLabeling = 6
MaskLM = 7
SpanSeqenceLabeling = 8
SeqenceGeneration = 9
ClozeChoice ... | ContextualSP/adaptershare/data_utils/task_def.py/0 | {
"file_path": "ContextualSP/adaptershare/data_utils/task_def.py",
"repo_id": "ContextualSP",
"token_count": 333
} | 253 |
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/glue/glue_prepro.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/glue/glue_prepro.py",
"repo_id": "ContextualSP",
"token_count": 5950
} | 254 |
boolq:
data_format: PremiseAndOneHypothesis
dropout_p: 0.1
enable_san: false
metric_meta:
- ACC
loss: CeCriterion
kd_loss: MseCriterion
adv_loss: SymKlCriterion
n_class: 2
task_type: Classification
copa:
data_format: PremiseAndMultiHypothesis
enable_san: false
metric_meta:
- ACC
loss: Ran... | ContextualSP/adaptershare/experiments/superglue/superglue_task_def.yml/0 | {
"file_path": "ContextualSP/adaptershare/experiments/superglue/superglue_task_def.yml",
"repo_id": "ContextualSP",
"token_count": 504
} | 255 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
from copy import deepcopy
import sys
import json
import torch
import random
import numpy as np
from shutil import copyfile
from data_utils.task_def import TaskType, DataFormat
from data_utils.task_def import EncoderModelType
import tasks
from torch.utils.da... | ContextualSP/adaptershare/mt_dnn/batcher.py/0 | {
"file_path": "ContextualSP/adaptershare/mt_dnn/batcher.py",
"repo_id": "ContextualSP",
"token_count": 17154
} | 256 |
# because we don't specify exact software version in Dockerfile,
# the train loss could be different when you rebuild the Dockerfile
# so we hide this test. But it still useful for developer when you constantly working on exact same environment
# (Docker, hardware)
import os
import shutil
import subprocess
import re
T... | ContextualSP/adaptershare/tests/_test_train.py/0 | {
"file_path": "ContextualSP/adaptershare/tests/_test_train.py",
"repo_id": "ContextualSP",
"token_count": 846
} | 257 |
# README
The official code of paper [Awakening Latent Grounding from Pretrained Language Models for Semantic Parsing](https://aclanthology.org/2021.findings-acl.100.pdf).
# Install Dependencies
Please first install [PyTorch](https://pytorch.org/), and then install all the dependencies by running:
```bash
pip instal... | ContextualSP/awakening_latent_grounding/README.md/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/README.md",
"repo_id": "ContextualSP",
"token_count": 1332
} | 258 |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
# Adapted from The Annotated Transformer
class MultiHeadedAttentionWithRelations(nn.Module):
def __init__(self, num_heads, hidden_size, dropout):
super(MultiHeadedAttentionWithRelations, self).__init__()
self.hidden_size... | ContextualSP/awakening_latent_grounding/models/nn_layers.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/models/nn_layers.py",
"repo_id": "ContextualSP",
"token_count": 3118
} | 259 |
from .data_types import *
from .data_iter import *
from .evaluator import *
from .nlp_utils import *
from .sql_parser import *
from .schema_linker import * | ContextualSP/awakening_latent_grounding/utils/__init__.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/utils/__init__.py",
"repo_id": "ContextualSP",
"token_count": 50
} | 260 |
import argparse
import os
import random
import time
import unicodedata
from functools import partial
import torch
from torch import nn
from tqdm import tqdm
from model import HRLModel, PAD_token, EOS_token
from utils import AverageMeter
from utils import VisualizeLogger
from utils import get_logger
import numpy as np
... | ContextualSP/compositional_generalization/main.py/0 | {
"file_path": "ContextualSP/compositional_generalization/main.py",
"repo_id": "ContextualSP",
"token_count": 13402
} | 261 |
# Incomplete Utterance Rewriting <img src="https://pytorch.org/assets/images/logo-dark.svg" height = "25" align=center />
[中文版](README_zh.md)
The official pytorch implementation of our paper [Incomplete Utterance Rewriting as Semantic Segmentation](https://arxiv.org/pdf/2009.13166.pdf).
If you find our code useful f... | ContextualSP/incomplete_utterance_rewriting/README.md/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/README.md",
"repo_id": "ContextualSP",
"token_count": 2173
} | 262 |
{
"ROUGE": 0.8954699040374693,
"_ROUGE1": 0.9248370079585566,
"_ROUGE2": 0.8548729804396925,
"EM": 0.4933385579937304,
"_P1": 0.7443478260869565,
"_R1": 0.6512335615693946,
"F1": 0.694684366123703,
"_P2": 0.6040515653775322,
"_R2": 0.5369713506139154,
"F2": 0.5685396504405605,
... | ContextualSP/incomplete_utterance_rewriting/log/multi_bert.tar.gz.json/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/log/multi_bert.tar.gz.json",
"repo_id": "ContextualSP",
"token_count": 335
} | 263 |
#!/usr/bin/env bash
export model_file=../checkpoints/run_multi
export config_file=../configs/multi.jsonnet
export train_data_path=../dataset/Multi/train.txt
export validation_data_path=../dataset/Multi/valid.txt
export seed=1
allennlp train -s ${model_file} ${config_file} \
--include-package data_reader \
--include-pac... | ContextualSP/incomplete_utterance_rewriting/src/train_multi.sh/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/src/train_multi.sh",
"repo_id": "ContextualSP",
"token_count": 182
} | 264 |
# coding: utf-8
from enum import Enum
import json
from allennlp.data.tokenizers import WordTokenizer
from allennlp.data.tokenizers.word_splitter import SpacyWordSplitter
from spacy.symbols import ORTH, LEMMA
from src.context.converter import SQLConverter
from src.context.db_context import SparcDBContext
from src.uti... | ContextualSP/interactive_text_to_sql/src/utils/semql_converter.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/utils/semql_converter.py",
"repo_id": "ContextualSP",
"token_count": 2357
} | 265 |
import inspect
import os
import signal
import sys
import time
from collections import Mapping
from contextlib import contextmanager
import faulthandler
import line_profiler
from tqdm import tqdm, tqdm_notebook
from gtd.log import in_ipython
class Profiling(object):
@staticmethod
def start():
"""Enab... | ContextualSP/lemon/executor/gtd/chrono.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/chrono.py",
"repo_id": "ContextualSP",
"token_count": 3776
} | 266 |
"""
Helper functions for plotting
"""
import os
import numpy as np
import matplotlib.pyplot as plt
from gtd.io import makedirs
from gtd.log import in_ipython
def hinton(matrix, max_weight=None, ax=None, xtick=None, ytick=None, inverted_color=False):
"""Draw Hinton diagram for visualizing a weight matrix.
Co... | ContextualSP/lemon/executor/gtd/plot.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/plot.py",
"repo_id": "ContextualSP",
"token_count": 990
} | 267 |
import re
import logging
import numpy as np
from gtd.utils import memoize
@memoize
def get_spacy():
"""
Loads the spaCy english processor.
Tokenizing, Parsing, and NER are enabled. All other features are disabled.
Returns:
A spaCy Language object for English
"""
logging.info('Loading... | ContextualSP/lemon/executor/gtd/text.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/text.py",
"repo_id": "ContextualSP",
"token_count": 2801
} | 268 |
from abc import ABCMeta
class PathChecker(object, metaclass=ABCMeta):
"""Check whether a ParsePath should be included in the beam.
This is used to control the search space especially when the parameters
are not well initialized.
"""
def __init__(self, config):
"""Initialize the PathCheck... | ContextualSP/lemon/executor/strongsup/path_checker.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/path_checker.py",
"repo_id": "ContextualSP",
"token_count": 283
} | 269 |
from strongsup.predicate import Predicate
class RLongPredicate(Predicate):
"""Predicates for the RLong domain.
Conventions:
- colors are single characters (y, g, ...)
- numbers are integers, positive or negative (1, -2, ...)
- fractions start with X (X1/2, X2/3, ...)
- properties start with P... | ContextualSP/lemon/executor/strongsup/rlong/predicate.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/rlong/predicate.py",
"repo_id": "ContextualSP",
"token_count": 1160
} | 270 |
# Copied from the official WikiTableQuestions evaluator, version 1.0
from math import isnan, isinf
from strongsup.value import Value
from strongsup.tables.utils import normalize
class StringValue(Value):
def __init__(self, content):
assert isinstance(content, str)
self._normalized = normalize(co... | ContextualSP/lemon/executor/strongsup/tables/value.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tables/value.py",
"repo_id": "ContextualSP",
"token_count": 2727
} | 271 |
import math
import operator
from numpy.testing import assert_allclose
from strongsup.utils import (
epsilon_greedy_sample,
softmax, softmax_with_alpha_beta,
)
from functools import reduce
def test_epsilon_greedy_sample():
num_choices = 8
num_iters = 100000
to_sample = 4
epsil... | ContextualSP/lemon/executor/strongsup/tests/test_utils.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tests/test_utils.py",
"repo_id": "ContextualSP",
"token_count": 1005
} | 272 |
python lemon/run_model_pretrain.py train \
--dataset-dir lemon_data/pretraining_corpus/DATASET_PREFIX/bin_large \
--exp-dir OUTPUT_PATH \
--model-path BART_MODEL_PATH \
--model-arch bart_large \
--total-num-update 10000 \
--max-tokens 1800 \
--gradient-accumulation 8 \
--warmup-steps 150... | ContextualSP/lemon/pretrain.sh/0 | {
"file_path": "ContextualSP/lemon/pretrain.sh",
"repo_id": "ContextualSP",
"token_count": 139
} | 273 |
## AI2 Reasoning Challenge (ARC) Evaluator
This script evaluates predictions for multiple-choice questions against correct answers and produces an accuracy score.
## Example
```bash
% python3 evaluator.py -qa questions.jsonl -p predictions.csv -o metrics.json
% cat metrics.json
{"accuracy": 0.85}
```
## Usage
The... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/evaluator/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/evaluator/README.md",
"repo_id": "ContextualSP",
"token_count": 431
} | 274 |
import numpy as np
import sklearn.metrics
from sklearn.metrics import roc_curve
class F1MeasureCustomRetrievalEval:
def __init__(self, pos_label=1) -> None:
self._predictions = []
self._gt = []
self._pos_label = pos_label
self._probs = []
def __call__(self, label, score):
... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/allennlp_reasoning_explainqa/training/metrics/confusion_matrix.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/allennlp_reasoning_explainqa/training/metrics/confusion_matrix.py",
"repo_id": "ContextualSP",
"token_count": 1191
} | 275 |
FROM python:3.7.0-alpine3.8
WORKDIR /app
COPY evaluator.py /app/evaluator.py
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/openbookqa/evaluator/Dockerfile/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/openbookqa/evaluator/Dockerfile",
"repo_id": "ContextualSP",
"token_count": 38
} | 276 |
#!/usr/bin/env python3
import argparse
import json
from typing import Dict
from evaluation import Evaluation
from process import sentences_from_sentences_file, ActionFile
from scoring import QuestionScores
from errors import corrupted_action_file, corrupted_sentences_file
def main(answers_file: str, predictions_fil... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/evaluator.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/evaluator.py",
"repo_id": "ContextualSP",
"token_count": 3149
} | 277 |
## Test case: Prediction has an invalid action.
* answers.tsv is the answer to process 1167 from the training set.
* predictions.tsv is a prediction with an invalid action.
An evaluation on this prediction should abort.
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/testfiles-6/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/testfiles-6/README.md",
"repo_id": "ContextualSP",
"token_count": 54
} | 278 |
import json
import argparse
from pydoc import doc
import collections
import os
def get_col_states(input_str):
col_and_state = input_str.replace('state : ', '').split(' | ')
return col_and_state
def get_col_states_start(input_str):
col_and_state = input_str.split(' states : ')
cols = col_and_state[0]... | ContextualSP/lemon/recipes_eval.py/0 | {
"file_path": "ContextualSP/lemon/recipes_eval.py",
"repo_id": "ContextualSP",
"token_count": 4166
} | 279 |
import json
import re
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--start_index', type=int)
parser.add_argument('--end_index', type=int)
parser.add_argument('--indicator_type')
args = parser.parse_args()
with open(f"./{args.indicator... | ContextualSP/logigan/corpus_construction/mlm_corpus/filter.py/0 | {
"file_path": "ContextualSP/logigan/corpus_construction/mlm_corpus/filter.py",
"repo_id": "ContextualSP",
"token_count": 583
} | 280 |
# MultiSpider: Towards Benchmarking Multilingual Text-to-SQL Semantic Parsing
In this work, we present MultiSpider, a multilingual text-to-SQL dataset which covers seven languages (English, German, French, Spanish, Japanese, Chinese, and Vietnamese).
Please find more details on [paper](https://arxiv.org/pdf/2212.13492... | ContextualSP/multilingual_text_to_sql/README.md/0 | {
"file_path": "ContextualSP/multilingual_text_to_sql/README.md",
"repo_id": "ContextualSP",
"token_count": 283
} | 281 |
#!/usr/bin/env bash
split=mcd1
data_path=./data/$split/
key=$split-sketch
model_path=./model/sketch_prediction-$key
output_file=./output/$key-output
echo $output_file
WORK_DIR=$(readlink -f "./")/sketch_prediction/
echo $WORK_DIR
CUDA_VISIBLE_DEVICES=5 python3 $WORK_DIR/main.py \
--src_path $data_path/train/train_enc... | ContextualSP/poset_decoding/sketch_prediction/evaluate.sh/0 | {
"file_path": "ContextualSP/poset_decoding/sketch_prediction/evaluate.sh",
"repo_id": "ContextualSP",
"token_count": 340
} | 282 |
Documentation Checking Process(Only for the developers)
==========================================================
# Why
It is necessary for all the developers to generate the rst files which can help us check the documents.
# When
1. You add a new function to one of the scripts in the {MatchZoo/matchzoo} o... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/docs/DOCCHECK.md/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/docs/DOCCHECK.md",
"repo_id": "ContextualSP",
"token_count": 225
} | 283 |
import typing
import numpy as np
import matchzoo as mz
from matchzoo.engine.base_metric import BaseMetric
from .tuner import Tuner
def tune(
params: 'mz.ParamTable',
optimizer: str = 'adam',
trainloader: mz.dataloader.DataLoader = None,
validloader: mz.dataloader.DataLoader = None,
embedding: np... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/tuner/tune.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/tuner/tune.py",
"repo_id": "ContextualSP",
"token_count": 1598
} | 284 |
from .load_data import load_data | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/cfq/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/cfq/__init__.py",
"repo_id": "ContextualSP",
"token_count": 9
} | 285 |
from .rank_cross_entropy_loss import RankCrossEntropyLoss
from .rank_hinge_loss import RankHingeLoss
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/losses/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/losses/__init__.py",
"repo_id": "ContextualSP",
"token_count": 33
} | 286 |
"""An implementation of ArcII Model."""
import typing
import torch
import torch.nn as nn
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine.base_callback import BaseCallback
from matchzoo.engine.param import Param
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine import hyper_... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/arcii.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/arcii.py",
"repo_id": "ContextualSP",
"token_count": 3863
} | 287 |
"""An implementation of Match-SRNN Model."""
import typing
import torch
import torch.nn as nn
import torch.nn.functional as F
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine.param import Param
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine import hyper_spaces
from matchz... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/match_srnn.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/match_srnn.py",
"repo_id": "ContextualSP",
"token_count": 1487
} | 288 |
import torch
import torch.nn as nn
from torch.nn import functional as F
class StackedBRNN(nn.Module):
"""
Stacked Bi-directional RNNs.
Differs from standard PyTorch library in that it has the option to save
and concat the hidden states between layers. (i.e. the output hidden size
for each sequenc... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/stacked_brnn.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/stacked_brnn.py",
"repo_id": "ContextualSP",
"token_count": 1557
} | 289 |
import re
from .unit import Unit
class PuncRemoval(Unit):
"""Process unit for remove punctuations."""
_MATCH_PUNC = re.compile(r'[^\w\s]')
def transform(self, input_: list) -> list:
"""
Remove punctuations from list of tokens.
:param input_: list of toekns.
:return rv:... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/punc_removal.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/punc_removal.py",
"repo_id": "ContextualSP",
"token_count": 209
} | 290 |
"""Average meter."""
class AverageMeter(object):
"""
Computes and stores the average and current value.
Examples:
>>> am = AverageMeter()
>>> am.update(1)
>>> am.avg
1.0
>>> am.update(val=2.5, n=2)
>>> am.avg
2.0
"""
def __init__(self):
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/average_meter.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/average_meter.py",
"repo_id": "ContextualSP",
"token_count": 395
} | 291 |
import pytest
import shutil
import matchzoo as mz
from matchzoo.engine.base_preprocessor import BasePreprocessor
@pytest.fixture
def base_preprocessor():
BasePreprocessor.__abstractmethods__ = set()
base_processor = BasePreprocessor()
return base_processor
def test_save_load(base_preprocessor):
dir... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/engine/test_base_preprocessor.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/engine/test_base_preprocessor.py",
"repo_id": "ContextualSP",
"token_count": 154
} | 292 |
<jupyter_start><jupyter_code>import torch
import numpy as np
import pandas as pd
import matchzoo as mz
print('matchzoo version', mz.__version__)
classification_task = mz.tasks.Classification(num_classes=2)
classification_task.metrics = ['acc']
print("`classification_task` initialized with metrics", classification_task.... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/classification/esim.ipynb/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/classification/esim.ipynb",
"repo_id": "ContextualSP",
"token_count": 897
} | 293 |
<jupyter_start><jupyter_code>%run init.ipynb
preprocessor = mz.models.MatchSRNN.get_default_preprocessor()
train_pack_processed = preprocessor.fit_transform(train_pack_raw)
dev_pack_processed = preprocessor.transform(dev_pack_raw)
test_pack_processed = preprocessor.transform(test_pack_raw)
preprocessor.context
glove_em... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/match_srnn.ipynb/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/match_srnn.ipynb",
"repo_id": "ContextualSP",
"token_count": 703
} | 294 |
#!/usr/bin/env bash
export seed=1
export config_file=train_configs_bert/concat.none.jsonnet
export model_file=checkpoints_sparc/sparc_bert_concat_none_model
export tables_file=dataset_sparc/tables.json
export database_path=dataset_sparc/database
export dataset_path=dataset_sparc
export train_data_path=dataset_sparc/tra... | ContextualSP/semantic_parsing_in_context/bash_files/linux/train_sparc_bert.bash/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/bash_files/linux/train_sparc_bert.bash",
"repo_id": "ContextualSP",
"token_count": 331
} | 295 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import glob
import logging
import os
from queue import Empty
from typing import List, Iterable, Iterator, Optional
import numpy as np
from allennlp.data.instance import Instance
from torch.multiprocessing import Process, Queue, Value, log_to_std... | ContextualSP/semantic_parsing_in_context/dataset_reader/reader_queue.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/dataset_reader/reader_queue.py",
"repo_id": "ContextualSP",
"token_count": 2878
} | 296 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
Mainly borrowed from allennlp package
"""
from collections import defaultdict
from typing import Any, Dict, List, Set, Tuple
from overrides import overrides
import torch
from torch.nn.modules.rnn import LSTM, LSTMCell
from torch.nn.modules... | ContextualSP/semantic_parsing_in_context/models/transition_functions/basic_transition_function.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/models/transition_functions/basic_transition_function.py",
"repo_id": "ContextualSP",
"token_count": 13252
} | 297 |
{
"random_seed": 42,
"numpy_seed": 42,
"pytorch_seed": 42,
"dataset_reader": {
"type": "sparc",
"lazy": false,
"loading_limit": -1,
"context_mode": "none"
},
"model": {
"type": "sparc",
"loss_mask": 8,
"serialization_dir": "",
"text_embedder": {
"tokens": {
"type": "embedding",
"embeddi... | ContextualSP/semantic_parsing_in_context/train_configs/none.gate.jsonnet/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/train_configs/none.gate.jsonnet",
"repo_id": "ContextualSP",
"token_count": 691
} | 298 |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and Microsoft Corporation.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import contextlib
import sys
from collections import Counter
from multiprocess... | ContextualSP/unified_parser_text_to_sql/multiprocessing_bpe_encoder.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/multiprocessing_bpe_encoder.py",
"repo_id": "ContextualSP",
"token_count": 1855
} | 299 |
# Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task
Spider is a large human-labeled dataset for complex and cross-domain semantic parsing and text-to-SQL task (natural language interfaces for relational databases). It is released along with our EMNLP 2018 pa... | ContextualSP/unified_parser_text_to_sql/third_party/spider/README.md/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/third_party/spider/README.md",
"repo_id": "ContextualSP",
"token_count": 3773
} | 300 |
SUPERNET:
MLP_RATIO: 4.0
NUM_HEADS: 10
EMBED_DIM: 640
DEPTH: 16
SEARCH_SPACE:
MLP_RATIO:
- 3.0
- 3.5
- 4.0
NUM_HEADS:
- 9
- 10
DEPTH:
- 14
- 15
- 16
EMBED_DIM:
- 528
- 576
- 624
| Cream/AutoFormer/experiments/supernet/supernet-B.yaml/0 | {
"file_path": "Cream/AutoFormer/experiments/supernet/supernet-B.yaml",
"repo_id": "Cream",
"token_count": 155
} | 301 |
import torch
import math
import warnings
from itertools import repeat
from torch._six import container_abcs
import torch.nn as nn
def _no_grad_trunc_normal_(tensor, mean, std, a, b):
# Cut & paste from PyTorch official master until it's in a few official releases - RW
# Method based on https://people.sc.fsu.ed... | Cream/AutoFormer/model/utils.py/0 | {
"file_path": "Cream/AutoFormer/model/utils.py",
"repo_id": "Cream",
"token_count": 1585
} | 302 |
import torch
import torch.nn as nn
import torch.utils.checkpoint as checkpoint
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
super().__init__()
out_featur... | Cream/AutoFormerV2/model/SSS.py/0 | {
"file_path": "Cream/AutoFormerV2/model/SSS.py",
"repo_id": "Cream",
"token_count": 11447
} | 303 |
from .io import imread, imwrite, imfrombytes
from .transforms import (bgr2gray, gray2bgr, bgr2rgb, rgb2bgr, bgr2hsv,
hsv2bgr, bgr2hls, hls2bgr, iminvert, imflip, imrotate,
imcrop, impad, impad_to_multiple, imnormalize,
imdenormalize, imresize, i... | Cream/CDARTS/CDARTS_detection/mmcv/image/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/image/__init__.py",
"repo_id": "Cream",
"token_count": 340
} | 304 |
import os
import os.path as osp
import pkgutil
import time
import warnings
from collections import OrderedDict
from importlib import import_module
import torch
import torchvision
from terminaltables import AsciiTable
from torch.utils import model_zoo
import mmcv
from .utils import get_dist_info
open_mmlab_model_urls... | Cream/CDARTS/CDARTS_detection/mmcv/runner/checkpoint.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/checkpoint.py",
"repo_id": "Cream",
"token_count": 3123
} | 305 |
from collections import OrderedDict
import numpy as np
class LogBuffer(object):
def __init__(self):
self.val_history = OrderedDict()
self.n_history = OrderedDict()
self.output = OrderedDict()
self.ready = False
def clear(self):
self.val_history.clear()
self.n... | Cream/CDARTS/CDARTS_detection/mmcv/runner/log_buffer.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/log_buffer.py",
"repo_id": "Cream",
"token_count": 552
} | 306 |
#include "flow_warp.hpp"
void FlowWarp(double* img, double* flow, double* out, const int height,
const int width, const int channels, const int filling_value = 0,
const int interpolateMode = 0) {
for (int h = 0; h < height; h++) {
for (int w = 0; w < width; w++) {
int offset_cur... | Cream/CDARTS/CDARTS_detection/mmcv/video/optflow_warp/flow_warp.cpp/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/video/optflow_warp/flow_warp.cpp",
"repo_id": "Cream",
"token_count": 1051
} | 307 |
from .env import get_root_logger, init_dist, set_random_seed
from .inference import (inference_detector, init_detector, show_result,
show_result_pyplot)
from .train import train_detector
__all__ = [
'init_dist', 'get_root_logger', 'set_random_seed', 'train_detector',
'init_detector', 'i... | Cream/CDARTS/CDARTS_detection/mmdet/apis/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/apis/__init__.py",
"repo_id": "Cream",
"token_count": 152
} | 308 |
import torch
from .transforms import bbox2delta
from ..utils import multi_apply
def bbox_target(pos_bboxes_list,
neg_bboxes_list,
pos_gt_bboxes_list,
pos_gt_labels_list,
cfg,
reg_classes=1,
target_means=[.0, .0, .0, .0],
... | Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/bbox_target.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/bbox_target.py",
"repo_id": "Cream",
"token_count": 1558
} | 309 |
import os
import os.path as osp
import mmcv
import torch
import torch.distributed as dist
from mmcv.parallel import collate, scatter
from mmcv.runner import Hook
from torch.utils.data import Dataset
class DistEvalHook(Hook):
def __init__(self, dataset, interval=1, **eval_kwargs):
from mmdet import datas... | Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/eval_hooks.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/eval_hooks.py",
"repo_id": "Cream",
"token_count": 1347
} | 310 |
from .custom import CustomDataset
from .cityscapes import CityscapesDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .wider_face import WIDERFaceDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader, build_dataloader_arch
from .datase... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/__init__.py",
"repo_id": "Cream",
"token_count": 260
} | 311 |
import mmcv
import numpy as np
import torch
__all__ = [
'ImageTransform', 'BboxTransform', 'MaskTransform', 'SegMapTransform',
'Numpy2Tensor'
]
class ImageTransform(object):
"""Preprocess an image.
1. rescale the image to expected size
2. normalize the image
3. flip the image (if needed)
... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/transforms.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/transforms.py",
"repo_id": "Cream",
"token_count": 2153
} | 312 |
import torch
import logging
import math
import re
from collections.__init__ import OrderedDict
from copy import deepcopy
from typing import Tuple, Optional, List
import torch.nn as nn
import numpy as np
from functools import partial
from itertools import repeat
from torch._six import container_abcs
# from timm.models.... | Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/builder.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/builder.py",
"repo_id": "Cream",
"token_count": 16979
} | 313 |
import logging
import torch
from collections import OrderedDict
def load_checkpoint(model,
filename,
strict=False,
logger=None):
checkpoint = torch.load(filename)
# get state_dict from checkpoint
if isinstance(checkpoint, OrderedDict):
... | Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/utils.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/utils.py",
"repo_id": "Cream",
"token_count": 1798
} | 314 |
from .single_stage import SingleStageDetector
from ..registry import DETECTORS
@DETECTORS.register_module
class FCOS(SingleStageDetector):
def __init__(self,
backbone,
neck,
bbox_head,
train_cfg=None,
test_cfg=None,
... | Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/fcos.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/fcos.py",
"repo_id": "Cream",
"token_count": 255
} | 315 |
import torch
import torch.nn as nn
from mmdet.core import bbox_overlaps
from .utils import weighted_loss
from ..registry import LOSSES
@weighted_loss
def iou_loss(pred, target, eps=1e-6):
"""IoU loss.
Computing the IoU loss between a set of predicted bboxes and target bboxes.
The loss is calculated as n... | Cream/CDARTS/CDARTS_detection/mmdet/models/losses/iou_loss.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/losses/iou_loss.py",
"repo_id": "Cream",
"token_count": 2151
} | 316 |
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import xavier_init
from mmdet.core import auto_fp16
from ..registry import NECKS
from ..utils import ConvModule
# For toy experiments
class MBBlock(nn.Module):
def __init__(self, in_channels, out_channels, expansion, stride, kernel_size, dilatio... | Cream/CDARTS/CDARTS_detection/mmdet/models/necks/fpn.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/necks/fpn.py",
"repo_id": "Cream",
"token_count": 6732
} | 317 |
import torch.nn as nn
norm_cfg = {
# format: layer_type: (abbreviation, module)
'BN': ('bn', nn.BatchNorm2d),
'SyncBN': ('bn', nn.SyncBatchNorm),
'GN': ('gn', nn.GroupNorm),
# and potentially 'SN'
}
def build_norm_layer(cfg, num_features, postfix=''):
""" Build normalization layer
Args:
... | Cream/CDARTS/CDARTS_detection/mmdet/models/utils/norm.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/utils/norm.py",
"repo_id": "Cream",
"token_count": 705
} | 318 |
/*!
* Copyright (c) 2017 Microsoft
* Licensed under The MIT License [see LICENSE for details]
* \file deformable_psroi_pooling.cu
* \brief
* \author Yi Li, Guodong Zhang, Jifeng Dai
*/
/***************** Adapted by Charles Shang *********************/
// modify from https://github.com/chengdazhi/Deformable-Convolu... | Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/src/deform_pool_cuda_kernel.cu/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/src/deform_pool_cuda_kernel.cu",
"repo_id": "Cream",
"token_count": 7753
} | 319 |
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#include <THC/THC.h>
#include <THC/THCDeviceUtils.cuh>
#include <vector>
#include <iostream>
int const threadsPerBlock = sizeof(unsigned long long) * 8;
__device__ inline float devIoU(f... | Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/src/nms_kernel.cu/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/src/nms_kernel.cu",
"repo_id": "Cream",
"token_count": 2166
} | 320 |
import torch
from torch.autograd import gradcheck
import os.path as osp
import sys
sys.path.append(osp.abspath(osp.join(__file__, '../../')))
from roi_pool import RoIPool # noqa: E402
feat = torch.randn(4, 16, 15, 15, requires_grad=True).cuda()
rois = torch.Tensor([[0, 0, 0, 50, 50], [0, 10, 30, 43, 55],
... | Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_pool/gradcheck.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_pool/gradcheck.py",
"repo_id": "Cream",
"token_count": 224
} | 321 |
# coding: utf-8
import asyncio
import contextlib
import logging
import os
import time
from typing import List
import torch
logger = logging.getLogger(__name__)
DEBUG_COMPLETED_TIME = bool(os.environ.get('DEBUG_COMPLETED_TIME', False))
@contextlib.asynccontextmanager
async def completed(trace_name='',
... | Cream/CDARTS/CDARTS_detection/mmdet/utils/contextmanagers.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/utils/contextmanagers.py",
"repo_id": "Cream",
"token_count": 1902
} | 322 |
import argparse
import re
from collections import OrderedDict
import torch
def convert(in_file, out_file):
"""Convert keys in checkpoints.
There can be some breaking changes during the development of mmdetection,
and this tool is used for upgrading checkpoints trained with old versions
to the latest... | Cream/CDARTS/CDARTS_detection/tools/upgrade_model_version.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/tools/upgrade_model_version.py",
"repo_id": "Cream",
"token_count": 514
} | 323 |
from __future__ import print_function, division
import os
import numpy as np
import scipy.io
import torch.utils.data as data
from PIL import Image
from torchvision import transforms
from dataloaders import custom_transforms as tr
class SBDSegmentation(data.Dataset):
NUM_CLASSES = 21
def __init__(self,
... | Cream/CDARTS/CDARTS_segmentation/dataloaders/datasets/sbd.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/dataloaders/datasets/sbd.py",
"repo_id": "Cream",
"token_count": 1950
} | 324 |
from .build import (
build_dataset_from_cfg, build_train_loader_from_cfg, build_test_loader_from_cfg)
| Cream/CDARTS/CDARTS_segmentation/segmentation/data/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/data/__init__.py",
"repo_id": "Cream",
"token_count": 40
} | 325 |
# ------------------------------------------------------------------------------
# Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/evaluation/coco_evaluation.py
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ---------------------------------------------------------------------------... | Cream/CDARTS/CDARTS_segmentation/segmentation/evaluation/coco_instance.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/evaluation/coco_instance.py",
"repo_id": "Cream",
"token_count": 1796
} | 326 |
# ------------------------------------------------------------------------------
# DeepLabV3 decoder.
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
from collections import OrderedDict
from torch import nn
from .aspp import ASPP
__al... | Cream/CDARTS/CDARTS_segmentation/segmentation/model/decoder/deeplabv3.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/decoder/deeplabv3.py",
"repo_id": "Cream",
"token_count": 498
} | 327 |
# ------------------------------------------------------------------------------
# Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/solver/lr_scheduler.py
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
im... | Cream/CDARTS/CDARTS_segmentation/segmentation/solver/lr_scheduler.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/solver/lr_scheduler.py",
"repo_id": "Cream",
"token_count": 2563
} | 328 |
from .camvid import CamVid
__all__ = ['CamVid'] | Cream/CDARTS/CDARTS_segmentation/tools/datasets/camvid/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/tools/datasets/camvid/__init__.py",
"repo_id": "Cream",
"token_count": 19
} | 329 |
import torch
import torch.distributed as dist
from torch import nn
from torch.autograd.function import Function
from torch.nn import functional as F
class _NewEmptyTensorOp(torch.autograd.Function):
@staticmethod
def forward(ctx, x, new_shape):
ctx.shape = x.shape
return x.new_empty(new_shape)
... | Cream/CDARTS/CDARTS_segmentation/train/layers.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/train/layers.py",
"repo_id": "Cream",
"token_count": 1988
} | 330 |
import torch
import torch.nn as nn
from utils import utils
from datasets import data_utils
from models.loss import CrossEntropyLabelSmooth
def train(train_loader, model, optimizer, epoch, writer, logger, config):
device = torch.device("cuda")
if config.label_smooth > 0:
criterion = CrossEntropyLabelSmo... | Cream/CDARTS/benchmark201/core/augment_function.py/0 | {
"file_path": "Cream/CDARTS/benchmark201/core/augment_function.py",
"repo_id": "Cream",
"token_count": 2516
} | 331 |
import torch
import numpy as np
import torchvision.datasets as dset
import torchvision.transforms as transforms
from lib.datasets.data_utils import SubsetDistributedSampler
from lib.datasets.data_utils import ImageNetPolicy
def get_search_datasets(config):
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406... | Cream/CDARTS/lib/datasets/imagenet.py/0 | {
"file_path": "Cream/CDARTS/lib/datasets/imagenet.py",
"repo_id": "Cream",
"token_count": 1655
} | 332 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.