text
stringlengths
5
22M
id
stringlengths
12
177
metadata
dict
__index_level_0__
int64
0
1.37k
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import dynamicconv_cuda import torch import torch.nn.functional as F from fairseq import utils from fairseq.incremental_decoding_utils import ...
COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/dynamicconv_layer.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/dynamicconv_layer.py", "repo_id": "COCO-LM", "token_count": 4118 }
207
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "lightconv_cuda.cuh" #include "lightconv_cuda_forward.cu" #include "lightconv_cuda_backward.cu" #include "../cuda_utils....
COCO-LM/fairseq/fairseq/modules/lightconv_layer/lightconv_cuda_kernel.cu/0
{ "file_path": "COCO-LM/fairseq/fairseq/modules/lightconv_layer/lightconv_cuda_kernel.cu", "repo_id": "COCO-LM", "token_count": 4201 }
208
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import re from operator import attrgetter, itemgetter import numpy as np import torch.distributed as dist import torch.nn as n...
COCO-LM/fairseq/fairseq/modules/quantization/pq/utils.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/modules/quantization/pq/utils.py", "repo_id": "COCO-LM", "token_count": 5248 }
209
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, List, Optional import torch import torch.nn as nn from fairseq import utils from fairseq.modules import LayerNorm, M...
COCO-LM/fairseq/fairseq/modules/transformer_layer.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/modules/transformer_layer.py", "repo_id": "COCO-LM", "token_count": 8124 }
210
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import importlib from collections.abc import Collection from dataclasses import dataclass, field from typing import List import torch from fa...
COCO-LM/fairseq/fairseq/optim/cpu_adam.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/optim/cpu_adam.py", "repo_id": "COCO-LM", "token_count": 3472 }
211
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass, field from typing import List from omegaconf import II from fairseq.dataclass import FairseqD...
COCO-LM/fairseq/fairseq/optim/lr_scheduler/triangular_lr_scheduler.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/optim/lr_scheduler/triangular_lr_scheduler.py", "repo_id": "COCO-LM", "token_count": 1166 }
212
# 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. """isort:skip_file""" import argparse import importlib import os from fairseq.dataclass import FairseqDataclass from fairseq.dataclass.utils ...
COCO-LM/fairseq/fairseq/tasks/__init__.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/tasks/__init__.py", "repo_id": "COCO-LM", "token_count": 1856 }
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. from dataclasses import dataclass, field import itertools import json import logging import os from typing import Optional from argparse impor...
COCO-LM/fairseq/fairseq/tasks/translation.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/tasks/translation.py", "repo_id": "COCO-LM", "token_count": 8408 }
214
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Data pre-processing: build vocabularies and binarize training data. """ import logging import os import shutil impo...
COCO-LM/fairseq/fairseq_cli/preprocess.py/0
{ "file_path": "COCO-LM/fairseq/fairseq_cli/preprocess.py", "repo_id": "COCO-LM", "token_count": 7433 }
215
try: import torch import fused_layernorm_cuda from .fused_layer_norm import FusedLayerNorm del torch del fused_layernorm_cuda del fused_layer_norm except ImportError as err: print("cannot import kernels, please install the package")
COCO-LM/fairseq/fused_ops/fused_ops/layernorm/__init__.py/0
{ "file_path": "COCO-LM/fairseq/fused_ops/fused_ops/layernorm/__init__.py", "repo_id": "COCO-LM", "token_count": 91 }
216
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Use this script in order to build symmetric alignments for your translation dataset. This script depends on fast_align and mosesdecoder too...
COCO-LM/fairseq/scripts/build_sym_alignment.py/0
{ "file_path": "COCO-LM/fairseq/scripts/build_sym_alignment.py", "repo_id": "COCO-LM", "token_count": 1626 }
217
#!/usr/bin/env bash rm -rf fsdp_dummy mkdir -p fsdp_dummy fairseq-train /private/home/sshleifer/data-bin/stories_mmap \ --ddp-backend fully_sharded --fp16 --fp16-init-scale 4 \ --cpu-offload --checkpoint-activations \ --task language_modeling --tokens-per-sample 256 --batch-size 8 \ --arch transformer_l...
COCO-LM/fairseq/scripts/test_fsdp.sh/0
{ "file_path": "COCO-LM/fairseq/scripts/test_fsdp.sh", "repo_id": "COCO-LM", "token_count": 260 }
218
#!/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. import unittest import torch from examples.speech_recognition.data import data_utils class DataUtilsTest(unittest.Tes...
COCO-LM/fairseq/tests/speech_recognition/test_data_utils.py/0
{ "file_path": "COCO-LM/fairseq/tests/speech_recognition/test_data_utils.py", "repo_id": "COCO-LM", "token_count": 1263 }
219
# 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 argparse import copy import logging import unittest import torch from fairseq.optim.fp16_optimizer import FP16Optimizer, MemoryEfficie...
COCO-LM/fairseq/tests/test_fp16_optimizer.py/0
{ "file_path": "COCO-LM/fairseq/tests/test_fp16_optimizer.py", "repo_id": "COCO-LM", "token_count": 1905 }
220
# 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 argparse import tempfile import unittest import math import numpy as np import tests.utils as test_utils import torch from fairseq im...
COCO-LM/fairseq/tests/test_sequence_generator.py/0
{ "file_path": "COCO-LM/fairseq/tests/test_sequence_generator.py", "repo_id": "COCO-LM", "token_count": 14600 }
221
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. # Set pretrained model name, from ['cocolm-base', 'cocolm-large'] MODEL_NAME=$1 # GLUE task name, from ['MNLI', 'QQP', 'QNLI', 'SST-2', 'CoLA', 'RTE', 'MRPC', 'STS-B'] TASK=$2 # Path to GLUE dataset 'path/to/glue_data' GLUE_PATH=$3 # Output p...
COCO-LM/huggingface/run_glue.sh/0
{ "file_path": "COCO-LM/huggingface/run_glue.sh", "repo_id": "COCO-LM", "token_count": 758 }
222
# ADE20k Semantic segmentation with CSWin ## Results and Models | Backbone | Method | pretrain | Crop Size | Lr Schd | mIoU | mIoU (ms+flip) | #params | FLOPs | config | model | log | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | CSWin-T | UPerNet | ImageNet-1K ...
CSWin-Transformer/segmentation/README.md/0
{ "file_path": "CSWin-Transformer/segmentation/README.md", "repo_id": "CSWin-Transformer", "token_count": 1359 }
223
# tags: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch/tags?quick-deploy=false ARG BASE_IMAGE=openmpi4.1.0-cuda11.3-cudnn8-ubuntu20.04:latest FROM mcr.microsoft.com/azureml/${BASE_IMAGE} ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --allow-downgrades --allow-change-held...
ClimaX/docker/Dockerfile/0
{ "file_path": "ClimaX/docker/Dockerfile", "repo_id": "ClimaX", "token_count": 483 }
224
[data-md-color-scheme="climax"] { --md-primary-fg-color: #4C8D91; --md-primary-fg-color--light: #91504c; --md-primary-fg-color--dark: #16292a; }
ClimaX/docs/stylesheets/extra.css/0
{ "file_path": "ClimaX/docs/stylesheets/extra.css", "repo_id": "ClimaX", "token_count": 86 }
225
datadir: /data/CMIP6/CMCC name: u_component_of_wind cmip_name: ua era_name: u run: r1i1p1f1 res: - 1.40625 # - 5.625
ClimaX/snakemake_configs/CMCC/config_u_component_of_wind.yml/0
{ "file_path": "ClimaX/snakemake_configs/CMCC/config_u_component_of_wind.yml", "repo_id": "ClimaX", "token_count": 66 }
226
datadir: /data/CMIP6/MPI-ESM server_prefix: http://esgf-data1.llnl.gov/thredds/fileServer/css03_data/CMIP6/CMIP name: specific_humidity cmip_name: hus era_name: q output_type: 6hrPlevPt run: r1i1p1f1 version: v20190815 res: - 1.40625 # - 5.625
ClimaX/snakemake_configs/MPI-ESM/config_specific_humidity.yml/0
{ "file_path": "ClimaX/snakemake_configs/MPI-ESM/config_specific_humidity.yml", "repo_id": "ClimaX", "token_count": 119 }
227
### Adapted from https://github.com/duncanwp/ClimateBench/blob/main/prep_input_data.ipynb import os import numpy as np import torch import xarray as xr from torch.utils.data import Dataset from torchvision.transforms import transforms def load_x_y(data_path, list_simu, out_var): x_all, y_all = {}, {} for si...
ClimaX/src/climax/climate_projection/dataset.py/0
{ "file_path": "ClimaX/src/climax/climate_projection/dataset.py", "repo_id": "ClimaX", "token_count": 3190 }
228
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. # credits: https://github.com/ashleve/lightning-hydra-template/blob/main/src/models/mnist_module.py from typing import Any import torch from pytorch_lightning import LightningModule from torchvision.transforms import transforms from climax.regi...
ClimaX/src/climax/regional_forecast/module.py/0
{ "file_path": "ClimaX/src/climax/regional_forecast/module.py", "repo_id": "ClimaX", "token_count": 4055 }
229
import os import skimage.util as util from skimage import io from skimage.transform import resize with open('train.txt', 'r') as fd: image_files = fd.readlines() total = len(image_files) cnt = 0 # path/to/deepfashion directory root = '/path/to/deepfashion' # path/to/save directory save_root = 'path/to/save' fo...
CoCosNet-v2/data/preprocess.py/0
{ "file_path": "CoCosNet-v2/data/preprocess.py", "repo_id": "CoCosNet-v2", "token_count": 447 }
230
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch import torch.nn as nn import torch.nn.functional as F import random from models.networks.convgru import BasicUpdateBlock from models.networks.ops import * """patch match""" class Evaluate(nn.Module): def __init__(self, tempe...
CoCosNet-v2/models/networks/patch_match.py/0
{ "file_path": "CoCosNet-v2/models/networks/patch_match.py", "repo_id": "CoCosNet-v2", "token_count": 3978 }
231
""" 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.utils.data as data from PIL import Image import torchvision.transforms as transforms import numpy as np import random class BaseD...
CoCosNet/data/base_dataset.py/0
{ "file_path": "CoCosNet/data/base_dataset.py", "repo_id": "CoCosNet", "token_count": 1932 }
232
""" 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.nn as nn from torch.nn import init class BaseNetwork(nn.Module): def __init__(self): super(BaseNetwork, self).__init_...
CoCosNet/models/networks/base_network.py/0
{ "file_path": "CoCosNet/models/networks/base_network.py", "repo_id": "CoCosNet", "token_count": 1225 }
233
# CodeExecutor This repo provides the code for reproducing the experiments in [Code Execution with Pre-trained Language Models](https://arxiv.org/pdf/2305.05383.pdf). **CodeExecutor** is a pre-trained model that learns to predict the execution traces using a code execution pre-training task and curriculum learning. T...
CodeBERT/CodeExecutor/README.md/0
{ "file_path": "CodeBERT/CodeExecutor/README.md", "repo_id": "CodeBERT", "token_count": 2591 }
234
# -*- coding: utf-8 -*- # Natural Language Toolkit: BLEU Score # # Copyright (C) 2001-2020 NLTK Project # Authors: Chin Yee Lee, Hengfeng Li, Ruxin Hou, Calvin Tanujaya Lim # Contributors: Björn Mattsson, Dmitrijs Milajevs, Liling Tan # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """BLEU score i...
CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/bleu.py/0
{ "file_path": "CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/bleu.py", "repo_id": "CodeBERT", "token_count": 11567 }
235
echo -e "import nltk\nnltk.download('punkt')" > ttmp.py python ttmp.py rm ttmp.py
CodeBERT/CodeReviewer/code/sh/test_nltk.sh/0
{ "file_path": "CodeBERT/CodeReviewer/code/sh/test_nltk.sh", "repo_id": "CodeBERT", "token_count": 36 }
236
# Code Search ## Data Preprocess Different from the setting of [CodeSearchNet](husain2019codesearchnet), the answer of each query is retrieved from the whole development and testing code corpus instead of 1,000 candidate codes. Besides, we observe that some queries contain content unrelated to the code, such as a l...
CodeBERT/GraphCodeBERT/codesearch/README.md/0
{ "file_path": "CodeBERT/GraphCodeBERT/codesearch/README.md", "repo_id": "CodeBERT", "token_count": 1990 }
237
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from tree_sitter import Language, Parser Language.build_library( # Store the library in the `build` directory 'my-languages.so', # Include one or more languages [ 'tree-sitter-go', 'tree-sitter-javascript', 'tree-sitter-pyt...
CodeBERT/GraphCodeBERT/refinement/parser/build.py/0
{ "file_path": "CodeBERT/GraphCodeBERT/refinement/parser/build.py", "repo_id": "CodeBERT", "token_count": 162 }
238
# Clone Detection (BigCloneDetection) ## Data Download ```bash mkdir dataset cd dataset wget https://github.com/microsoft/CodeXGLUE/raw/main/Code-Code/Clone-detection-BigCloneBench/dataset/data.jsonl wget https://github.com/microsoft/CodeXGLUE/raw/main/Code-Code/Clone-detection-BigCloneBench/dataset/test.txt wget htt...
CodeBERT/UniXcoder/downstream-tasks/clone-detection/BCB/README.md/0
{ "file_path": "CodeBERT/UniXcoder/downstream-tasks/clone-detection/BCB/README.md", "repo_id": "CodeBERT", "token_count": 586 }
239
pip install torch==1.6.0+cu92 torchvision==0.7.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html > log.txt 2>&1 pip install sklearn scipy transformers tqdm > log.txt 2>&1 CUDA_VISIBLE_DEVICES=15,12,13,14 lang=java #programming language lr=5e-5 batch_size=32 accm_steps=1 beam_size=3 source_length=512 target_l...
CodeBERT/UniXcoder/downstream-tasks/code-generation/run.sh/0
{ "file_path": "CodeBERT/UniXcoder/downstream-tasks/code-generation/run.sh", "repo_id": "CodeBERT", "token_count": 609 }
240
## CLUTRR ### Download the Code-Davinci-002 Inference Results [Download Link](https://bdmbabel.blob.core.windows.net/public/clutrr.zip) ### Original Dataset The dataset is synthesized from https://github.com/facebookresearch/clutrr, using the following Python script: `python main.py --train_tasks 1.2,1.3 --test_ta...
CodeT/DIVERSE/data/clutrr.md/0
{ "file_path": "CodeT/DIVERSE/data/clutrr.md", "repo_id": "CodeT", "token_count": 149 }
241
import os import time from pathlib import Path from prompt_file import * def get_command_result(input, prompt_file): """ Checks if the input is a command and if so, executes it Currently supported commands: - start multi-turn - stop multi-turn - default context - show context <n> - vie...
Codex-CLI/src/commands.py/0
{ "file_path": "Codex-CLI/src/commands.py", "repo_id": "Codex-CLI", "token_count": 2649 }
242
Contributing to Microsoft Cognitive Services Client Libraries & Samples =============================================== So, you want to contribute on a client library or sample for one of the Microsoft Cognitive Services. Here's what you need to know. 1. Each SDK should include both a client library and a sample show...
Cognitive-Face-Python/CONTRIBUTING.md/0
{ "file_path": "Cognitive-Face-Python/CONTRIBUTING.md", "repo_id": "Cognitive-Face-Python", "token_count": 577 }
243
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: person_group.py Description: Person Group section of the Cognitive Face API. """ from . import util def create(person_group_id, name=None, user_data=None): """Create a new person group with specified `person_group_id`, `name` and user-provided `user_data...
Cognitive-Face-Python/cognitive_face/person_group.py/0
{ "file_path": "Cognitive-Face-Python/cognitive_face/person_group.py", "repo_id": "Cognitive-Face-Python", "token_count": 1523 }
244
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: __init__.py Description: Model components for Python SDK sample. """ from model.face import Face
Cognitive-Face-Python/sample/model/__init__.py/0
{ "file_path": "Cognitive-Face-Python/sample/model/__init__.py", "repo_id": "Cognitive-Face-Python", "token_count": 52 }
245
export CUDA_VISIBLE_DEVICES=2 python t5_run_train.py \ --model_name_or_path t5-base \ --subtask Com \ --method ControlExp \ --train_file finetune \ --max_steps 50000 \ --save_steps 50000 \ --batch_size 8 \ --ebatch_size 16 \ --gas 1 \ --seed 1 \ --set set1
ContextualSP/abstraction_probing/code/t5_code/Com_ControlExp_finetune.sh/0
{ "file_path": "ContextualSP/abstraction_probing/code/t5_code/Com_ControlExp_finetune.sh", "repo_id": "ContextualSP", "token_count": 104 }
246
import torch import torch.utils.checkpoint from torch import nn from torch.nn import CrossEntropyLoss from transformers.models.t5.modeling_t5 import ( T5PreTrainedModel, T5Block, T5LayerNorm, T5Attention, T5LayerCrossAttention, T5LayerFF, ) from transformers.modeling_outputs import ( Seq2Seq...
ContextualSP/abstraction_probing/code/t5_code/t5_model.py/0
{ "file_path": "ContextualSP/abstraction_probing/code/t5_code/t5_model.py", "repo_id": "ContextualSP", "token_count": 24657 }
247
theme: jekyll-theme-minimal
ContextualSP/adaptershare/_config.yml/0
{ "file_path": "ContextualSP/adaptershare/_config.yml", "repo_id": "ContextualSP", "token_count": 10 }
248
# coding=utf-8 # Copyright 2020 The HuggingFace Team All rights reserved. # Copyright 2021 Microsoft 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.apac...
ContextualSP/adaptershare/data_utils/utils_qa.py/0
{ "file_path": "ContextualSP/adaptershare/data_utils/utils_qa.py", "repo_id": "ContextualSP", "token_count": 5608 }
249
# Copyright (c) Microsoft. All rights reserved. from random import shuffle from data_utils.metrics import calc_metrics def load_scitail(file): """Loading data of scitail""" rows = [] cnt = 0 with open(file, encoding="utf8") as f: for line in f: blocks = line.strip().split("\t") ...
ContextualSP/adaptershare/experiments/glue/glue_utils.py/0
{ "file_path": "ContextualSP/adaptershare/experiments/glue/glue_utils.py", "repo_id": "ContextualSP", "token_count": 6831 }
250
## Quickstart ### Example of XNLI based on XLM-R 1. Download XNLI data </br> 2. Prepro </br> > python experiments\xnli\xnli_prepro.py </br> > python prepro_std.py --model xlm-roberta-base --task_def experiments\xnli\xnli_task_def.yml --rood_dir [XNLI-DIR] 3. Train > python train.py --data_dir data\canonical_...
ContextualSP/adaptershare/experiments/xnli/README.md/0
{ "file_path": "ContextualSP/adaptershare/experiments/xnli/README.md", "repo_id": "ContextualSP", "token_count": 198 }
251
cola: # PremiseOnly + Classification data_format: PremiseOnly dropout_p: 0.05 enable_san: false metric_meta: - ACC - MCC loss: CeCriterion kd_loss: MseCriterion n_class: 2 split_names: - train task_type: Classification mnli: # PremiseAndOneHypothesis + Classification data_format: PremiseAn...
ContextualSP/adaptershare/int_test_data/glue/input/prepro_std/glue_task_def.yml/0
{ "file_path": "ContextualSP/adaptershare/int_test_data/glue/input/prepro_std/glue_task_def.yml", "repo_id": "ContextualSP", "token_count": 305 }
252
# coding=utf-8 # Copyright (c) Microsoft. All rights reserved. import torch from torch.nn.modules.loss import _Loss import torch.nn.functional as F import torch.nn as nn from enum import IntEnum def stable_kl(logit, target, epsilon=1e-6, reduce=True): logit = logit.view(-1, logit.size(-1)).float() target = t...
ContextualSP/adaptershare/mt_dnn/loss.py/0
{ "file_path": "ContextualSP/adaptershare/mt_dnn/loss.py", "repo_id": "ContextualSP", "token_count": 5654 }
253
import torch import torch.nn as nn from torch.optim import Optimizer, Adam class WarmupPolynomialLRScheduler: optimizer: Optimizer num_warmup_steps: int start_lr: float end_lr: float decay_steps: int power: float def __init__(self, optimizer: Optimizer, start_lr: float, num_warmup_step...
ContextualSP/awakening_latent_grounding/models/optmizers.py/0
{ "file_path": "ContextualSP/awakening_latent_grounding/models/optmizers.py", "repo_id": "ContextualSP", "token_count": 1305 }
254
from enum import Enum import re import json from collections import defaultdict from typing import List, Dict, Tuple from dataclasses import dataclass, field from transformers import BertTokenizer """ Constant values """ SOS_Token = '<sos>' EOS_Token = '<eos>' UNK_Token = '<unk>' TBL_Token = '<tbl>' VAL_Token = '<val>...
ContextualSP/awakening_latent_grounding/utils/data_types.py/0
{ "file_path": "ContextualSP/awakening_latent_grounding/utils/data_types.py", "repo_id": "ContextualSP", "token_count": 10629 }
255
import pdb import random import statistics from itertools import chain import math import torch.nn.functional as F from torch import nn from masked_cross_entropy import * from utils import Categorical from modules.BinaryTreeBasedModule import BinaryTreeBasedModule from utils import clamp_grad import torch USE_CUDA = ...
ContextualSP/compositional_generalization/model.py/0
{ "file_path": "ContextualSP/compositional_generalization/model.py", "repo_id": "ContextualSP", "token_count": 33973 }
256
#!/usr/bin/env bash export model_file=../checkpoints/run_rewrite export config_file=../configs/rewrite.jsonnet export train_data_path=../dataset/Rewrite/train.txt export validation_data_path=../dataset/Rewrite/dev.txt export seed=2 allennlp train -s ${model_file} ${config_file} \ --include-package data_reader \ --inclu...
ContextualSP/incomplete_utterance_rewriting/src/train_rewrite.sh/0
{ "file_path": "ContextualSP/incomplete_utterance_rewriting/src/train_rewrite.sh", "repo_id": "ContextualSP", "token_count": 186 }
257
import re from collections import Set, defaultdict from typing import Dict, Tuple, List from allennlp.data import Tokenizer, Token from ordered_set import OrderedSet from unidecode import unidecode from .utils import TableColumn, read_dataset_schema, read_dataset_values from allennlp.semparse.contexts.knowledge_graph...
ContextualSP/interactive_text_to_sql/src/context/db_context.py/0
{ "file_path": "ContextualSP/interactive_text_to_sql/src/context/db_context.py", "repo_id": "ContextualSP", "token_count": 6280 }
258
# coding: utf-8 question_template = "What do you mean by the word {0}? " \ "Is that an attribute name, an attribute value or others?" \ "Select a proper answer is you think we're have a misunderstanding of it."
ContextualSP/interactive_text_to_sql/src/utils/templates.py/0
{ "file_path": "ContextualSP/interactive_text_to_sql/src/utils/templates.py", "repo_id": "ContextualSP", "token_count": 98 }
259
import git def commit_diff(c): """Return the set of changed files. Args: c (git.Commit) Returns: set[str]: a set of file paths (relative to the git repo's root directory). """ changed = set() def add_path(blob): if blob is not None: changed.add(blob.path) ...
ContextualSP/lemon/executor/gtd/git_utils.py/0
{ "file_path": "ContextualSP/lemon/executor/gtd/git_utils.py", "repo_id": "ContextualSP", "token_count": 211 }
260
# Copyright (C) 2006, 2008, 2009, 2010 by Canonical Ltd # Written by John Arbash Meinel <john@arbash-meinel.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License...
ContextualSP/lemon/executor/gtd/profile_imports.py/0
{ "file_path": "ContextualSP/lemon/executor/gtd/profile_imports.py", "repo_id": "ContextualSP", "token_count": 2583 }
261
from abc import ABCMeta, abstractmethod class PredicatesComputer(object, metaclass=ABCMeta): """Compute the set of possible LF predicates for a context, along with their alignments to the utterance tokens. The resulting predicates are used as `choices` in ParseCase. The alignments are used for soft c...
ContextualSP/lemon/executor/strongsup/predicates_computer.py/0
{ "file_path": "ContextualSP/lemon/executor/strongsup/predicates_computer.py", "repo_id": "ContextualSP", "token_count": 256 }
262
from abc import ABCMeta, abstractmethod class RLongState(object, metaclass=ABCMeta): """Represents a row of objects, each of which has various properties. Used in: - RLongWorld as the initial state - RLongDenotation as the current state during execution - RLongValue as the final state """ ...
ContextualSP/lemon/executor/strongsup/rlong/state.py/0
{ "file_path": "ContextualSP/lemon/executor/strongsup/rlong/state.py", "repo_id": "ContextualSP", "token_count": 10345 }
263
import numpy as np from strongsup.predicate import Predicate def softmax(stuff): """Quick and dirty way to compute softmax""" return (np.exp(stuff) / np.sum(np.exp(stuff))).tolist() class PredicateGenerator(object): """Generate predicates with the specified context.""" def __init__(self, context): ...
ContextualSP/lemon/executor/strongsup/tests/utils.py/0
{ "file_path": "ContextualSP/lemon/executor/strongsup/tests/utils.py", "repo_id": "ContextualSP", "token_count": 202 }
264
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, ...
ContextualSP/lemon/propara_evaluator/aristo-leaderboard/LICENSE/0
{ "file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/LICENSE", "repo_id": "ContextualSP", "token_count": 3168 }
265
name: grc channels: - defaults dependencies: - pip=20.2.2=py37_0 - python=3.7.5=h0371630_0 - pip: - numpy==1.19.2 - overrides==3.1.0 - scikit-learn==0.23.2 - scipy==1.5.2
ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/environment.yml/0
{ "file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/environment.yml", "repo_id": "ContextualSP", "token_count": 111 }
266
from process.process import Process, Conversion, Move, Input, Output from process.summary import ProcessSummary from process.action_file import ActionFile from process.sentence_file import sentences_from_sentences_file
ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/process/__init__.py/0
{ "file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/process/__init__.py", "repo_id": "ContextualSP", "token_count": 50 }
267
## SciTail Evaluator This script evaluates predictions on the SciTail dataset and produces an accuracy score. ## Example ```bash % python3 evaluator.py -a answers.jsonl -p predictions.csv -o metrics.json % cat metrics.json {"accuracy": 0.8} ``` ## Usage The script takes two input files and produces one output fil...
ContextualSP/lemon/propara_evaluator/aristo-leaderboard/scitail/evaluator/README.md/0
{ "file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/scitail/evaluator/README.md", "repo_id": "ContextualSP", "token_count": 413 }
268
from transformers import Seq2SeqTrainer from typing import Dict, List, Optional import torch import numpy as np import logging from torch.utils.data import Dataset from typing import Any, Dict, List, Optional, Tuple, Union,NamedTuple from transformers import Seq2SeqTrainer, is_torch_tpu_available from transformers.trai...
ContextualSP/logigan/pre-training/GenTrainer.py/0
{ "file_path": "ContextualSP/logigan/pre-training/GenTrainer.py", "repo_id": "ContextualSP", "token_count": 8488 }
269
from z3 import * import random from random import shuffle from itertools import combinations, product from typing import List, Tuple from functools import partial from tqdm import tqdm import os solver = Solver() vars_all_candidates = [chr(i) for i in list(range(97, 122))] for symbol in vars_all_candidates: # ini...
ContextualSP/poet/synthesize_logic_corpus.py/0
{ "file_path": "ContextualSP/poet/synthesize_logic_corpus.py", "repo_id": "ContextualSP", "token_count": 2798 }
270
import random import torch from torch import nn from torch.nn.functional import softmax from utils import Trie, Tree MAX_LEN = 256 class Parser(nn.Module): def __init__(self, src_dictionary, trg_dictionary, model, device): super().__init__() self.src_dictionary = src_dictionary self.trg_d...
ContextualSP/poset_decoding/sketch_prediction/model.py/0
{ "file_path": "ContextualSP/poset_decoding/sketch_prediction/model.py", "repo_id": "ContextualSP", "token_count": 3243 }
271
## Build Documentation: #### Install Requirements ```python pip install -r requirements.txt ``` #### Build Documentation ```bash # Enter docs folder. cd docs # Use sphinx autodoc to generate rst. sphinx-apidoc -o source/ ../matchzoo/ # Generate html from rst make clean make html ``` This will install all the pa...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/docs/Readme.md/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/docs/Readme.md", "repo_id": "ContextualSP", "token_count": 261 }
272
from .data_pack import DataPack, load_data_pack from .pack import pack
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/data_pack/__init__.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/data_pack/__init__.py", "repo_id": "ContextualSP", "token_count": 21 }
273
from pathlib import Path from .load_glove_embedding import load_glove_embedding from .load_fasttext_embedding import load_fasttext_embedding DATA_ROOT = Path(__file__).parent EMBED_RANK = DATA_ROOT.joinpath('embed_rank.txt') EMBED_10 = DATA_ROOT.joinpath('embed_10_word2vec.txt') EMBED_10_GLOVE = DATA_ROOT.joinpath('em...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/embeddings/__init__.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/embeddings/__init__.py", "repo_id": "ContextualSP", "token_count": 131 }
274
"""The rank hinge loss.""" import torch from torch import nn import torch.nn.functional as F class RankHingeLoss(nn.Module): """ Creates a criterion that measures rank hinge loss. Given inputs :math:`x1`, :math:`x2`, two 1D mini-batch `Tensors`, and a label 1D mini-batch tensor :math:`y` (containing ...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/losses/rank_hinge_loss.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/losses/rank_hinge_loss.py", "repo_id": "ContextualSP", "token_count": 1214 }
275
"""An implementation of BiMPM Model.""" import typing import torch import torch.nn as nn from torch.nn import functional as F from matchzoo.engine import hyper_spaces from matchzoo.engine.param_table import ParamTable from matchzoo.engine.param import Param from matchzoo.engine.base_model import BaseModel class BiM...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/bimpm.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/bimpm.py", "repo_id": "ContextualSP", "token_count": 7150 }
276
"""An implementation of MVLSTM 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.base_callback import BaseCallback f...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/mvlstm.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/mvlstm.py", "repo_id": "ContextualSP", "token_count": 2721 }
277
"""Basic Preprocessor.""" from tqdm import tqdm import typing from . import units from matchzoo import DataPack from matchzoo.engine.base_preprocessor import BasePreprocessor from .build_vocab_unit import build_vocab_unit from .build_unit_from_data_pack import build_unit_from_data_pack from .chain_transform import ch...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/basic_preprocessor.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/basic_preprocessor.py", "repo_id": "ContextualSP", "token_count": 3360 }
278
import nltk from .unit import Unit class Stemming(Unit): """ Process unit for token stemming. :param stemmer: stemmer to use, `porter` or `lancaster`. """ def __init__(self, stemmer='porter'): """Initialization.""" self.stemmer = stemmer def transform(self, input_: list) ->...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/stemming.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/stemming.py", "repo_id": "ContextualSP", "token_count": 441 }
279
"""Download file.""" import typing from pathlib import Path import os import hashlib import shutil import sys import tarfile import time import zipfile import collections import six from six.moves.urllib.error import HTTPError from six.moves.urllib.error import URLError from six.moves.urllib.request import urlretrieve...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/get_file.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/utils/get_file.py", "repo_id": "ContextualSP", "token_count": 5793 }
280
import pytest import hyperopt.pyll.base from matchzoo.engine import hyper_spaces @pytest.fixture(scope='module', params=[ lambda x: x + 2, lambda x: x - 2, lambda x: x * 2, lambda x: x / 2, lambda x: x // 2, lambda x: x ** 2, lambda x: 2 + x, lambda x: 2 - x, lambda x: 2 * x, ...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/engine/test_hyper_spaces.py/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/engine/test_hyper_spaces.py", "repo_id": "ContextualSP", "token_count": 386 }
281
<jupyter_start><jupyter_code>%run init.ipynb ranking_task = mz.tasks.Ranking(losses=mz.losses.RankCrossEntropyLoss(num_neg=1)) ranking_task.metrics = [ mz.metrics.NormalizedDiscountedCumulativeGain(k=3), mz.metrics.NormalizedDiscountedCumulativeGain(k=5), mz.metrics.MeanAveragePrecision() ] preprocessor = m...
ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/anmm.ipynb/0
{ "file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/anmm.ipynb", "repo_id": "ContextualSP", "token_count": 814 }
282
Coming soon.
ContextualSP/qaap/README.md/0
{ "file_path": "ContextualSP/qaap/README.md", "repo_id": "ContextualSP", "token_count": 3 }
283
set model_file=checkpoints_sparc/sparc_concat_none_model set validation_file=dataset_sparc/dev.json set validation_out_file=dataset_sparc/dev.jsonl set prediction_out_file=predict.jsonl python postprocess.py --valid_file %validation_file% --valid_out_file %validation_out_file% allennlp predict ^ --include-package datas...
ContextualSP/semantic_parsing_in_context/bash_files/windows/predict.bat/0
{ "file_path": "ContextualSP/semantic_parsing_in_context/bash_files/windows/predict.bat", "repo_id": "ContextualSP", "token_count": 225 }
284
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Dict from typing import List from typing import Tuple import editdistance import numpy as np from allennlp.common.checks import ConfigurationError from allennlp.data import TokenIndexer, Tokenizer from allennlp.data.fields.kno...
ContextualSP/semantic_parsing_in_context/dataset_reader/util.py/0
{ "file_path": "ContextualSP/semantic_parsing_in_context/dataset_reader/util.py", "repo_id": "ContextualSP", "token_count": 4858 }
285
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch from typing import Tuple def get_span_representation(forward_encoder_out, backward_encoder_out, span_start, span_end): """ Given a span start/end position, fetch the subtraction representation of the span from LSTM. ""...
ContextualSP/semantic_parsing_in_context/models/util.py/0
{ "file_path": "ContextualSP/semantic_parsing_in_context/models/util.py", "repo_id": "ContextualSP", "token_count": 751 }
286
{ "random_seed": 42, "numpy_seed": 42, "pytorch_seed": 42, "dataset_reader": { "type": "sparc", "lazy": false, "loading_limit": -1, "context_mode": "turn", "bert_mode": "v3", "utterance_token_indexers": { "bert": { "type": "bert-pretrained", "pretrained_model": "bert-base-uncased", "do_lo...
ContextualSP/semantic_parsing_in_context/train_configs_bert/turn.none.jsonnet/0
{ "file_path": "ContextualSP/semantic_parsing_in_context/train_configs_bert/turn.none.jsonnet", "repo_id": "ContextualSP", "token_count": 1110 }
287
#!/bin/bash #requirement: #./data/spider #./BART-large # data/spider -> data/spider_schema_linking_tag python step1_schema_linking.py --dataset=spider # data/spider_schema_linking_tag -> dataset_post/spider_sl python step2_serialization.py ###training python train.py \ --dataset_path ./dataset_post/spider_sl/bin/...
ContextualSP/unified_parser_text_to_sql/running_pipeline.sh/0
{ "file_path": "ContextualSP/unified_parser_text_to_sql/running_pipeline.sh", "repo_id": "ContextualSP", "token_count": 202 }
288
## Data Preprocess #### Get Parsed SQL Output The SQL parsing script is `process_sql.py` in the main directory. Please refer to `parsed_sql_examples.sql` for the explanation of some parsed SQL output examples. If you would like to use `process_sql.py` to parse SQL queries by yourself, `parse_sql_one.py` provides an ...
ContextualSP/unified_parser_text_to_sql/third_party/spider/preprocess/README.md/0
{ "file_path": "ContextualSP/unified_parser_text_to_sql/third_party/spider/preprocess/README.md", "repo_id": "ContextualSP", "token_count": 238 }
289
import math import sys from typing import Iterable, Optional from timm.utils.model import unwrap_model import torch from timm.data import Mixup from timm.utils import accuracy, ModelEma from lib import utils import random import time def sample_configs(choices): config = {} dimensions = ['mlp_ratio', 'num_he...
Cream/AutoFormer/supernet_engine.py/0
{ "file_path": "Cream/AutoFormer/supernet_engine.py", "repo_id": "Cream", "token_count": 2771 }
290
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os.path as osp import sys def add_path(path): if path not in sys.path: sys.path.insert(0, path) this_dir = osp.dirname(__file__) lib_path = osp.join(this_dir, '..', 'lib') add_path(lib_pa...
Cream/CDARTS/CDARTS/_init_paths.py/0
{ "file_path": "Cream/CDARTS/CDARTS/_init_paths.py", "repo_id": "Cream", "token_count": 148 }
291
import numpy as np def quantize(arr, min_val, max_val, levels, dtype=np.int64): """Quantize an array of (-inf, inf) to [0, levels-1]. Args: arr (ndarray): Input array. min_val (scalar): Minimum value to be clipped. max_val (scalar): Maximum value to be clipped. levels (int): Q...
Cream/CDARTS/CDARTS_detection/mmcv/arraymisc/quantization.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmcv/arraymisc/quantization.py", "repo_id": "Cream", "token_count": 815 }
292
from .colorspace import (bgr2gray, gray2bgr, bgr2rgb, rgb2bgr, bgr2hsv, hsv2bgr, bgr2hls, hls2bgr, iminvert) from .geometry import imflip, imrotate, imcrop, impad, impad_to_multiple from .normalize import imnormalize, imdenormalize from .resize import imresize, imresize_like, imrescale __all__...
Cream/CDARTS/CDARTS_detection/mmcv/image/transforms/__init__.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmcv/image/transforms/__init__.py", "repo_id": "Cream", "token_count": 279 }
293
from .hook import Hook from .checkpoint import CheckpointHook from .closure import ClosureHook from .lr_updater import LrUpdaterHook from .optimizer import OptimizerHook, OptimizerArchHook from .iter_timer import IterTimerHook from .sampler_seed import DistSamplerSeedHook from .memory import EmptyCacheHook from .logger...
Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/__init__.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/__init__.py", "repo_id": "Cream", "token_count": 257 }
294
from enum import Enum class Priority(Enum): """Hook priority levels. +------------+------------+ | Level | Value | +============+============+ | HIGHEST | 0 | +------------+------------+ | VERY_HIGH | 10 | +------------+------------+ | HIGH | 3...
Cream/CDARTS/CDARTS_detection/mmcv/runner/priority.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/priority.py", "repo_id": "Cream", "token_count": 562 }
295
/* Generated by Cython 0.27.3 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython ...
Cream/CDARTS/CDARTS_detection/mmcv/video/optflow_warp/flow_warp_module.cpp/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmcv/video/optflow_warp/flow_warp_module.cpp", "repo_id": "Cream", "token_count": 166554 }
296
import warnings import matplotlib.pyplot as plt import mmcv import numpy as np import pycocotools.mask as maskUtils import torch from mmcv.parallel import collate, scatter from mmcv.runner import load_checkpoint from mmdet.core import get_classes from mmdet.datasets.pipelines import Compose from mmdet.models import b...
Cream/CDARTS/CDARTS_detection/mmdet/apis/inference.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/apis/inference.py", "repo_id": "Cream", "token_count": 2561 }
297
from .base_sampler import BaseSampler from .pseudo_sampler import PseudoSampler from .random_sampler import RandomSampler from .instance_balanced_pos_sampler import InstanceBalancedPosSampler from .iou_balanced_neg_sampler import IoUBalancedNegSampler from .combined_sampler import CombinedSampler from .ohem_sampler imp...
Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/samplers/__init__.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/samplers/__init__.py", "repo_id": "Cream", "token_count": 183 }
298
from collections.abc import Sequence import numpy as np from terminaltables import AsciiTable from mmdet.utils import print_log from .bbox_overlaps import bbox_overlaps def _recalls(all_ious, proposal_nums, thrs): img_num = all_ious.shape[0] total_gt_num = sum([ious.shape[0] for ious in all_ious]) _io...
Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/recall.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/recall.py", "repo_id": "Cream", "token_count": 3195 }
299
from .coco import CocoDataset from .registry import DATASETS @DATASETS.register_module class CityscapesDataset(CocoDataset): CLASSES = ('person', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', 'bicycle')
Cream/CDARTS/CDARTS_detection/mmdet/datasets/cityscapes.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/cityscapes.py", "repo_id": "Cream", "token_count": 96 }
300
from mmdet.core import eval_map, eval_recalls from .registry import DATASETS from .xml_style import XMLDataset @DATASETS.register_module class VOCDataset(XMLDataset): CLASSES = ('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', ...
Cream/CDARTS/CDARTS_detection/mmdet/datasets/voc.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/voc.py", "repo_id": "Cream", "token_count": 1422 }
301
import numpy as np import torch import torch.nn.functional as F from torch import nn class DropBlock2D(nn.Module): r"""Randomly zeroes 2D spatial blocks of the input tensor. As described in the paper `DropBlock: A regularization method for convolutional networks`_ , dropping whole blocks of feature ma...
Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/dropblock.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/dropblock.py", "repo_id": "Cream", "token_count": 2265 }
302
import torch import torch.nn.functional as F from .cascade_rcnn import CascadeRCNN from .. import builder from ..registry import DETECTORS from mmdet.core import (bbox2roi, bbox2result, build_assigner, build_sampler, merge_aug_masks) @DETECTORS.register_module class HybridTaskCascade(CascadeR...
Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/htc.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/htc.py", "repo_id": "Cream", "token_count": 10086 }
303
import torch import torch.nn as nn from .utils import weighted_loss from ..registry import LOSSES @weighted_loss def smooth_l1_loss(pred, target, beta=1.0): assert beta > 0 assert pred.size() == target.size() and target.numel() > 0 diff = torch.abs(pred - target) loss = torch.where(diff < beta, 0.5 *...
Cream/CDARTS/CDARTS_detection/mmdet/models/losses/smooth_l1_loss.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/losses/smooth_l1_loss.py", "repo_id": "Cream", "token_count": 625 }
304
import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.checkpoint import checkpoint from mmcv.cnn.weight_init import caffe2_xavier_init from ..utils import ConvModule from ..registry import NECKS @NECKS.register_module class HRFPN(nn.Module): """HRFPN (High Resolution Feature Pyrmami...
Cream/CDARTS/CDARTS_detection/mmdet/models/necks/hrfpn.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/necks/hrfpn.py", "repo_id": "Cream", "token_count": 1639 }
305
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, scale=1.0): super(Scale, self).__init__() self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float)) def forward(self, x): return x * self.scale
Cream/CDARTS/CDARTS_detection/mmdet/models/utils/scale.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/utils/scale.py", "repo_id": "Cream", "token_count": 113 }
306