text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
import { DefaultPalette, IStackItemStyles, Stack } from "@fluentui/react";
import { OperationStep } from "../../models/operation";
interface ResourceOperationStepsListProps {
header: String,
val?: OperationStep[]
}
export const ResourceOperationStepsList: React.FunctionComponent<ResourceOperationStepsListProps> =... | AzureTRE/ui/app/src/components/shared/ResourceOperationStepsList.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/ResourceOperationStepsList.tsx",
"repo_id": "AzureTRE",
"token_count": 504
} | 139 |
import { DefaultButton, MessageBar, MessageBarType, Spinner, SpinnerSize, Stack } from "@fluentui/react";
import { useEffect, useState } from "react";
import { LoadingState } from "../../../models/loadingState";
import { HttpMethod, useAuthApiCall } from "../../../hooks/useAuthApiCall";
import { APIError } from "../../... | AzureTRE/ui/app/src/components/shared/create-update-resource/SelectTemplate.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/create-update-resource/SelectTemplate.tsx",
"repo_id": "AzureTRE",
"token_count": 1404
} | 140 |
import React from "react";
export const AppRolesContext = React.createContext({
roles: [] as Array<string>,
setAppRoles: (roles: Array<string>) => { }
});
| AzureTRE/ui/app/src/contexts/AppRolesContext.ts/0 | {
"file_path": "AzureTRE/ui/app/src/contexts/AppRolesContext.ts",
"repo_id": "AzureTRE",
"token_count": 51
} | 141 |
import { Resource } from "./resource";
import { Workspace } from "./workspace";
import { WorkspaceService } from "./workspaceService";
export enum ResourceType {
Workspace = "workspace",
WorkspaceService = "workspace-service",
UserResource = "user-resource",
SharedService = "shared-service"
}
export i... | AzureTRE/ui/app/src/models/resourceType.ts/0 | {
"file_path": "AzureTRE/ui/app/src/models/resourceType.ts",
"repo_id": "AzureTRE",
"token_count": 152
} | 142 |
<!-- BioC.dtd -->
<!--
BioC is designed to allow programs that process text and
annotations on that text to easily share data and work
together. This DTD describes how that data is represented in XML
files.
Some believe XML is easily read by humans and that should be
supported by clearly form... | BioGPT/data/BC5CDR/raw/BC5CDR_Evaluation-0.0.3/BioC.dtd/0 | {
"file_path": "BioGPT/data/BC5CDR/raw/BC5CDR_Evaluation-0.0.3/BioC.dtd",
"repo_id": "BioGPT",
"token_count": 1830
} | 143 |
{
"chemical2id": {
"famotidine": "D015738",
"indomethacin": "D007213",
"sodium": "D012964",
"idm": "D007213",
"prostaglandin": "D011453",
"angiotensin": "D000809",
"tacrolimus": "D016559",
"prednisolone": "D011239",
"corticosteroid": "D000305",... | BioGPT/data/BC5CDR/raw/test.entities.json/0 | {
"file_path": "BioGPT/data/BC5CDR/raw/test.entities.json",
"repo_id": "BioGPT",
"token_count": 47007
} | 144 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
MODEL_DIR=../../checkpoints/QA-PubMedQA-BioGPT
MODEL=checkpoint.pt
DATA_DIR=${PWD}/../../data/PubMedQA/pqal_qcl_ansis-bin
BASE_DATA_DIR=${DATA_DIR%/*}
BIN_DATA_DIR=${DATA_DIR##*/}
DATA_PREFIX=${BIN_DATA_DIR%-*}
RAW_DATA_DIR=${BASE_DATA_DIR}/raw
O... | BioGPT/examples/QA-PubMedQA/infer.sh/0 | {
"file_path": "BioGPT/examples/QA-PubMedQA/infer.sh",
"repo_id": "BioGPT",
"token_count": 466
} | 145 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import bitblas
from bitblas.base.roller.policy import TensorCorePolicy, DefaultPolicy
from bitblas.base.roller.arch import CUDA
from bitblas.gpu.matmul_analysis import get_tensorized_func_and_tags
from bitblas.gpu import Matmul
from bitblas.utils ... | BitBLAS/benchmark/dsl/matmul_dequantize_af.py/0 | {
"file_path": "BitBLAS/benchmark/dsl/matmul_dequantize_af.py",
"repo_id": "BitBLAS",
"token_count": 4474
} | 146 |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <cuda_runtime.h>
#include <assert.h>
#include "ladder_kernel.h"
#include "mma.h"
// nvcc ladder_kernel.cu -gencode arch=compute_80,code=sm_80
__global__ void __launch_bounds__(128) bitblas_kernel_fp16_int2_fp16_m1n15360k5120_nt(half* ... | BitBLAS/integration/bitdistiller/kenrel_output/ladder_kernel.cu/0 | {
"file_path": "BitBLAS/integration/bitdistiller/kenrel_output/ladder_kernel.cu",
"repo_id": "BitBLAS",
"token_count": 12003
} | 147 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import bitblas
import pytest
import time
import numpy as np
from bitblas_quant_linear import QuantLinear
import torch
import torch.nn as nn
# !pip install auto-gptq
from auto_gptq.nn_modules.qlinear.qlinear_cuda_old import (
QuantLinear as C... | BitBLAS/integration/pytorch/test_bitblas_quant_linear.py/0 | {
"file_path": "BitBLAS/integration/pytorch/test_bitblas_quant_linear.py",
"repo_id": "BitBLAS",
"token_count": 2310
} | 148 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import List
class TileDevice:
"""
Represents the architecture of a computing device, capturing various hardware specifications.
"""
def __init__(self) -> None:
self.reg_cap: int = 0 # Register capacity: The... | BitBLAS/python/bitblas/base/roller/arch/arch_base.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/roller/arch/arch_base.py",
"repo_id": "BitBLAS",
"token_count": 639
} | 149 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import tvm
import os
from tvm.contrib.popen_pool import PopenPoolExecutor, StatusKind
from concurrent.futures import ThreadPoolExecutor, as_completed
import numpy as np
from typing import List, Tuple, Optional, Dict, Union, Literal
from tvm impor... | BitBLAS/python/bitblas/base/utils.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/utils.py",
"repo_id": "BitBLAS",
"token_count": 8587
} | 150 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# pylint: disable=missing-docstring, invalid-name
"""A GEMM schedule rule for GPU operators."""
from typing import Optional, List
from contextlib import suppress
from tvm import tir, DataType
from ..base.roller.hint import Hint, IntrinInfo
from... | BitBLAS/python/bitblas/gpu/matmul_mma_dequantize.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/matmul_mma_dequantize.py",
"repo_id": "BitBLAS",
"token_count": 35225
} | 151 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from tvm.target import Target
from typing import Literal, Union
from .operator import Operator
from .impl.ladder_permutate_impl import select_implementation
from dataclasses import dataclass
@dataclass(frozen=True)
class LadderPermutateConfig:
... | BitBLAS/python/bitblas/ops/ladder_permutate.py/0 | {
"file_path": "BitBLAS/python/bitblas/ops/ladder_permutate.py",
"repo_id": "BitBLAS",
"token_count": 1211
} | 152 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import subprocess
from thefuzz import process
from tvm.target import Target
from tvm.target.tag import list_tags
import logging
logger = logging.getLogger(__name__)
def get_gpu_model_from_nvidia_smi():
"""
Executes the 'nvidia-smi' com... | BitBLAS/python/bitblas/utils/target_detector.py/0 | {
"file_path": "BitBLAS/python/bitblas/utils/target_detector.py",
"repo_id": "BitBLAS",
"token_count": 820
} | 153 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import bitblas
from bitblas import Linear as BitBLASLinear
import torch
import time
import numpy as np
import torch.nn as nn
import pytest
torch.manual_seed(0)
@pytest.mark.parametrize(
"m, in_features, out_features, bias",
[
(1... | BitBLAS/testing/python/module/test_bitblas_linear.py/0 | {
"file_path": "BitBLAS/testing/python/module/test_bitblas_linear.py",
"repo_id": "BitBLAS",
"token_count": 3327
} | 154 |
date ; hostname ; pwd
export MASTER_ADDR=$HOSTNAME
export MASTER_PORT=19800
export NODE_RANK=0
EXP_LF=True
EXP_RB=288
EXP_LR_ARRAY=(1e-5 2e-5 1e-5 2e-5)
EXP_GN_ARRAY=(cifar10 cifar10 cifar100 cifar100)
for i in {0..3}
do
EXP_LR=${EXP_LR_ARRAY[$i]}
EXP_GN=${EXP_GN_ARRAY[$i]}
echo $MASTER_ADDR, $MASTER_P... | BridgeTower/scripts/ftfpt_cifar_meter.sh/0 | {
"file_path": "BridgeTower/scripts/ftfpt_cifar_meter.sh",
"repo_id": "BridgeTower",
"token_count": 458
} | 155 |
import functools
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, DistributedSampler
from torch.utils.data.dataset import ConcatDataset
from . import _datamodules
class MTDataModule(LightningDataModule):
def __init__(self, _config):
datamodule_keys =... | BridgeTower/src/datamodules/multitask_datamodule.py/0 | {
"file_path": "BridgeTower/src/datamodules/multitask_datamodule.py",
"repo_id": "BridgeTower",
"token_count": 1416
} | 156 |
# from https://github.com/salesforce/BLIP/blob/main/transform/randaugment.py
import cv2
import numpy as np
## aug functions
def identity_func(img):
return img
def autocontrast_func(img, cutoff=0):
'''
same output as PIL.ImageOps.autocontrast
'''
n_bins = 256
def tune_channel(ch):
... | BridgeTower/src/transforms/randaugment.py/0 | {
"file_path": "BridgeTower/src/transforms/randaugment.py",
"repo_id": "BridgeTower",
"token_count": 4710
} | 157 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import importlib
import torch.utils.data
from data.base_dataset import BaseDataset
from data.face_dataset import FaceTestDataset
def create_dataloader(opt):
instance = FaceTestDataset()
instance.initialize(opt)
print("dataset [%s] ... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/data/__init__.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/data/__init__.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 241
} | 158 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from .base_options import BaseOptions
class TestOptions(BaseOptions):
def initialize(self, parser):
BaseOptions.initialize(self, parser)
parser.add_argument("--results_dir", type=str, default="./results/", help="saves result... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/options/test_options.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/options/test_options.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 397
} | 159 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os.path
import io
import zipfile
from data.base_dataset import BaseDataset, get_params, get_transform, normalize
from data.image_folder import make_dataset
from PIL import Image
import torchvision.transforms as transforms
import numpy as n... | Bringing-Old-Photos-Back-to-Life/Global/data/online_dataset_for_old_photos.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/data/online_dataset_for_old_photos.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 7642
} | 160 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from .base_options import BaseOptions
class TestOptions(BaseOptions):
def initialize(self):
BaseOptions.initialize(self)
self.parser.add_argument("--ntest", type=int, default=float("inf"), help="# of test examples.")
... | Bringing-Old-Photos-Back-to-Life/Global/options/test_options.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/options/test_options.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 1939
} | 161 |
"""
This is an example using CLAP for zero-shot inference.
"""
from msclap import CLAP
import torch.nn.functional as F
# Define classes for zero-shot
# Should be in lower case and can be more than one word
classes = ['coughing','sneezing','drinking sipping', 'breathing', 'brushing teeth']
ground_truth = ['coughing']
#... | CLAP/examples/zero_shot_predictions.py/0 | {
"file_path": "CLAP/examples/zero_shot_predictions.py",
"repo_id": "CLAP",
"token_count": 505
} | 162 |
# COCO-LM (Fairseq)
This directory contains the Fairseq version of scripts for fine-tuning COCO-LM pretrained models on GLUE and SQuAD benchmarks. The scripts are based on the [Fairseq Library](https://github.com/pytorch/fairseq).
Paper: [COCO-LM: Correcting and Contrasting Text Sequences for Language Model Pretraini... | COCO-LM/fairseq/README.md/0 | {
"file_path": "COCO-LM/fairseq/README.md",
"repo_id": "COCO-LM",
"token_count": 2277
} | 163 |
Modules
=======
Fairseq provides several stand-alone :class:`torch.nn.Module` classes that may
be helpful when implementing a new :class:`~fairseq.models.BaseFairseqModel`.
.. automodule:: fairseq.modules
:members:
:undoc-members:
| COCO-LM/fairseq/docs/modules.rst/0 | {
"file_path": "COCO-LM/fairseq/docs/modules.rst",
"repo_id": "COCO-LM",
"token_count": 79
} | 164 |
# Understanding Back-Translation at Scale (Edunov et al., 2018)
This page includes pre-trained models from the paper [Understanding Back-Translation at Scale (Edunov et al., 2018)](https://arxiv.org/abs/1808.09381).
## Pre-trained models
Model | Description | Dataset | Download
---|---|---|---
`transformer.wmt18.en-... | COCO-LM/fairseq/examples/backtranslation/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/backtranslation/README.md",
"repo_id": "COCO-LM",
"token_count": 4297
} | 165 |
# (Vectorized) Lexically constrained decoding with dynamic beam allocation
This page provides instructions for how to use lexically constrained decoding in Fairseq.
Fairseq implements the code described in the following papers:
* [Fast Lexically Constrained Decoding With Dynamic Beam Allocation](https://www.aclweb.or... | COCO-LM/fairseq/examples/constrained_decoding/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/constrained_decoding/README.md",
"repo_id": "COCO-LM",
"token_count": 1792
} | 166 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq.search import Search
class NoisyChannelBeamSearch(Search):
def __init__(self, tgt_dict):
super().__in... | COCO-LM/fairseq/examples/fast_noisy_channel/noisy_channel_beam_search.py/0 | {
"file_path": "COCO-LM/fairseq/examples/fast_noisy_channel/noisy_channel_beam_search.py",
"repo_id": "COCO-LM",
"token_count": 1386
} | 167 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import OrderedDict
import numpy as np
from fairseq.data import BaseWrapperDataset, FairseqDataset, iterators
class MultiI... | COCO-LM/fairseq/examples/laser/laser_src/multitask_data_utils.py/0 | {
"file_path": "COCO-LM/fairseq/examples/laser/laser_src/multitask_data_utils.py",
"repo_id": "COCO-LM",
"token_count": 2031
} | 168 |
#!/bin/bash
# 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.
if [ -z $WORKDIR_ROOT ] ;
then
echo "please specify your working directory root in environment variabl... | COCO-LM/fairseq/examples/multilingual/data_scripts/download_iitb.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/download_iitb.sh",
"repo_id": "COCO-LM",
"token_count": 462
} | 169 |
# Simple and Effective Noisy Channel Modeling for Neural Machine Translation (Yee et al., 2019)
This page contains pointers to pre-trained models as well as instructions on how to run the reranking scripts.
## Citation:
```bibtex
@inproceedings{yee2019simple,
title = {Simple and Effective Noisy Channel Modeling for ... | COCO-LM/fairseq/examples/noisychannel/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/noisychannel/README.md",
"repo_id": "COCO-LM",
"token_count": 1468
} | 170 |
#!/bin/bash
# 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.
# raw glue data as downloaded by glue download script (https://gist.github.com/W4ngatang/60c2bdb54d156a41194446737ce03e2e)
if [[ ... | COCO-LM/fairseq/examples/roberta/preprocess_GLUE_tasks.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/roberta/preprocess_GLUE_tasks.sh",
"repo_id": "COCO-LM",
"token_count": 2782
} | 171 |
# 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
import os
from fairseq import registry
(
build_monotonic_attention,
register_monotonic_attention,
MONOTONIC_AT... | COCO-LM/fairseq/examples/simultaneous_translation/modules/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/modules/__init__.py",
"repo_id": "COCO-LM",
"token_count": 248
} | 172 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
def calc_mean_invstddev(feature):
if len(feature.size()) != 2:
raise ValueError("We expect the input feature to be ... | COCO-LM/fairseq/examples/speech_recognition/data/data_utils.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/data/data_utils.py",
"repo_id": "COCO-LM",
"token_count": 1351
} | 173 |
#!/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.
"""
Flashlight decoders.
"""
import gc
import itertools as it
import os.path as osp
import warnings
from collections ... | COCO-LM/fairseq/examples/speech_recognition/w2l_decoder.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/w2l_decoder.py",
"repo_id": "COCO-LM",
"token_count": 9008
} | 174 |
#!/usr/bin/env bash
#
# Adapted from https://github.com/facebookresearch/MIXER/blob/master/prepareData.sh
echo 'Cloning Moses github repository (for tokenization scripts)...'
git clone https://github.com/moses-smt/mosesdecoder.git
echo 'Cloning Subword NMT repository (for BPE pre-processing)...'
git clone https://git... | COCO-LM/fairseq/examples/translation/prepare-iwslt14.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/translation/prepare-iwslt14.sh",
"repo_id": "COCO-LM",
"token_count": 1423
} | 175 |
# 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 math
import os
import subprocess
import sys
import tempfile
from collections import defaultdict
from itertools import c... | COCO-LM/fairseq/examples/unsupervised_quality_estimation/meteor.py/0 | {
"file_path": "COCO-LM/fairseq/examples/unsupervised_quality_estimation/meteor.py",
"repo_id": "COCO-LM",
"token_count": 1513
} | 176 |
/*
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
*/
#include <torch/extension.h>
#include <vector>
/*
CPP Binding for CUDA OP
*/
// CUDA forward declarations
torch::Tensor ngram_repeat_block_cuda_forward(torch::Tensor tokens,
torch::Tensor lprobs, ... | COCO-LM/fairseq/fairseq/clib/cuda/ngram_repeat_block_cuda.cpp/0 | {
"file_path": "COCO-LM/fairseq/fairseq/clib/cuda/ngram_repeat_block_cuda.cpp",
"repo_id": "COCO-LM",
"token_count": 778
} | 177 |
# 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
import torch
import torch.nn.functional as F
from fairseq import metrics, modules, utils
from fairseq.criterions import FairseqCr... | COCO-LM/fairseq/fairseq/criterions/masked_lm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/criterions/masked_lm.py",
"repo_id": "COCO-LM",
"token_count": 1360
} | 178 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
import numpy as np
import torch
import torch.nn.functional as F
from .. import FairseqDataset, BaseWrap... | COCO-LM/fairseq/fairseq/data/audio/raw_audio_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/audio/raw_audio_dataset.py",
"repo_id": "COCO-LM",
"token_count": 5261
} | 179 |
# 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 fairseq.data.encoders import register_bpe
from fairseq.data.encoders.byte_utils import (
SPACE,
SPACE_ESCAPE,
byte_encode,
... | COCO-LM/fairseq/fairseq/data/encoders/bytes.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/encoders/bytes.py",
"repo_id": "COCO-LM",
"token_count": 334
} | 180 |
# 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 shutil
import struct
from functools import lru_cache
import numpy as np
import torch
from fairseq.dataclass.constants import DATASET_I... | COCO-LM/fairseq/fairseq/data/indexed_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/indexed_dataset.py",
"repo_id": "COCO-LM",
"token_count": 8754
} | 181 |
from enum import Enum
from typing import Dict, List, Optional, Sequence
import torch
from fairseq.data import Dictionary
class EncoderLangtok(Enum):
"""
Prepend to the beginning of source sentence either the
source or target language token. (src/tgt).
"""
src = "src"
tgt = "tgt"
class Lang... | COCO-LM/fairseq/fairseq/data/multilingual/multilingual_utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/multilingual/multilingual_utils.py",
"repo_id": "COCO-LM",
"token_count": 698
} | 182 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from . import BaseWrapperDataset
class RollDataset(BaseWrapperDataset):
def __init__(self, dataset, shifts):
super... | COCO-LM/fairseq/fairseq/data/roll_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/roll_dataset.py",
"repo_id": "COCO-LM",
"token_count": 173
} | 183 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import namedtuple
import numpy as np
import torch
from fairseq import utils
DecoderOut = namedtuple(
"IterativeRefinem... | COCO-LM/fairseq/fairseq/iterative_refinement_generator.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/iterative_refinement_generator.py",
"repo_id": "COCO-LM",
"token_count": 7110
} | 184 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from fairseq.model_parallel.models.transformer import ModelParallelTransformerDecoder
from fairseq.models import registe... | COCO-LM/fairseq/fairseq/model_parallel/models/transformer_lm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/model_parallel/models/transformer_lm.py",
"repo_id": "COCO-LM",
"token_count": 3194
} | 185 |
# 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
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.models import (
Fai... | COCO-LM/fairseq/fairseq/models/fconv.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/fconv.py",
"repo_id": "COCO-LM",
"token_count": 13729
} | 186 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq.models import register_model, register_model_architecture
from fairseq.models.nat import NATransformerModel
def _s... | COCO-LM/fairseq/fairseq/models/nat/iterative_nonautoregressive_transformer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/nat/iterative_nonautoregressive_transformer.py",
"repo_id": "COCO-LM",
"token_count": 4214
} | 187 |
# 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 Tuple, List
import torch
import torch.nn.functional as F
from fairseq.models import FairseqEncoder
from fairseq.models.spe... | COCO-LM/fairseq/fairseq/models/speech_to_text/modules/augmented_memory_attention.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/speech_to_text/modules/augmented_memory_attention.py",
"repo_id": "COCO-LM",
"token_count": 7411
} | 188 |
# 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 functools
import operator
import torch
import torch.nn.functional as F
from fairseq.modules.fairseq_dropout import FairseqDropout
from... | COCO-LM/fairseq/fairseq/modules/adaptive_softmax.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/adaptive_softmax.py",
"repo_id": "COCO-LM",
"token_count": 4613
} | 189 |
#include <torch/torch.h>
#include <vector>
std::vector<float*> dynamicconv_cpu_forward(
float* input,
float* filters,
int padding_l);
std::vector<float*> dynamicconv_cpu_backward(
float* gradOutput,
int padding_l,
float* input,
float* filters);
std::vector<float*> dynamicconv_forward(
... | COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/dynamiconv_cpu.cpp/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/dynamiconv_cpu.cpp",
"repo_id": "COCO-LM",
"token_count": 327
} | 190 |
# 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 lightconv_cuda
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_decoding_utils import wi... | COCO-LM/fairseq/fairseq/modules/lightconv_layer/lightconv_layer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/lightconv_layer/lightconv_layer.py",
"repo_id": "COCO-LM",
"token_count": 2251
} | 191 |
# 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.
def parse_config_yaml(yaml_data):
# Initialize to default options.
quantization_options = {
"n_centroids": {
"Lin... | COCO-LM/fairseq/fairseq/modules/quantization/quantization_options.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/quantization/quantization_options.py",
"repo_id": "COCO-LM",
"token_count": 763
} | 192 |
# 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 Optional, Tuple
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq.modules import... | COCO-LM/fairseq/fairseq/modules/transformer_sentence_encoder.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/transformer_sentence_encoder.py",
"repo_id": "COCO-LM",
"token_count": 6886
} | 193 |
# 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.
class DynamicLossScaler(object):
def __init__(
self,
init_scale=2.0 ** 15,
scale_factor=2.0,
scale_window... | COCO-LM/fairseq/fairseq/optim/dynamic_loss_scaler.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/dynamic_loss_scaler.py",
"repo_id": "COCO-LM",
"token_count": 1216
} | 194 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
import torch
from fairseq.dataclass i... | COCO-LM/fairseq/fairseq/optim/nag.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/nag.py",
"repo_id": "COCO-LM",
"token_count": 1741
} | 195 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import logging
import os
import sy... | COCO-LM/fairseq/fairseq/tasks/audio_pretraining.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/audio_pretraining.py",
"repo_id": "COCO-LM",
"token_count": 5946
} | 196 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq import utils
from fairseq.data import LanguagePairDataset
from . import register_task
from .translation import Tran... | COCO-LM/fairseq/fairseq/tasks/translation_from_pretrained_bart.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/translation_from_pretrained_bart.py",
"repo_id": "COCO-LM",
"token_count": 2495
} | 197 |
#!/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.
"""
BLEU scoring of generated translations against reference translations.
"""
import argparse
import os
import sys
fr... | COCO-LM/fairseq/fairseq_cli/score.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq_cli/score.py",
"repo_id": "COCO-LM",
"token_count": 1636
} | 198 |
import math
import torch
import numbers
from torch.nn.parameter import Parameter
from torch.nn import init
from torch.nn import functional as F
import fused_layernorm_cuda
class FusedLayerNormAffineFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, input, weight, bias, normalized_shape, eps):
c... | COCO-LM/fairseq/fused_ops/fused_ops/layernorm/fused_layer_norm.py/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/fused_ops/layernorm/fused_layer_norm.py",
"repo_id": "COCO-LM",
"token_count": 2430
} | 199 |
#!/usr/bin/env python
"""Helper script to compare two argparse.Namespace objects."""
from argparse import Namespace # noqa
def main():
ns1 = eval(input("Namespace 1: "))
ns2 = eval(input("Namespace 2: "))
def keys(ns):
ks = set()
for k in dir(ns):
if not k.startswith("_"):
... | COCO-LM/fairseq/scripts/compare_namespaces.py/0 | {
"file_path": "COCO-LM/fairseq/scripts/compare_namespaces.py",
"repo_id": "COCO-LM",
"token_count": 553
} | 200 |
#!/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 os
import subprocess
import sys
from setuptools import setup, find_packages, Extension
from setuptools import E... | COCO-LM/fairseq/setup.py/0 | {
"file_path": "COCO-LM/fairseq/setup.py",
"repo_id": "COCO-LM",
"token_count": 3812
} | 201 |
#!/usr/bin/env python3
# import models/encoder/decoder to be tested
from examples.speech_recognition.models.vggtransformer import (
TransformerDecoder,
VGGTransformerEncoder,
VGGTransformerModel,
vggtransformer_1,
vggtransformer_2,
vggtransformer_base,
)
# import base test class
from .asr_test... | COCO-LM/fairseq/tests/speech_recognition/test_vggtransformer.py/0 | {
"file_path": "COCO-LM/fairseq/tests/speech_recognition/test_vggtransformer.py",
"repo_id": "COCO-LM",
"token_count": 2141
} | 202 |
# 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 unittest
from fairseq.dataclass.utils import convert_namespace_to_omegaconf
from fairseq.models.transformer import Tran... | COCO-LM/fairseq/tests/test_inference_dropout.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_inference_dropout.py",
"repo_id": "COCO-LM",
"token_count": 1291
} | 203 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import unittest
import tests.utils as test_utils
import torch
from fairseq.sequence_scorer import SequenceScorer
class Test... | COCO-LM/fairseq/tests/test_sequence_scorer.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_sequence_scorer.py",
"repo_id": "COCO-LM",
"token_count": 2352
} | 204 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
## Finetuning COCO-LM for question-answering on SQuAD.
## The script is largely adapted from the huggingface transformers library.
from __future__ import absolute_import, division, print_function
import argparse
import glob
import timeit
import... | COCO-LM/huggingface/run_squad.py/0 | {
"file_path": "COCO-LM/huggingface/run_squad.py",
"repo_id": "COCO-LM",
"token_count": 16402
} | 205 |
# ------------------------------------------
# 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/segmentation/backbone/cswin_transformer.py/0 | {
"file_path": "CSWin-Transformer/segmentation/backbone/cswin_transformer.py",
"repo_id": "CSWin-Transformer",
"token_count": 7882
} | 206 |
name: climaX
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_kmp_llvm
- appdirs=1.4.4=pyh9f0ad1d_0
- asciitree=0.3.3=py_2
- blas=1.0=mkl
- bokeh=2.4.3=pyhd8ed1ab_3
- bottleneck=1.3.6=py38h7e4f40d_0
- brotlipy=0.7.0=py38h27cfd23_1003
... | ClimaX/docker/environment.yml/0 | {
"file_path": "ClimaX/docker/environment.yml",
"repo_id": "ClimaX",
"token_count": 3683
} | 207 |
# Usage
## Pretraining
### Data Preparation
First install `snakemake` following [these instructions](https://snakemake.readthedocs.io/en/stable/getting_started/installation.html)
To download and regrid a CMIP6 dataset to a common resolution (e.g., 1.406525 degree), go to the corresponding directory inside `snakemak... | ClimaX/docs/usage.md/0 | {
"file_path": "ClimaX/docs/usage.md",
"repo_id": "ClimaX",
"token_count": 2377
} | 208 |
datadir: /data/CMIP6/CMCC
name: v_component_of_wind
cmip_name: va
era_name: v
run: r1i1p1f1
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/CMCC/config_v_component_of_wind.yml/0 | {
"file_path": "ClimaX/snakemake_configs/CMCC/config_v_component_of_wind.yml",
"repo_id": "ClimaX",
"token_count": 64
} | 209 |
datadir: /data/CMIP6/MPI-ESM
server_prefix: http://esgf-data1.llnl.gov/thredds/fileServer/css03_data/CMIP6/CMIP
name: temperature
cmip_name: ta
era_name: t
output_type: 6hrPlevPt
run: r1i1p1f1
version: v20190815
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/MPI-ESM/config_temperature.yml/0 | {
"file_path": "ClimaX/snakemake_configs/MPI-ESM/config_temperature.yml",
"repo_id": "ClimaX",
"token_count": 116
} | 210 |
from typing import Any, Dict
import numpy as np
import torch
from pytorch_lightning import LightningModule
from climax.climate_projection.arch import ClimaXClimateBench
from climax.utils.lr_scheduler import LinearWarmupCosineAnnealingLR
from climax.utils.metrics import (
mse,
lat_weighted_mse_val,
lat_weig... | ClimaX/src/climax/climate_projection/module.py/0 | {
"file_path": "ClimaX/src/climax/climate_projection/module.py",
"repo_id": "ClimaX",
"token_count": 3803
} | 211 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
from climax.regional_forecast.datamodule import RegionalForecastDataModule
from climax.regional_forecast.module import RegionalForecastModule
from pytorch_lightning.cli import LightningCLI
def main():
# Initialize Lightning with ... | ClimaX/src/climax/regional_forecast/train.py/0 | {
"file_path": "ClimaX/src/climax/regional_forecast/train.py",
"repo_id": "ClimaX",
"token_count": 611
} | 212 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn.functional as F
import models.networks as networks
import util.util as util
import itertools
try:
from torch.cuda.amp import autocast
except:
# dummy autocast for PyTorch < 1.6
class autocast:
def ... | CoCosNet-v2/models/pix2pix_model.py/0 | {
"file_path": "CoCosNet-v2/models/pix2pix_model.py",
"repo_id": "CoCosNet-v2",
"token_count": 6207
} | 213 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import torch
import numpy as np
from PIL import Image
from data.pix2pix_dataset import Pix2pixDataset
from data.base_dataset import get_params, get_transform
class CelebAHQDataset(Pix2pixDataset):
#hair, skin, l_brow, r_blow, l_eye... | CoCosNet/data/celebahq_dataset.py/0 | {
"file_path": "CoCosNet/data/celebahq_dataset.py",
"repo_id": "CoCosNet",
"token_count": 1839
} | 214 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.networks.base_network import BaseNetwork
from models.networks.generator import AdaptiveFeatureGenerator, DomainClassifier, ReverseLayerF
from util.util impo... | CoCosNet/models/networks/correspondence.py/0 | {
"file_path": "CoCosNet/models/networks/correspondence.py",
"repo_id": "CoCosNet",
"token_count": 9137
} | 215 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from collections import OrderedDict
import torch
import torchvision.utils as vutils
import torch.nn.functional as F
import data
import numpy as np
from util.util import masktorgb
from options.test_options import TestOptions
from models.... | CoCosNet/test.py/0 | {
"file_path": "CoCosNet/test.py",
"repo_id": "CoCosNet",
"token_count": 1185
} | 216 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch.nn as nn
import torch
class Model(nn.Module):
def __init__(self, encoder):
super(Model, self).__init__()
self.encoder = encoder
def forward(self, code_inputs=None, nl_inputs=None, cls=False):
... | CodeBERT/CodeExecutor/downstream/model_unixcoder.py/0 | {
"file_path": "CodeBERT/CodeExecutor/downstream/model_unixcoder.py",
"repo_id": "CodeBERT",
"token_count": 422
} | 217 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/code-to-code-trans/evaluator/CodeBLEU
# -*- coding:utf-8 -*-
import argparse
import os
from evaluator.CodeBLEU import bleu, weighted_ngram_match, syntax_match, dataflow_match
def get... | CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/calc_code_bleu.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/calc_code_bleu.py",
"repo_id": "CodeBERT",
"token_count": 1452
} | 218 |
import os
import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss, BCEWithLogitsLoss
import numpy as np
from utils import MyTokenizer
from transformers import (
RobertaConfig,
RobertaModel,
RobertaTokenizer,
BartConfig,
BartForConditionalGeneration,
... | CodeBERT/CodeReviewer/code/models.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/models.py",
"repo_id": "CodeBERT",
"token_count": 3886
} | 219 |
import argparse
import torch
from configs import add_args
from models import ReviewerModel, build_or_load_gen_model
MAX_SOURCE_LENGTH=512
def pad_assert(tokenizer, source_ids):
source_ids = source_ids[:MAX_SOURCE_LENGTH - 2]
source_ids = [tokenizer.bos_id] + source_ids + [tokenizer.eos_id]
pad_len = MAX_S... | CodeBERT/CodeReviewer/code/test_model.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/test_model.py",
"repo_id": "CodeBERT",
"token_count": 1115
} | 220 |
git clone https://github.com/tree-sitter/tree-sitter-go
git clone https://github.com/tree-sitter/tree-sitter-javascript
git clone https://github.com/tree-sitter/tree-sitter-python
git clone https://github.com/tree-sitter/tree-sitter-ruby
git clone https://github.com/tree-sitter/tree-sitter-php
git clone https://github.... | CodeBERT/GraphCodeBERT/refinement/parser/build.sh/0 | {
"file_path": "CodeBERT/GraphCodeBERT/refinement/parser/build.sh",
"repo_id": "CodeBERT",
"token_count": 147
} | 221 |
# LongCoder
This repo will provide the code for reproducing the experiments on LCC datasets in [LongCoder: A Long-Range Pre-trained Language Model for Code Completion](https://arxiv.org/abs/2306.14893). LongCoder is a sparse and efficient pre-trained Transformer model for long code modeling.
## 1. Dependency
- pip i... | CodeBERT/LongCoder/README.md/0 | {
"file_path": "CodeBERT/LongCoder/README.md",
"repo_id": "CodeBERT",
"token_count": 1014
} | 222 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torch
from torch.autograd import Variable
import copy
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss, MSELoss
class RobertaClassificationHead(nn.Module):
"""Head for sentence-l... | CodeBERT/UniXcoder/downstream-tasks/clone-detection/BCB/model.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/clone-detection/BCB/model.py",
"repo_id": "CodeBERT",
"token_count": 820
} | 223 |
# Code Search
## Data Download
#### 1. AdvTest dataset
```bash
mkdir dataset && cd dataset
wget https://github.com/microsoft/CodeXGLUE/raw/main/Text-Code/NL-code-search-Adv/dataset.zip
unzip dataset.zip && rm -r dataset.zip && mv dataset AdvTest && cd AdvTest
wget https://zenodo.org/record/7857872/files/python.zip... | CodeBERT/UniXcoder/downstream-tasks/code-search/README.md/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-search/README.md",
"repo_id": "CodeBERT",
"token_count": 2425
} | 224 |
# On the Advance of Making Language Models Better Reasoners
[[Paper]](https://arxiv.org/abs/2206.02336)
## News
- [August, 2022] Data release: `GSM8K` and `StrategyQA`, generated by `code-davinci-002`.
## Dataset Details
Each subfolder in the `/data` folder corresponds to a reasoning benchmark. You can find more d... | CodeT/DIVERSE/README.md/0 | {
"file_path": "CodeT/DIVERSE/README.md",
"repo_id": "CodeT",
"token_count": 1828
} | 225 |
https://openai.com/blog/grade-school-math/ | CodeT/DIVERSE/data/gsm8k/README.md/0 | {
"file_path": "CodeT/DIVERSE/data/gsm8k/README.md",
"repo_id": "CodeT",
"token_count": 15
} | 226 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import itertools
import functools
from utils import Tools, FilePathBuilder, CONSTANTS
from collections import defaultdict
class RepoWindowMaker:
def __init__(self, repo, window_size, slice_size):
self.repo = repo
self.window... | CodeT/RepoCoder/make_window.py/0 | {
"file_path": "CodeT/RepoCoder/make_window.py",
"repo_id": "CodeT",
"token_count": 5371
} | 227 |
import os
import time
import configparser
from pathlib import Path
API_KEYS_LOCATION = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'openaiapirc')
class PromptFile:
context_source_filename = ""
default_context_filename = "current_context.txt"
default_file_path = os.path.join(os.path.dirname... | Codex-CLI/src/prompt_file.py/0 | {
"file_path": "Codex-CLI/src/prompt_file.py",
"repo_id": "Codex-CLI",
"token_count": 4429
} | 228 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: __init__.py
Description: Unittests for Python SDK of the Cognitive Face API.
"""
try:
from . import config
except ImportError:
raise Exception(
'Please setup unittest configuration `config.py` properly by '
'referring to `config.sample.py`... | Cognitive-Face-Python/cognitive_face/tests/__init__.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/tests/__init__.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 480
} | 229 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: face.py
Description: Face model for Python SDK Sample.
"""
import wx
import util
class Rect(object):
"""Face Rectangle."""
def __init__(self, rect):
super(Rect, self).__init__()
self.set_rect(rect)
def set_rect(self, rect):
... | Cognitive-Face-Python/sample/model/face.py/0 | {
"file_path": "Cognitive-Face-Python/sample/model/face.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1376
} | 230 |
export CUDA_VISIBLE_DEVICES=2
python t5_run_eval.py \
--model_name_or_path ./checkpoint/Com/ControlExp_finetune_set1_seed1/checkpoint-50000 \
--subtask Com \
--validation_file test \
--ebatch_size 16 \
--set set1 | ContextualSP/abstraction_probing/code/t5_code/Com_ControlExp_test.sh/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/Com_ControlExp_test.sh",
"repo_id": "ContextualSP",
"token_count": 84
} | 231 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import argparse
import json
import os
import random
from datetime import datetime
from pprint import pprint
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader, BatchSampler
from pretrained_models import *
# from tensorboardX im... | ContextualSP/adaptershare/adapter_diff_train.py/0 | {
"file_path": "ContextualSP/adaptershare/adapter_diff_train.py",
"repo_id": "ContextualSP",
"token_count": 19113
} | 232 |
# Copyright (c) Microsoft. All rights reserved.
import tqdm
import unicodedata
PAD = "PADPAD"
UNK = "UNKUNK"
STA = "BOSBOS"
END = "EOSEOS"
PAD_ID = 0
UNK_ID = 1
STA_ID = 2
END_ID = 3
class Vocabulary(object):
INIT_LEN = 4
def __init__(self, neat=False):
self.neat = neat
if not neat:
... | ContextualSP/adaptershare/data_utils/vocab.py/0 | {
"file_path": "ContextualSP/adaptershare/data_utils/vocab.py",
"repo_id": "ContextualSP",
"token_count": 1248
} | 233 |
#!/usr/bin/env bash
###############################
# Data prepro pipeline for MT-DNN.
# By xiaodong
###############################
## dump original data into tsv
python experiments/glue/glue_prepro.py
declare -a PLMS=('bert-base-uncased' 'roberta-base' 'microsoft/deberta-base' 't5-base')
# prepro GLUE data for... | ContextualSP/adaptershare/experiments/glue/prepro.sh/0 | {
"file_path": "ContextualSP/adaptershare/experiments/glue/prepro.sh",
"repo_id": "ContextualSP",
"token_count": 193
} | 234 |
import collections
import json
def load_xnli(file, header=True):
lang_dict = collections.defaultdict(list)
label_dict = {}
cnt = 0
label_map = {"contradiction": 0, "neutral": 1, "entailment": 2}
with open(file, encoding="utf8") as f:
for line in f:
if header:
he... | ContextualSP/adaptershare/experiments/xnli/extract_cat.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/xnli/extract_cat.py",
"repo_id": "ContextualSP",
"token_count": 565
} | 235 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import os
import torch
import torch.nn as nn
from pretrained_models import MODEL_CLASSES
from module.dropout_wrapper import DropoutWrapper
from module.san import SANClassifier, MaskLmHeader
from module.san_model import SanModel
from module.pooler import Poo... | ContextualSP/adaptershare/mt_dnn/matcher.py/0 | {
"file_path": "ContextualSP/adaptershare/mt_dnn/matcher.py",
"repo_id": "ContextualSP",
"token_count": 6851
} | 236 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import BertModel
from models.nn_layers import RelationalEncoder
from models.nn_utils import *
from collections import defaultdict
from typing import Dict, List
from utils.data_iter import MetaIndex
class SpiderAlignmentModel(nn.Modul... | ContextualSP/awakening_latent_grounding/models/spider_align.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/models/spider_align.py",
"repo_id": "ContextualSP",
"token_count": 6237
} | 237 |
from utils.nlp_utils import ValueMatch, is_adjective
import torch
import nltk
from collections import OrderedDict, defaultdict
from typing import Any, List, Dict, Tuple
from dataclasses import dataclass
from utils.data_types import *
from utils.data_iter import MetaIndex
from utils.schema_linker import *
from fuzzywuzz... | ContextualSP/awakening_latent_grounding/utils/evaluator.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/utils/evaluator.py",
"repo_id": "ContextualSP",
"token_count": 18161
} | 238 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.