text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
impor... | COCO-LM/fairseq/scripts/spm_train.py/0 | {
"file_path": "COCO-LM/fairseq/scripts/spm_train.py",
"repo_id": "COCO-LM",
"token_count": 131
} | 211 |
#!/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.
from examples.speech_recognition.criterions.cross_entropy_acc import (
CrossEntropyWithAccCriterion,
)
from .asr_t... | COCO-LM/fairseq/tests/speech_recognition/test_cross_entropy.py/0 | {
"file_path": "COCO-LM/fairseq/tests/speech_recognition/test_cross_entropy.py",
"repo_id": "COCO-LM",
"token_count": 536
} | 212 |
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import shutil
import sys
import tempfile
import unittest
from typing import Optional
from unittest.mock import MagicMock
class TestFileIO(unittest.TestCase):
_tmpdir: Optional[st... | COCO-LM/fairseq/tests/test_file_io.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_file_io.py",
"repo_id": "COCO-LM",
"token_count": 873
} | 213 |
# 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 unittest
import numpy as np
from fairseq.data import ListDataset, ResamplingDataset
class TestResamplingDataset(u... | COCO-LM/fairseq/tests/test_resampling_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_resampling_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1558
} | 214 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
## Finetuning COCO-LM for sequence classification on GLUE.
## The script is largely adapted from the huggingface transformers library.
from __future__ import absolute_import, division, print_function
import argparse
import glob
import logging
i... | COCO-LM/huggingface/run_glue.py/0 | {
"file_path": "COCO-LM/huggingface/run_glue.py",
"repo_id": "COCO-LM",
"token_count": 15816
} | 215 |
# ------------------------------------------
# CSWin Transformer
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# written By Xiaoyi Dong
# ------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
from timm.da... | CSWin-Transformer/models/cswin.py/0 | {
"file_path": "CSWin-Transformer/models/cswin.py",
"repo_id": "CSWin-Transformer",
"token_count": 8006
} | 216 |
seed_everything: 42
# ---------------------------- TRAINER -------------------------------------------
trainer:
default_root_dir: ${oc.env:OUTPUT_DIR,/home/t-tungnguyen/ClimaX/exps/regional_forecast_climax}
precision: 16
gpus: null
num_nodes: 1
accelerator: gpu
strategy: ddp
min_epochs: 1
max_epochs... | ClimaX/configs/regional_forecast_climax.yaml/0 | {
"file_path": "ClimaX/configs/regional_forecast_climax.yaml",
"repo_id": "ClimaX",
"token_count": 2753
} | 217 |
# Pretraining
::: climax.pretrain.datamodule
::: climax.pretrain.module
| ClimaX/docs/reference/pretrain.md/0 | {
"file_path": "ClimaX/docs/reference/pretrain.md",
"repo_id": "ClimaX",
"token_count": 27
} | 218 |
datadir: /data/CMIP6/CMCC
name: temperature
cmip_name: ta
era_name: t
run: r1i1p1f1
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/CMCC/config_temperature.yml/0 | {
"file_path": "ClimaX/snakemake_configs/CMCC/config_temperature.yml",
"repo_id": "ClimaX",
"token_count": 58
} | 219 |
datadir: /data/CMIP6/MPI-ESM
server_prefix: http://esgf-data1.llnl.gov/thredds/fileServer/css03_data/CMIP6/CMIP
name: geopotential
cmip_name: zg
era_name: z
output_type: 6hrPlevPt
run: r1i1p1f1
version: v20190815
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/MPI-ESM/config_geopotential.yml/0 | {
"file_path": "ClimaX/snakemake_configs/MPI-ESM/config_geopotential.yml",
"repo_id": "ClimaX",
"token_count": 119
} | 220 |
import os
from typing import Optional
import numpy as np
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from climax.climate_projection.dataset import ClimateBenchDataset, input_for_training, load_x_y, output_for_training, split_train_val
def collate_fn(batch):... | ClimaX/src/climax/climate_projection/datamodule.py/0 | {
"file_path": "ClimaX/src/climax/climate_projection/datamodule.py",
"repo_id": "ClimaX",
"token_count": 2313
} | 221 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
from typing import Optional
import numpy as np
import torch
import torchdata.datapipes as dp
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, IterableDataset
from torchvision.transforms import ... | ClimaX/src/climax/regional_forecast/datamodule.py/0 | {
"file_path": "ClimaX/src/climax/regional_forecast/datamodule.py",
"repo_id": "ClimaX",
"token_count": 4235
} | 222 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import random
from PIL import Image
from data.base_dataset import BaseDataset, get_params, get_transform
class Pix2pixDataset(BaseDataset):
@staticmethod
def modify_commandline_options(parser, is_train):
parser.add_a... | CoCosNet-v2/data/pix2pix_dataset.py/0 | {
"file_path": "CoCosNet-v2/data/pix2pix_dataset.py",
"repo_id": "CoCosNet-v2",
"token_count": 2742
} | 223 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
def convert_1d_to_2d(index, base=64):
x = index // base
y = index % base
return x,y
def convert_2d_to_1d(x, y, base=64):
return x*base+y
def batch_meshgrid(... | CoCosNet-v2/models/networks/ops.py/0 | {
"file_path": "CoCosNet-v2/models/networks/ops.py",
"repo_id": "CoCosNet-v2",
"token_count": 585
} | 224 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torch.nn.utils.spectral_norm as spectral_norm
from models.networks.normalization import SPADE, equal_lr, SPADE_TwoPath
# ResNet block that uses SPADE.
... | CoCosNet/models/networks/architecture.py/0 | {
"file_path": "CoCosNet/models/networks/architecture.py",
"repo_id": "CoCosNet",
"token_count": 3967
} | 225 |
# 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/utils.py/0 | {
"file_path": "CodeBERT/CodeBERT/codesearch/utils.py",
"repo_id": "CodeBERT",
"token_count": 5073
} | 226 |
import random
import torch
import logging
import multiprocessing
import numpy as np
logger = logging.getLogger(__name__)
def add_args(parser):
parser.add_argument(
"--task",
type=str,
required=False,
choices=[
"review",
],
)
parser.add_argument(
... | CodeBERT/CodeReviewer/code/configs.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/configs.py",
"repo_id": "CodeBERT",
"token_count": 3204
} | 227 |
#!/usr/bin/python
'''
This script was adapted from the original version by hieuhoang1972 which is part of MOSES.
'''
# $Id: bleu.py 1307 2007-03-14 22:22:36Z hieuhoang1972 $
'''Provides:
cook_refs(refs, n=4): Transform a list of reference sentences as strings into a form usable by cook_test().
cook_test(test, refs... | CodeBERT/CodeReviewer/code/evaluator/smooth_bleu.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/evaluator/smooth_bleu.py",
"repo_id": "CodeBERT",
"token_count": 3403
} | 228 |
# batch size 6 for 16 GB GPU
mnt_dir="/home/codereview"
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}
WORLD_SIZE=1 && echo WORLD_SIZE: ${WORLD_SIZE}
NODES=1 && echo NODES... | CodeBERT/CodeReviewer/code/sh/test-ref.sh/0 | {
"file_path": "CodeBERT/CodeReviewer/code/sh/test-ref.sh",
"repo_id": "CodeBERT",
"token_count": 419
} | 229 |
# 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/GraphCodeBERT/clonedetection/run.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/clonedetection/run.py",
"repo_id": "CodeBERT",
"token_count": 13244
} | 230 |
from .utils import (remove_comments_and_docstrings,
tree_to_token_index,
index_to_code_token,
tree_to_variable_index)
from .DFG import DFG_python,DFG_java,DFG_ruby,DFG_go,DFG_php,DFG_javascript,DFG_csharp | CodeBERT/GraphCodeBERT/refinement/parser/__init__.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/refinement/parser/__init__.py",
"repo_id": "CodeBERT",
"token_count": 136
} | 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/GraphCodeBERT/translation/run.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/translation/run.py",
"repo_id": "CodeBERT",
"token_count": 14964
} | 232 |
# UniXcoder
This repo will provide the code for reproducing the experiments in [UniXcoder: Unified Cross-Modal Pre-training for Code Representation](https://arxiv.org/pdf/2203.03850.pdf). UniXcoder is a unified cross-modal pre-trained model for programming languages to support both code-related understanding and gener... | CodeBERT/UniXcoder/README.md/0 | {
"file_path": "CodeBERT/UniXcoder/README.md",
"repo_id": "CodeBERT",
"token_count": 2829
} | 233 |
# 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-generation/run.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-generation/run.py",
"repo_id": "CodeBERT",
"token_count": 9842
} | 234 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
import torch.nn as nn
from transformers import RobertaTokenizer, RobertaModel, RobertaConfig
class UniXcoder(nn.Module):
def __init__(self, model_name):
"""
Build UniXcoder.
Parameters:
... | CodeBERT/UniXcoder/unixcoder.py/0 | {
"file_path": "CodeBERT/UniXcoder/unixcoder.py",
"repo_id": "CodeBERT",
"token_count": 5208
} | 235 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from collections import defaultdict
from src.io_utils import Tools
STOP_TOKEN = ['\nclass', '\ndef', '\n#', '\nif', '\nprint']
class PostProcessor:
@staticmethod
def map_task_id_for_solution(predict_path, source_path):
database... | CodeT/CodeT/src/postprocess.py/0 | {
"file_path": "CodeT/CodeT/src/postprocess.py",
"repo_id": "CodeT",
"token_count": 1685
} | 236 |
$schema: http://azureml/sdk-2-0/CommandComponent.json
name: microsoft.msra.dki.verifier_trainer
display_name: Verifier Train
version: 0.1.2-dev1
is_deterministic: True
type: CommandComponent
description: Verifier Train
tags: {category: Verifier Training, contact: Zeqi.Lin@microsoft.com}
inputs:
wandb_run_name:
ty... | CodeT/DIVERSE/code/verifier_train.yaml/0 | {
"file_path": "CodeT/DIVERSE/code/verifier_train.yaml",
"repo_id": "CodeT",
"token_count": 1664
} | 237 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import openai
import sys
import os
import configparser
import re
import psutil
from pathlib import Path
from prompt_file import PromptFile
from commands import get_command_result
MULTI_TURN = "off"
SHELL = ""
ENGINE = ''
TEMPERATURE = 0
MAX_TOKENS = 300
DEBUG_MODE = F... | Codex-CLI/src/codex_query.py/0 | {
"file_path": "Codex-CLI/src/codex_query.py",
"repo_id": "Codex-CLI",
"token_count": 3263
} | 238 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: person.py
Description: Person section of the Cognitive Face API.
"""
from . import util
def add_face(image,
person_group_id,
person_id,
user_data=None,
target_face=None):
"""Add a representative face to a p... | Cognitive-Face-Python/cognitive_face/person.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/person.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 2816
} | 239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: main.py
Description: main script for Python SDK sample.
"""
from view import MyApp
if __name__ == "__main__":
app = MyApp(False)
app.MainLoop()
| Cognitive-Face-Python/sample/__main__.py/0 | {
"file_path": "Cognitive-Face-Python/sample/__main__.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 82
} | 240 |
export CUDA_VISIBLE_DEVICES=3
python t5_run_eval.py \
--model_name_or_path ./checkpoint/Com/ContrastExp_finetune_set1_seed1/checkpoint-50000 \
--subtask Com \
--validation_file test \
--ebatch_size 16 \
--set set1 | ContextualSP/abstraction_probing/code/t5_code/Com_ContrastExp_test.sh/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/Com_ContrastExp_test.sh",
"repo_id": "ContextualSP",
"token_count": 85
} | 241 |
#!/usr/bin/env python
# coding=utf-8
import logging
import os
import sys
from dataclasses import dataclass, field
from typing import Optional
import nltk
import numpy as np
import transformers
from datasets import load_dataset, load_metric
from filelock import FileLock
from transformers import (
AutoConfig,
A... | ContextualSP/abstraction_probing/code/t5_code/t5_eval_model.py/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/t5_eval_model.py",
"repo_id": "ContextualSP",
"token_count": 10141
} | 242 |
<h1 align="center"> AdapterShare: Task Correlation Modeling with Adapter Differentiation </h1>
<div align=center><img width="350" height=350" src="assets/adaptershare.png"/></div>
## Introduction
Thanks to the development of pre-trained language models, multitask learning (MTL) methods have achieved great success in ... | ContextualSP/adaptershare/README.md/0 | {
"file_path": "ContextualSP/adaptershare/README.md",
"repo_id": "ContextualSP",
"token_count": 648
} | 243 |
# Copyright (c) Microsoft. All rights reserved.
import random
import torch
import numpy
import subprocess
class AverageMeter(object):
"""Computes and stores the average and current value."""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.... | ContextualSP/adaptershare/data_utils/utils.py/0 | {
"file_path": "ContextualSP/adaptershare/data_utils/utils.py",
"repo_id": "ContextualSP",
"token_count": 538
} | 244 |
cola:
data_format: PremiseOnly
dropout_p: 0.05
enable_san: false
metric_meta:
- ACC
- MCC
loss: CeCriterion
kd_loss: MseCriterion
adv_loss: SymKlCriterion
n_class: 2
task_type: Classification
mnli:
data_format: PremiseAndOneHypothesis
dropout_p: 0.1
enable_san: false
labels:
- contradic... | ContextualSP/adaptershare/experiments/glue/glue_task_def.yml/0 | {
"file_path": "ContextualSP/adaptershare/experiments/glue/glue_task_def.yml",
"repo_id": "ContextualSP",
"token_count": 819
} | 245 |
# Copyright (c) Microsoft. All rights reserved.
# some codes are from: https://github.com/namisan/mt-dnn
# please cite the (arXiv preprint arXiv:2002.07972) if you use the script
# by Xiaodong Liu
# xiaodl@microsoft.com
# 10/08/2021
import os
import argparse
from random import shuffle
import json
import pandas as pd
... | ContextualSP/adaptershare/experiments/superglue/superglue_utils.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/superglue/superglue_utils.py",
"repo_id": "ContextualSP",
"token_count": 7168
} | 246 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import enum
from numpy.lib.arraysetops import isin
from numpy.lib.function_base import insert
from data_utils.metrics import calc_metrics
from mt_dnn.batcher import Collater
from data_utils.task_def import TaskType
from data_utils.utils_qa import postproces... | ContextualSP/adaptershare/mt_dnn/inference.py/0 | {
"file_path": "ContextualSP/adaptershare/mt_dnn/inference.py",
"repo_id": "ContextualSP",
"token_count": 1596
} | 247 |
mnli:
data_format: PremiseAndOneHypothesis
dropout_p: 0
enable_san: false
labels:
- contradiction
- neutral
- entailment
metric_meta:
- ACC
loss: CeCriterion
kd_loss: MseCriterion
adv_loss: SymKlCriterion
n_class: 3
split_names:
- train
- matched_dev
- mismatched_dev
- matched_test
... | ContextualSP/adaptershare/tests/mnli_task_def.yml/0 | {
"file_path": "ContextualSP/adaptershare/tests/mnli_task_def.yml",
"repo_id": "ContextualSP",
"token_count": 138
} | 248 |
{"uid": "0", "label": 0, "token_id": [101, 3021, 26265, 2627, 1996, 2160, 1012, 102], "type_id": [0, 0, 0, 0, 0, 0, 0, 0], "attention_mask": [1, 1, 1, 1, 1, 1, 1, 1]}
| ContextualSP/adaptershare/tests/sample_data/output/cola_test.json/0 | {
"file_path": "ContextualSP/adaptershare/tests/sample_data/output/cola_test.json",
"repo_id": "ContextualSP",
"token_count": 84
} | 249 |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
from utils import *
def get_bert_hidden_size(bert_version: str) -> int:
if bert_version in ['bert-base-uncased', 'bert-base-chinese', 'bert-base-multilingual-cased',
'hfl/chinese-bert-ww... | ContextualSP/awakening_latent_grounding/models/nn_utils.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/models/nn_utils.py",
"repo_id": "ContextualSP",
"token_count": 1210
} | 250 |
import math
import torch
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data.dataset import Dataset
from torch.utils.data.dataloader import DataLoader
from torch.utils.data.sampler import Sampler, SequentialSampler, BatchSampler, SubsetRandomSampler
from logging import warning, info
from utils.data_types ... | ContextualSP/awakening_latent_grounding/utils/data_iter.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/utils/data_iter.py",
"repo_id": "ContextualSP",
"token_count": 10904
} | 251 |
import torch
from torch.autograd import Variable
from torch.nn import functional
def sequence_mask(sequence_length, max_len=None):
if max_len is None:
max_len = sequence_length.data.max()
batch_size = sequence_length.size(0)
seq_range = torch.arange(0, max_len).long()
seq_range_expand = seq_ra... | ContextualSP/compositional_generalization/masked_cross_entropy.py/0 | {
"file_path": "ContextualSP/compositional_generalization/masked_cross_entropy.py",
"repo_id": "ContextualSP",
"token_count": 834
} | 252 |
# 不完整话语重写 <img src="https://pytorch.org/assets/images/logo-dark.svg" height = "25" align=center />
[English Version](README.md)
本仓库是论文[Incomplete Utterance Rewriting as Semantic Segmentation](https://arxiv.org/pdf/2009.13166.pdf)的官方实现。在这篇论文中,我们将*不完整话语重写*任务视为一个面向对话编辑的任务,并据此提出一个全新的、使用语义分割思路来解决该任务的模型。
如果本仓库或论文对您的研究有所帮助... | ContextualSP/incomplete_utterance_rewriting/README_zh.md/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/README_zh.md",
"repo_id": "ContextualSP",
"token_count": 4021
} | 253 |
#!/usr/bin/env bash
export model_file=../checkpoints/run_multi_bert
export config_file=../configs/multi_bert.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 \
--i... | ContextualSP/incomplete_utterance_rewriting/src/train_multi_bert.sh/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/src/train_multi_bert.sh",
"repo_id": "ContextualSP",
"token_count": 186
} | 254 |
"""
This script is responsible for translating SQL to SemQL in a flexible and readable method.
"""
from typing import Dict, List, Tuple, Optional
import json
from src.context.grammar import *
from allennlp.common.checks import ConfigurationError
from src.context.graph import Graph
from collections import deque
from cop... | ContextualSP/interactive_text_to_sql/src/context/converter.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/context/converter.py",
"repo_id": "ContextualSP",
"token_count": 23521
} | 255 |
# coding: utf-8
import random
import copy
from typing import List
class Node:
STATEMENT_TYPE = 0
ROOT_TYPE = 1
SELECT_TYPE = 2
FILTER_TYPE = 3
ORDER_TYPE = 4
A_TYPE = 5
COLUMN_TYPE = 11
TABLE_TYPE = 12
KEYWORD_TYPE = 13
VALUE_TYPE = '3'
TYPE_DICT = {'SQL': None, 'Statem... | ContextualSP/interactive_text_to_sql/src/utils/semql_tree_util.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/utils/semql_tree_util.py",
"repo_id": "ContextualSP",
"token_count": 6627
} | 256 |
"""Tools for working with CodaLab."""
import pickle as pickle
import json
import os
import platform
import shutil
import sys
import tempfile
from contextlib import contextmanager
import matplotlib.image as mpimg
from gtd.io import shell
__author__ = 'kelvinguu'
# need to be specified by user
worksheet = None
site =... | ContextualSP/lemon/executor/gtd/codalab.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/codalab.py",
"repo_id": "ContextualSP",
"token_count": 2892
} | 257 |
from collections import defaultdict
from contextlib import contextmanager
import logging
import psycopg2
from psycopg2.extras import RealDictCursor
from gtd.utils import Bunch
class Postgres(object):
"""Provides a wrapper around postgres.
Args:
db_name (str): name of database.
schema_name (s... | ContextualSP/lemon/executor/gtd/postgres.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/postgres.py",
"repo_id": "ContextualSP",
"token_count": 4403
} | 258 |
'''
Created on Oct 23, 2015
@author: kelvinguu
'''
import logging
import operator
import os.path
import random
import shutil
import traceback
import types
import json
import warnings
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import OrderedDict, defaultdict, MutableMapping, Mapping
from... | ContextualSP/lemon/executor/gtd/utils.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/utils.py",
"repo_id": "ContextualSP",
"token_count": 11839
} | 259 |
"""Predicate: output token."""
from gtd.utils import ComparableMixin
class Predicate(ComparableMixin):
"""Represents a step in the logical form (i.e., an output token)."""
__slots__ = ['_name', '_original_string', '_types']
def __init__(self, name, original_string=None, types=None):
"""Create Pr... | ContextualSP/lemon/executor/strongsup/predicate.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/predicate.py",
"repo_id": "ContextualSP",
"token_count": 782
} | 260 |
from strongsup.predicates_computer import PredicatesComputer
from strongsup.rlong.predicate import RLongPredicate
class RLongPredicatesComputer(PredicatesComputer):
def compute_predicates(self, tokens):
"""Return list[(Predicate, alignment)]"""
return [(x, []) for x in self._ALL_PREDICATES]
clas... | ContextualSP/lemon/executor/strongsup/rlong/predicates_computer.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/rlong/predicates_computer.py",
"repo_id": "ContextualSP",
"token_count": 1304
} | 261 |
import os
import re
from abc import ABCMeta, abstractproperty
from gtd.utils import cached_property
from dependency.data_directory import DataDirectory
from strongsup.world import World
from strongsup.tables.executor import TablesPostfixExecutor
from strongsup.tables.graph import TablesKnowledgeGraph
from strongsup.ta... | ContextualSP/lemon/executor/strongsup/tables/world.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tables/world.py",
"repo_id": "ContextualSP",
"token_count": 1768
} | 262 |
import numpy as np
import pytest
import tensorflow as tf
from gtd.ml.framework import Feedable
from gtd.ml.utils import guarantee_initialized_variables
from strongsup.value_function import LogisticValueFunction, ValueFunctionExample
from strongsup.utils import OptimizerOptions
class DummyParseModel(Feedable):
de... | ContextualSP/lemon/executor/strongsup/tests/test_value_function.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tests/test_value_function.py",
"repo_id": "ContextualSP",
"token_count": 882
} | 263 |
#!/usr/bin/env python3
import csv
from typing import *
import logging
import sys
import json
EXIT_STATUS_ANSWERS_MALFORMED = 1
EXIT_STATUS_PREDICTIONS_MALFORMED = 2
EXIT_STATUS_PREDICTIONS_EXTRA = 3
EXIT_STATUS_PREDICTION_MISSING = 4
def calculate_accuracy(question_answers: Dict[str, str], predictions: Dict[str, Li... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/evaluator/evaluator.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/evaluator/evaluator.py",
"repo_id": "ContextualSP",
"token_count": 2084
} | 264 |
import random
from collections import Counter
import numpy as np
from allennlp_reasoning_explainqa.common.constants import *
def dcg_score(y_true, y_score, k=10, gains="exponential"):
"""Discounted cumulative gain (DCG) at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/allennlp_reasoning_explainqa/training/metrics/explanation_eval.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/allennlp_reasoning_explainqa/training/metrics/explanation_eval.py",
"repo_id": "ContextualSP",
"token_count": 4267
} | 265 |
# ProPara Leaderboard training data
* `answers.tsv` is an actions file with correct answers
* `dummy-predictions.tsv` is an actions file with dummy predictions (action is "NONE")
* `sentences.tsv` is a list of sentences (steps) for each process.
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/data/train/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/data/train/README.md",
"repo_id": "ContextualSP",
"token_count": 75
} | 266 |
#!/usr/bin/env python3
# % cat testfiles-5/predictions.tsv | sort | python3 explainer.py
# In paragraph 4, sentence 2, the participant "plants" is moved from an unknown location to sediment
# In paragraph 4, sentence 3, the participant "bacteria" is moved from an unknown location to sediment
# In paragraph 4, sentence... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/explainer.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/explainer.py",
"repo_id": "ContextualSP",
"token_count": 615
} | 267 |
## Test case: ProStruct prediction on test set
* answers.tsv is a sorted copy of the answers to the [ProPara test set](../../data/test/).
* predictions.tsv is the prediction generated by ProStruct.
An evaluation on this prediction should result in an F1 score of 0.545.
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/testfiles-1/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/testfiles-1/README.md",
"repo_id": "ContextualSP",
"token_count": 74
} | 268 |
# LogiGAN
This repository serves primarily as codebase and data, model for training, evaluation and inference of the logical pre-training method LogiGAN.
[LogiGAN](https://arxiv.org/abs/2205.08794) (NeurIPS 2022) is the adversarial logical pre-training method with Transformer-based encoder-decoder backbone.
The data a... | ContextualSP/logigan/README.md/0 | {
"file_path": "ContextualSP/logigan/README.md",
"repo_id": "ContextualSP",
"token_count": 406
} | 269 |
indicator_type=$1
tmp_dir=./filter_${indicator_type}
if [ -d ${tmp_dir} ]
then
rm -r ${tmp_dir}
fi
mkdir ${tmp_dir}
if [ ${indicator_type} == premise ]
then
python filter.py --start_index 0 --end_index 500000 --indicator_type premise &
python filter.py --start_index 500000 --end_index 1000000 --indicator_... | ContextualSP/logigan/corpus_construction/mlm_corpus/filter.sh/0 | {
"file_path": "ContextualSP/logigan/corpus_construction/mlm_corpus/filter.sh",
"repo_id": "ContextualSP",
"token_count": 437
} | 270 |
# POET
This is the official repo for the paper [Reasoning Like Program Executors](https://arxiv.org/pdf/2201.11473.pdf).
## Pre-training Corpus
You can find the pre-training SQL corpus from [here](https://drive.google.com/file/d/1dg3NwPT2vWTcj2rx7S6GN8x5EywZiXQr), the pre-training Math corpus from [here](https://hug... | ContextualSP/poet/README.md/0 | {
"file_path": "ContextualSP/poet/README.md",
"repo_id": "ContextualSP",
"token_count": 1548
} | 271 |
import torch
import sys
from torch import nn, optim
import os
from data import treeDataset, Dictionary, customDataset
from torch.utils.data import DataLoader
from model import Seq2Seq, Encoder, Decoder, Attention, Parser
from utils import collate_fn
import argparse
import numpy as np
import sys
import time
import rand... | ContextualSP/poset_decoding/sketch_prediction/main.py/0 | {
"file_path": "ContextualSP/poset_decoding/sketch_prediction/main.py",
"repo_id": "ContextualSP",
"token_count": 8044
} | 272 |
import copy
import typing
import logging
import torch
import hyperopt
import numpy as np
import matchzoo as mz
from matchzoo.engine.base_metric import BaseMetric
from matchzoo.utils import parse_optimizer
class Tuner(object):
"""
Model hyper-parameters tuner.
`model.params.hyper_space` reprensents the ... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/tuner/tuner.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/tuner/tuner.py",
"repo_id": "ContextualSP",
"token_count": 4419
} | 273 |
"""SNLI data loader."""
import typing
from pathlib import Path
import pandas as pd
import keras
import matchzoo
_url = "https://nlp.stanford.edu/projects/snli/snli_1.0.zip"
def load_data(
stage: str = 'train',
task: str = 'classification',
target_label: str = 'entailment',
return_classes: bool = F... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/cfq/load_data.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/cfq/load_data.py",
"repo_id": "ContextualSP",
"token_count": 1699
} | 274 |
"""The rank cross entropy loss."""
import torch
from torch import nn
import torch.nn.functional as F
class RankCrossEntropyLoss(nn.Module):
"""Creates a criterion that measures rank cross entropy loss."""
__constants__ = ['num_neg']
def __init__(self, num_neg: int = 1):
"""
:class:`RankC... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/losses/rank_cross_entropy_loss.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/losses/rank_cross_entropy_loss.py",
"repo_id": "ContextualSP",
"token_count": 730
} | 275 |
"""An implementation of Bert Model."""
import typing
import torch
import torch.nn as nn
from pytorch_transformers import BertModel
from matchzoo import preprocessors
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine.param import Param
from matchzoo.engine.base_model import BaseModel
from matchzo... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/bert.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/bert.py",
"repo_id": "ContextualSP",
"token_count": 1023
} | 276 |
"""An implementation of Match LSTM Model."""
import typing
import torch
import torch.nn as nn
from torch.nn import 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.modules import MatchModule
from m... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/matchlstm.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/matchlstm.py",
"repo_id": "ContextualSP",
"token_count": 2316
} | 277 |
from . import units
from .naive_preprocessor import NaivePreprocessor
from .basic_preprocessor import BasicPreprocessor
from .bert_preprocessor import BertPreprocessor
def list_available() -> list:
from matchzoo.engine.base_preprocessor import BasePreprocessor
from matchzoo.utils import list_recursive_concret... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/__init__.py",
"repo_id": "ContextualSP",
"token_count": 110
} | 278 |
import abc
import typing
from .unit import Unit
class StatefulUnit(Unit, metaclass=abc.ABCMeta):
"""
Unit with inner state.
Usually need to be fit before transforming. All information gathered in the
fit phrase will be stored into its `context`.
"""
def __init__(self):
"""Initializa... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/stateful_unit.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/stateful_unit.py",
"repo_id": "ContextualSP",
"token_count": 321
} | 279 |
"""Early stopping."""
import typing
import torch
import numpy as np
class EarlyStopping:
"""
EarlyStopping stops training if no improvement after a given patience.
:param patience: Number fo events to wait if no improvement and then
stop the training.
:param should_decrease: The way to judg... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/early_stopping.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/early_stopping.py",
"repo_id": "ContextualSP",
"token_count": 1107
} | 280 |
import pytest
from matchzoo.engine.base_task import BaseTask
def test_base_task_instantiation():
with pytest.raises(TypeError):
BaseTask()
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/engine/test_base_task.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/engine/test_base_task.py",
"repo_id": "ContextualSP",
"token_count": 56
} | 281 |
<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/init.ipynb/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/classification/init.ipynb",
"repo_id": "ContextualSP",
"token_count": 270
} | 282 |
<jupyter_start><jupyter_code>%run init.ipynb
ranking_task = mz.tasks.Ranking(losses=mz.losses.RankCrossEntropyLoss(num_neg=10))
ranking_task.metrics = [
mz.metrics.NormalizedDiscountedCumulativeGain(k=3),
mz.metrics.NormalizedDiscountedCumulativeGain(k=5),
mz.metrics.MeanAveragePrecision()
]
preprocessor = ... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/matchlstm.ipynb/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/matchlstm.ipynb",
"repo_id": "ContextualSP",
"token_count": 804
} | 283 |
set model_file=checkpoints_sparc/sparc_concat_none_model
python -m allennlp.service.server_simple ^
--archive-path %model_file%/model.tar.gz ^
--predictor sparc ^
--include-package predictor.sparc_predictor ^
--include-package dataset_reader.sparc_reader ^
--include-package models.sparc_parser ^
... | ContextualSP/semantic_parsing_in_context/bash_files/windows/demo.bat/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/bash_files/windows/demo.bat",
"repo_id": "ContextualSP",
"token_count": 157
} | 284 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import json
import os
import random
import sys
import traceback
from typing import List, Dict, Iterable, Optional
import dill
import numpy as np
from allennlp.common.checks import ConfigurationError
from allennlp.data import DatasetReader, Token... | ContextualSP/semantic_parsing_in_context/dataset_reader/sparc_reader.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/dataset_reader/sparc_reader.py",
"repo_id": "ContextualSP",
"token_count": 13494
} | 285 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
The code body is borrowed from allennlp package. We modify it to adapt our tree-level copy
@Author: Qian Liu
"""
from collections import defaultdict
from typing import Any, Dict, List, Tuple
import torch
from allennlp.modules import Attenti... | ContextualSP/semantic_parsing_in_context/models/transition_functions/linking_transition_function.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/models/transition_functions/linking_transition_function.py",
"repo_id": "ContextualSP",
"token_count": 5760
} | 286 |
################################
# val: number(float)/string(str)/sql(dict)
# col_unit: (agg_id, col_id, isDistinct(bool))
# val_unit: (unit_op, col_unit1, col_unit2)
# table_unit: (table_type, col_unit/sql)
# cond_unit: (not_op, op_id, val_unit, val1, val2)
# condition: [cond_unit1, 'and'/'or', cond_unit2, ...]
# sql ... | ContextualSP/unified_parser_text_to_sql/third_party/spider/evaluation.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/third_party/spider/evaluation.py",
"repo_id": "ContextualSP",
"token_count": 16797
} | 287 |
from .quantization import quantize, dequantize
__all__ = ['quantize', 'dequantize']
| Cream/CDARTS/CDARTS_detection/mmcv/arraymisc/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/arraymisc/__init__.py",
"repo_id": "Cream",
"token_count": 27
} | 288 |
import os.path as osp
import cv2
import numpy as np
from mmcv.opencv_info import USE_OPENCV2
from mmcv.utils import check_file_exist, is_str, mkdir_or_exist
if not USE_OPENCV2:
from cv2 import IMREAD_COLOR, IMREAD_GRAYSCALE, IMREAD_UNCHANGED
else:
from cv2 import CV_LOAD_IMAGE_COLOR as IMREAD_COLOR
from ... | Cream/CDARTS/CDARTS_detection/mmcv/image/io.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/image/io.py",
"repo_id": "Cream",
"token_count": 1026
} | 289 |
# Copyright (c) Open-MMLab. All rights reserved.
import functools
import os
import subprocess
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=True) is None:
mp.set_start_method('spawn')
... | Cream/CDARTS/CDARTS_detection/mmcv/runner/dist_utils.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/dist_utils.py",
"repo_id": "Cream",
"token_count": 939
} | 290 |
import multiprocessing
import torch
import mmcv
from .checkpoint import load_checkpoint
def worker_func(model_cls, model_kwargs, checkpoint, dataset, data_func,
gpu_id, idx_queue, result_queue):
model = model_cls(**model_kwargs)
load_checkpoint(model, checkpoint, map_location='cpu')
torc... | Cream/CDARTS/CDARTS_detection/mmcv/runner/parallel_test.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/parallel_test.py",
"repo_id": "Cream",
"token_count": 1032
} | 291 |
#include <math.h>
#include <string.h>
using namespace std;
void FlowWarp(double* img, double* flow1, double* out, const int height,
const int width, const int channels, const int filling_value,
const int interpolateMode);
void BilinearInterpolate(const double* img, int width, int height, ... | Cream/CDARTS/CDARTS_detection/mmcv/video/optflow_warp/flow_warp.hpp/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/video/optflow_warp/flow_warp.hpp",
"repo_id": "Cream",
"token_count": 325
} | 292 |
import logging
import os
import random
import subprocess
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from mmcv.runner import get_dist_info
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=True) is None:
mp.set_sta... | Cream/CDARTS/CDARTS_detection/mmdet/apis/env.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/apis/env.py",
"repo_id": "Cream",
"token_count": 879
} | 293 |
import torch
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False):
"""Calculate overlap between two set of bboxes.
If ``is_aligned`` is ``False``, then calculate the ious between each bbox
of bboxes1 and bboxes2, otherwise the ious between each aligned pair of
bboxes1 and bboxes2.
A... | Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/geometry.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/geometry.py",
"repo_id": "Cream",
"token_count": 1094
} | 294 |
from multiprocessing import Pool
import mmcv
import numpy as np
from terminaltables import AsciiTable
from mmdet.utils import print_log
from .bbox_overlaps import bbox_overlaps
from .class_names import get_classes
def average_precision(recalls, precisions, mode='area'):
"""Calculate average precision (for singl... | Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/mean_ap.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/mean_ap.py",
"repo_id": "Cream",
"token_count": 9370
} | 295 |
import copy
from mmdet.utils import build_from_cfg
from .dataset_wrappers import ConcatDataset, RepeatDataset
from .registry import DATASETS
def _concat_dataset(cfg, default_args=None):
ann_files = cfg['ann_file']
img_prefixes = cfg.get('img_prefix', None)
seg_prefixes = cfg.get('seg_prefix', None)
p... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/builder.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/builder.py",
"repo_id": "Cream",
"token_count": 637
} | 296 |
from collections import Sequence
import matplotlib.pyplot as plt
import mmcv
import numpy as np
import torch
def to_tensor(data):
"""Convert objects of various python types to :obj:`torch.Tensor`.
Supported types are: :class:`numpy.ndarray`, :class:`torch.Tensor`,
:class:`Sequence`, :class:`int` and :cl... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/utils.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/utils.py",
"repo_id": "Cream",
"token_count": 981
} | 297 |
import logging
import torch
import torch.nn as nn
from torch.nn.modules.batchnorm import _BatchNorm
from mmcv.cnn import constant_init, kaiming_init
from .utils import load_checkpoint
from ..registry import BACKBONES
norm_cfg = {
'BN': nn.BatchNorm2d,
'SyncBN': nn.SyncBatchNorm,
'GN': nn.GroupNorm,
}
_n... | Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/detnas.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/detnas.py",
"repo_id": "Cream",
"token_count": 9095
} | 298 |
from .bbox_head import BBoxHead
from .convfc_bbox_head import ConvFCBBoxHead, SharedFCBBoxHead
from .double_bbox_head import DoubleConvFCBBoxHead
__all__ = [
'BBoxHead', 'ConvFCBBoxHead', 'SharedFCBBoxHead', 'DoubleConvFCBBoxHead'
]
| Cream/CDARTS/CDARTS_detection/mmdet/models/bbox_heads/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/bbox_heads/__init__.py",
"repo_id": "Cream",
"token_count": 93
} | 299 |
from .two_stage import TwoStageDetector
from ..registry import DETECTORS
import torch
from .. import builder
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class GridRCNN(TwoStageDetector):
"""Grid R-CNN.
This detector is the implementation of:
- ... | Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/grid_rcnn.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/grid_rcnn.py",
"repo_id": "Cream",
"token_count": 4677
} | 300 |
import torch.nn as nn
import torch.nn.functional as F
from .utils import weighted_loss
from ..registry import LOSSES
mse_loss = weighted_loss(F.mse_loss)
@LOSSES.register_module
class MSELoss(nn.Module):
def __init__(self, reduction='mean', loss_weight=1.0):
super().__init__()
self.reduction = ... | Cream/CDARTS/CDARTS_detection/mmdet/models/losses/mse_loss.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/losses/mse_loss.py",
"repo_id": "Cream",
"token_count": 277
} | 301 |
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import kaiming_init, constant_init, xavier_init
from mmdet.core import auto_fp16
from ..registry import NECKS
from ..utils import ConvModule
@NECKS.register_module
class PAFPN(nn.Module):
r""" PAFPN Arch
lateral TD 3x3 BU
C... | Cream/CDARTS/CDARTS_detection/mmdet/models/necks/fpn_panet.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/necks/fpn_panet.py",
"repo_id": "Cream",
"token_count": 3748
} | 302 |
import math
import time
import torch
import torch.nn as nn
from torch.autograd import Function
import torch.nn.functional as F
# quantize for weights and activations
class Quantizer(Function):
'''
take a real value x in alpha*[0,1] or alpha*[-1,1]
output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^... | Cream/CDARTS/CDARTS_detection/mmdet/models/utils/quant_conv.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/utils/quant_conv.py",
"repo_id": "Cream",
"token_count": 3794
} | 303 |
from .context_block import ContextBlock
__all__ = [
'ContextBlock',
]
| Cream/CDARTS/CDARTS_detection/mmdet/ops/gcb/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/gcb/__init__.py",
"repo_id": "Cream",
"token_count": 26
} | 304 |
/* Generated by Cython 0.28.3 */
/* BEGIN: Cython Metadata
{
"distutils": {
"depends": [
"/home/work/anaconda3/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h",
"/home/work/anaconda3/lib/python3.6/site-packages/numpy/core/include/numpy/ufuncobject.h"
],
... | Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/src/soft_nms_cpu.cpp/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/src/soft_nms_cpu.cpp",
"repo_id": "Cream",
"token_count": 224293
} | 305 |
# Modified from flops-counter.pytorch by Vladislav Sovrasov
# original repo: https://github.com/sovrasov/flops-counter.pytorch
# MIT License
# Copyright (c) 2018 Vladislav Sovrasov
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | Cream/CDARTS/CDARTS_detection/mmdet/utils/flops_counter.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/utils/flops_counter.py",
"repo_id": "Cream",
"token_count": 5977
} | 306 |
from argparse import ArgumentParser
import mmcv
import numpy as np
from mmdet import datasets
from mmdet.core import eval_map
def voc_eval(result_file, dataset, iou_thr=0.5):
det_results = mmcv.load(result_file)
gt_bboxes = []
gt_labels = []
gt_ignore = []
for i in range(len(dataset)):
a... | Cream/CDARTS/CDARTS_detection/tools/voc_eval.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/tools/voc_eval.py",
"repo_id": "Cream",
"token_count": 871
} | 307 |
from .base_dataset import BaseDataset
from .cityscapes import Cityscapes
from .cityscapes_panoptic import CityscapesPanoptic
from .coco_panoptic import COCOPanoptic
| Cream/CDARTS/CDARTS_segmentation/dataloaders/segdatasets/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/dataloaders/segdatasets/__init__.py",
"repo_id": "Cream",
"token_count": 56
} | 308 |
# ------------------------------------------------------------------------------
# Builds dataloader.
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
import logging
import torch
import numpy as np
from .datasets import Cityscapes, Citys... | Cream/CDARTS/CDARTS_segmentation/segmentation/data/build.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/data/build.py",
"repo_id": "Cream",
"token_count": 2649
} | 309 |
# ------------------------------------------------------------------------------
# Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/evaluation/panoptic_evaluation.py
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# -----------------------------------------------------------------------... | Cream/CDARTS/CDARTS_segmentation/segmentation/evaluation/coco_panoptic.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/evaluation/coco_panoptic.py",
"repo_id": "Cream",
"token_count": 2325
} | 310 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.