text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
data "azurerm_resource_group" "ws" {
name = "rg-${var.tre_id}-ws-${local.short_workspace_id}"
}
data "azurerm_key_vault" "ws" {
name = local.key_vault_name
resource_group_name = data.azurerm_resource_group.ws.name
}
data "azurerm_key_vault_secret" "aad_tenant_id" {
name = "auth-tenant-i... | AzureTRE/templates/workspace_services/ohdsi/terraform/data.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/ohdsi/terraform/data.tf",
"repo_id": "AzureTRE",
"token_count": 1125
} | 134 |
# This file has a .terraform file extension in order to avoid 'terraform init's validation checks that are executed by the 'make bundle-build' command.
# The Dockerfile includes a RUN command to change the extension from .terraform to .tf after the files from the base workspace are copied to this directory.
locals {
... | AzureTRE/templates/workspaces/airlock-import-review/terraform/import_review_resources.terraform/0 | {
"file_path": "AzureTRE/templates/workspaces/airlock-import-review/terraform/import_review_resources.terraform",
"repo_id": "AzureTRE",
"token_count": 1151
} | 135 |
locals {
core_vnet = "vnet-${var.tre_id}"
short_workspace_id = substr(var.tre_resource_id, -4, -1)
core_resource_group_name = "rg-${var.tre_id}"
workspace_resource_name_suffix = "${var.tre_id}-ws-${local.short_workspace_id}"
address_spaces = jsondecode(ba... | AzureTRE/templates/workspaces/base/terraform/network/locals.tf/0 | {
"file_path": "AzureTRE/templates/workspaces/base/terraform/network/locals.tf",
"repo_id": "AzureTRE",
"token_count": 269
} | 136 |
import React, { useContext } from 'react';
import { ResourceDebug } from '../shared/ResourceDebug';
import { Pivot, PivotItem } from '@fluentui/react';
import { ResourcePropertyPanel } from '../shared/ResourcePropertyPanel';
import { Resource } from '../../models/resource';
import { ResourceHistoryList } from '../share... | AzureTRE/ui/app/src/components/shared/ResourceBody.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/ResourceBody.tsx",
"repo_id": "AzureTRE",
"token_count": 1228
} | 137 |
import React from 'react';
import { getTheme, Icon, mergeStyles, Stack } from '@fluentui/react';
import { Link } from 'react-router-dom';
import { UserMenu } from './UserMenu';
import { NotificationPanel } from './notifications/NotificationPanel';
export const TopNav: React.FunctionComponent = () => {
return (
<... | AzureTRE/ui/app/src/components/shared/TopNav.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/TopNav.tsx",
"repo_id": "AzureTRE",
"token_count": 487
} | 138 |
// from Dan Abramov - https://overreacted.io/making-setinterval-declarative-with-react-hooks/
import { useEffect, useRef } from "react";
export const useInterval = (callback: () => void, delay: number | null) => {
const savedCallback = useRef(callback);
useEffect(() => {
savedCallback.current = callba... | AzureTRE/ui/app/src/components/shared/notifications/useInterval.ts/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/notifications/useInterval.ts",
"repo_id": "AzureTRE",
"token_count": 231
} | 139 |
import { App } from './App';
import { mergeStyles } from '@fluentui/react';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter } from 'react-router-dom';
import { pca } from './authConfig'
import { MsalProvider } from '@azure/msal-react';
import { Provider } from 'react-redux';
import { store } fro... | AzureTRE/ui/app/src/index.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/index.tsx",
"repo_id": "AzureTRE",
"token_count": 345
} | 140 |
import { Resource } from "./resource";
export interface WorkspaceService extends Resource {
workspaceId: string
}
| AzureTRE/ui/app/src/models/workspaceService.ts/0 | {
"file_path": "AzureTRE/ui/app/src/models/workspaceService.ts",
"repo_id": "AzureTRE",
"token_count": 30
} | 141 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
MODEL_DIR=../../checkpoints/RE-BC5CDR-BioGPT
MODEL=checkpoint_avg.pt
DATA_DIR=${PWD}/../../data/BC5CDR/relis-bin
BASE_DATA_DIR=${DATA_DIR%/*}
BIN_DATA_DIR=${DATA_DIR##*/}
DATA_PREFIX=${BIN_DATA_DIR%-*}
RAW_DATA_DIR=${BASE_DATA_DIR}/raw
OUTPUT_FIL... | BioGPT/examples/RE-BC5CDR/infer.sh/0 | {
"file_path": "BioGPT/examples/RE-BC5CDR/infer.sh",
"repo_id": "BioGPT",
"token_count": 660
} | 142 |
# BitBLAS
BitBLAS is a library to support mixed-precision BLAS operations on GPUs, for example, the $W_{wdtype}A_{adtype}$ mixed-precision matrix multiplication where $C_{cdtype}[M, N] = A_{adtype}[M, K] \times W_{wdtype}[N, K]$.
BitBLAS aims to support efficient mixed-precision DNN model deployment, especially the $W... | BitBLAS/README.md/0 | {
"file_path": "BitBLAS/README.md",
"repo_id": "BitBLAS",
"token_count": 3676
} | 143 |
# Installation Guide
## Prerequisites
**Operating System**: Linux (Ubuntu 20.04 or later recommended for installation via wheel or PyPI or you may need to checkout the [Building from Source](#building-from-source) section for other Linux distributions.)
- **Python Version**: >= 3.7
- **CUDA Version**: >= 10.0
## In... | BitBLAS/docs/Installation.md/0 | {
"file_path": "BitBLAS/docs/Installation.md",
"repo_id": "BitBLAS",
"token_count": 637
} | 144 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse
import torch
from modeling_bitnet import BitnetForCausalLM
torch.set_grad_enabled(False)
parser = argparse.ArgumentParser()
parser.add_argument('--hf_path', default='1bitLLM/bitnet_b1_58-3B', type=str)
def profile(model, inpu... | BitBLAS/integration/BitNet/eval_correctness.py/0 | {
"file_path": "BitBLAS/integration/BitNet/eval_correctness.py",
"repo_id": "BitBLAS",
"token_count": 597
} | 145 |
// 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/fastertransformer/kenrel_output/ladder_kernel.cu/0 | {
"file_path": "BitBLAS/integration/fastertransformer/kenrel_output/ladder_kernel.cu",
"repo_id": "BitBLAS",
"token_count": 11504
} | 146 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import List
import numpy as np
def get_all_factors(n: int) -> List[int]:
# Calculate the square root of n and round it up to the nearest integer
n0 = int(np.ceil(np.sqrt(n)))
# Find all divisors of n that are less than ... | BitBLAS/python/bitblas/base/roller/policy/common.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/roller/policy/common.py",
"repo_id": "BitBLAS",
"token_count": 710
} | 147 |
# Copyright 2018 The apache/tvm Authors. All Rights Reserved.
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under th... | BitBLAS/python/bitblas/gpu/fallback.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/fallback.py",
"repo_id": "BitBLAS",
"token_count": 1504
} | 148 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from .operator import Operator # noqa: F401
from .matmul import Matmul, MatmulConfig # noqa: F401
from .matmul_dequantize import MatmulWeightOnlyDequantize, MatmulWeightOnlyDequantizeConfig # noqa: F401
from .ladder_permutate import LadderPermu... | BitBLAS/python/bitblas/ops/__init__.py/0 | {
"file_path": "BitBLAS/python/bitblas/ops/__init__.py",
"repo_id": "BitBLAS",
"token_count": 151
} | 149 |
# Copyright 2018 The apache/tvm Authors. All Rights Reserved.
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under th... | BitBLAS/python/bitblas/quantization/quantization.py/0 | {
"file_path": "BitBLAS/python/bitblas/quantization/quantization.py",
"repo_id": "BitBLAS",
"token_count": 3697
} | 150 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import io
import subprocess
import shutil
from setuptools import setup, find_packages
from setuptools.command.install import install
from setuptools.command.build_py import build_py
from setuptools.command.sdist import sdist
from wheel.bdist_whee... | BitBLAS/setup.py/0 | {
"file_path": "BitBLAS/setup.py",
"repo_id": "BitBLAS",
"token_count": 4512
} | 151 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import pytest
import bitblas
from bitblas.ops.param_permutate import ParamPermutate, ParamPermutateConfig
import tvm
target = tvm.target.Target("llvm")
# fmt: off
@pytest.mark.parametrize(
"M,N,datatype,transpose_matrix,group_size,propagat... | BitBLAS/testing/python/operators/test_param_permutate_ops.py/0 | {
"file_path": "BitBLAS/testing/python/operators/test_param_permutate_ops.py",
"repo_id": "BitBLAS",
"token_count": 464
} | 152 |
# Based on https://pytorch-lightning.readthedocs.io/en/stable/notebooks/lightning_examples/text-transformers.html
import copy
import os
from datetime import datetime
from typing import Optional
from pytorch_lightning.loggers import WandbLogger
import datasets
import torch
import pytorch_lightning as pl
from pytorch_li... | BridgeTower/run_cifar.py/0 | {
"file_path": "BridgeTower/run_cifar.py",
"repo_id": "BridgeTower",
"token_count": 5038
} | 153 |
import random
import torch
import io
import pyarrow as pa
import os
from PIL import Image
from ..transforms import keys_to_transforms
class BaseDataset(torch.utils.data.Dataset):
def __init__(
self,
data_dir: str,
transform_keys: list,
image_size: int,
names: list,
... | BridgeTower/src/datasets/base_dataset.py/0 | {
"file_path": "BridgeTower/src/datasets/base_dataset.py",
"repo_id": "BridgeTower",
"token_count": 5467
} | 154 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .bert_model import BertPredictionHeadTransform
class LinkTower(nn.Module):
def __init__(self, config):
super(LinkTower, self).__init__()
self.LayerNorm = nn.LayerNorm(config['hidden_size'])
def forward(self, hidden_states... | BridgeTower/src/modules/heads.py/0 | {
"file_path": "BridgeTower/src/modules/heads.py",
"repo_id": "BridgeTower",
"token_count": 736
} | 155 |
import json
import pandas as pd
import pyarrow as pa
import gc
import random
import os
from tqdm import tqdm
from glob import glob
import pandas as pd
def path2rest(path, iid2captions):
split, _, name = path.split("/")[-3:]
split = split.split("_")[-1]
iid = name
with open(path, "rb") as fp:
... | BridgeTower/src/utils/write_conceptual_caption.py/0 | {
"file_path": "BridgeTower/src/utils/write_conceptual_caption.py",
"repo_id": "BridgeTower",
"token_count": 1306
} | 156 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
from models.networks.base_network import BaseNetwork
from models.networks.generator import *
from models.networks.encoder import *
import util.util as util
def find_network_using_name(target_network_name, filename):
target_clas... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/__init__.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/__init__.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 665
} | 157 |
import numpy as np
import cv2
import PySimpleGUI as sg
import os.path
import argparse
import os
import sys
import shutil
from subprocess import call
def modify(image_filename=None, cv2_frame=None):
def run_cmd(command):
try:
call(command, shell=True)
except KeyboardInterrupt:
... | Bringing-Old-Photos-Back-to-Life/GUI.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/GUI.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 3364
} | 158 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import random
import torch
from torch.autograd import Variable
class ImagePool:
def __init__(self, pool_size):
self.pool_size = pool_size
if self.pool_size > 0:
self.num_imgs = 0
self.images = []
... | Bringing-Old-Photos-Back-to-Life/Global/util/image_pool.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/util/image_pool.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 601
} | 159 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchlibrosa.stft import Spectrogram, LogmelFilterBank
from .htsat import HTSATWrapper
def get_audio_encoder(name: str):
if name == "Cnn14":
return Cnn14
elif name == "HTSAT":
return HTSATWrapper
else:
raise Exc... | CLAP/msclap/models/audio.py/0 | {
"file_path": "CLAP/msclap/models/audio.py",
"repo_id": "CLAP",
"token_count": 3644
} | 160 |
[writers]
option-limit=0
| COCO-LM/fairseq/docs/docutils.conf/0 | {
"file_path": "COCO-LM/fairseq/docs/docutils.conf",
"repo_id": "COCO-LM",
"token_count": 10
} | 161 |
# Fine-tuning BART on GLUE tasks
### 1) Download the data from GLUE website (https://gluebenchmark.com/tasks) using following commands:
```bash
wget https://gist.githubusercontent.com/W4ngatang/60c2bdb54d156a41194446737ce03e2e/raw/17b8dd0d724281ed7c3b2aeeda662b92809aadd5/download_glue_data.py
python download_glue_data... | COCO-LM/fairseq/examples/bart/README.glue.md/0 | {
"file_path": "COCO-LM/fairseq/examples/bart/README.glue.md",
"repo_id": "COCO-LM",
"token_count": 1615
} | 162 |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import glob
from subprocess import check_call
try:
import faiss
has_faiss = True
except Imp... | COCO-LM/fairseq/examples/criss/mining/mine.py/0 | {
"file_path": "COCO-LM/fairseq/examples/criss/mining/mine.py",
"repo_id": "COCO-LM",
"token_count": 4017
} | 163 |
# Adaptive Input Representations for Neural Language Modeling (Baevski and Auli, 2018)
## Pre-trained models
Description | Parameters | Dataset | Model and Test set(s)
---|---:|---|---
Adaptive Inputs <br> ([Baevski and Auli, 2018](https://arxiv.org/abs/1809.10853)) | 1026M | [Google Billion Words](https://github.com... | COCO-LM/fairseq/examples/language_model/README.adaptive_inputs.md/0 | {
"file_path": "COCO-LM/fairseq/examples/language_model/README.adaptive_inputs.md",
"repo_id": "COCO-LM",
"token_count": 723
} | 164 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict, Optional
import torch.nn as nn
from fairseq.models.fairseq_encoder import EncoderOut
from fairseq.models.transf... | COCO-LM/fairseq/examples/latent_depth/latent_depth_src/models/latent_transformer.py/0 | {
"file_path": "COCO-LM/fairseq/examples/latent_depth/latent_depth_src/models/latent_transformer.py",
"repo_id": "COCO-LM",
"token_count": 2408
} | 165 |
import argparse
from collections import namedtuple
import os
DATADIR = "/path/to/train_data"
DEDUP_FROM_DIR = "/path/to/eval/data"
OUTPUT_DIR = "/path/to/output/data"
def main(args):
languages = set()
for language_directory in os.listdir(DATADIR):
if "_" in language_directory:
src, tgt = ... | COCO-LM/fairseq/examples/m2m_100/process_data/dedup_data.py/0 | {
"file_path": "COCO-LM/fairseq/examples/m2m_100/process_data/dedup_data.py",
"repo_id": "COCO-LM",
"token_count": 1410
} | 166 |
# Install dependency
```bash
pip install -r requirement.txt
```
# Download the data set
```bash
export WORKDIR_ROOT=<a directory which will hold all working files>
```
The downloaded data will be at $WORKDIR_ROOT/ML50
# preprocess the data
Install SPM [here](https://github.com/google/sentencepiece)
```bash
export W... | COCO-LM/fairseq/examples/multilingual/data_scripts/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/README.md",
"repo_id": "COCO-LM",
"token_count": 207
} | 167 |
#!/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 variable... | COCO-LM/fairseq/examples/multilingual/data_scripts/preprocess_ML50_v1.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/preprocess_ML50_v1.sh",
"repo_id": "COCO-LM",
"token_count": 295
} | 168 |
# 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 random
import numpy as np
from fairseq import options
from examples.noisychannel import rerank, rerank_options
def ... | COCO-LM/fairseq/examples/noisychannel/rerank_tune.py/0 | {
"file_path": "COCO-LM/fairseq/examples/noisychannel/rerank_tune.py",
"repo_id": "COCO-LM",
"token_count": 1362
} | 169 |
# Finetuning RoBERTa on GLUE tasks
### 1) Download the data from GLUE website (https://gluebenchmark.com/tasks) using following commands:
```bash
wget https://gist.githubusercontent.com/W4ngatang/60c2bdb54d156a41194446737ce03e2e/raw/17b8dd0d724281ed7c3b2aeeda662b92809aadd5/download_glue_data.py
python download_glue_da... | COCO-LM/fairseq/examples/roberta/README.glue.md/0 | {
"file_path": "COCO-LM/fairseq/examples/roberta/README.glue.md",
"repo_id": "COCO-LM",
"token_count": 1643
} | 170 |
# 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 json
from functools import lru_cache
def convert_sentence_to_json(sentence):
if "_" in sentence:
prefix, rest = sentence.... | COCO-LM/fairseq/examples/roberta/wsc/wsc_utils.py/0 | {
"file_path": "COCO-LM/fairseq/examples/roberta/wsc/wsc_utils.py",
"repo_id": "COCO-LM",
"token_count": 4154
} | 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 argparse
import json
import torch
from examples.simultaneous_translation.utils.latency import LatencyInference
LATENCY_METRICS = [
... | COCO-LM/fairseq/examples/simultaneous_translation/eval/eval_latency.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/eval/eval_latency.py",
"repo_id": "COCO-LM",
"token_count": 1037
} | 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
class LatencyMetric(object):
@staticmethod
def length_from_padding_mask(padding_mask, batch_first: bool = False):
... | COCO-LM/fairseq/examples/simultaneous_translation/utils/latency.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/utils/latency.py",
"repo_id": "COCO-LM",
"token_count": 7473
} | 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.
import gc
import itertools as it
import math
import os.path as osp
import warnings
from collections import deque, name... | COCO-LM/fairseq/examples/speech_recognition/hydra/decoder.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/hydra/decoder.py",
"repo_id": "COCO-LM",
"token_count": 10775
} | 174 |
# Simultaneous Speech Translation (SimulST) on MuST-C
This is a tutorial of training and evaluating a transformer *wait-k* simultaneous model on MUST-C English-Germen Dataset, from [SimulMT to SimulST: Adapting Simultaneous Text Translation to End-to-End Simultaneous Speech Translation](https://www.aclweb.org/antholog... | COCO-LM/fairseq/examples/speech_to_text/docs/simulst_mustc_example.md/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_to_text/docs/simulst_mustc_example.md",
"repo_id": "COCO-LM",
"token_count": 2709
} | 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 torch
class LogSumExpMoE(torch.autograd.Function):
"""Standard LogSumExp forward pass, but use *posterior* for the backward.
... | COCO-LM/fairseq/examples/translation_moe/translation_moe_src/logsumexp_moe.py/0 | {
"file_path": "COCO-LM/fairseq/examples/translation_moe/translation_moe_src/logsumexp_moe.py",
"repo_id": "COCO-LM",
"token_count": 319
} | 176 |
# Unsupervised Cross-lingual Representation Learning at Scale (XLM-RoBERTa)
https://arxiv.org/pdf/1911.02116.pdf
## Introduction
XLM-R (XLM-RoBERTa) is a generic cross lingual sentence encoder that obtains state-of-the-art results on many cross-lingual understanding (XLU) benchmarks. It is trained on 2.5T of filtered... | COCO-LM/fairseq/examples/xlmr/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/xlmr/README.md",
"repo_id": "COCO-LM",
"token_count": 2169
} | 177 |
/**
* Copyright 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.
*/
#pragma once
#include <torch/extension.h>
torch::Tensor LevenshteinDistanceCuda(
torch::Tensor source,
... | COCO-LM/fairseq/fairseq/clib/libnat_cuda/edit_dist.h/0 | {
"file_path": "COCO-LM/fairseq/fairseq/clib/libnat_cuda/edit_dist.h",
"repo_id": "COCO-LM",
"token_count": 242
} | 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 math
from dataclasses import dataclass
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions impo... | COCO-LM/fairseq/fairseq/criterions/adaptive_loss.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/criterions/adaptive_loss.py",
"repo_id": "COCO-LM",
"token_count": 1998
} | 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.
"""isort:skip_file"""
from .dictionary import Dictionary, TruncatedDictionary
from .fairseq_dataset import FairseqDataset, FairseqIterableDat... | COCO-LM/fairseq/fairseq/data/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/__init__.py",
"repo_id": "COCO-LM",
"token_count": 1595
} | 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 torch
from . import FairseqDataset
class ConcatSentencesDataset(FairseqDataset):
def __init__(self, *datasets):
super().... | COCO-LM/fairseq/fairseq/data/concat_sentences_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/concat_sentences_dataset.py",
"repo_id": "COCO-LM",
"token_count": 685
} | 181 |
# 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
from fairseq.data.encoders import register_tokenizer
from fairseq.dataclass import FairseqDataclass
... | COCO-LM/fairseq/fairseq/data/encoders/moses_tokenizer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/encoders/moses_tokenizer.py",
"repo_id": "COCO-LM",
"token_count": 660
} | 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.
from . import BaseWrapperDataset
class ListDataset(BaseWrapperDataset):
def __init__(self, dataset, sizes=None):
super().__init_... | COCO-LM/fairseq/fairseq/data/list_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/list_dataset.py",
"repo_id": "COCO-LM",
"token_count": 292
} | 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.
import numpy as np
import torch
from . import BaseWrapperDataset
class NumelDataset(BaseWrapperDataset):
def __init__(self, dataset, re... | COCO-LM/fairseq/fairseq/data/numel_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/numel_dataset.py",
"repo_id": "COCO-LM",
"token_count": 332
} | 184 |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | COCO-LM/fairseq/fairseq/data/squad/squad_extractor.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/squad/squad_extractor.py",
"repo_id": "COCO-LM",
"token_count": 8408
} | 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 contextlib
from typing import Optional
import torch
from fairseq.dataclass.configs import DistributedTrainingConfig
from fairseq.dist... | COCO-LM/fairseq/fairseq/distributed/fully_sharded_data_parallel.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/distributed/fully_sharded_data_parallel.py",
"repo_id": "COCO-LM",
"token_count": 2045
} | 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 math
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, register_criterion
try:
from fairseq.mo... | COCO-LM/fairseq/fairseq/model_parallel/criterions/vocab_parallel_cross_entropy.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/model_parallel/criterions/vocab_parallel_cross_entropy.py",
"repo_id": "COCO-LM",
"token_count": 1356
} | 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.
"""
BART: Denoising Sequence-to-Sequence Pre-training for
Natural Language Generation, Translation, and Comprehension
"""
from typing import Op... | COCO-LM/fairseq/fairseq/models/bart/model.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/bart/model.py",
"repo_id": "COCO-LM",
"token_count": 7259
} | 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.
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
f... | COCO-LM/fairseq/fairseq/models/lstm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/lstm.py",
"repo_id": "COCO-LM",
"token_count": 14643
} | 189 |
# 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 Counter
from typing import List
import torch
def align_bpe_to_words(roberta, bpe_tokens: torch.LongTensor, other_to... | COCO-LM/fairseq/fairseq/models/roberta/alignment_utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/roberta/alignment_utils.py",
"repo_id": "COCO-LM",
"token_count": 1862
} | 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.
from fairseq.models import register_model, register_model_architecture
from fairseq.models.transformer import (
TransformerModel,
base... | COCO-LM/fairseq/fairseq/models/transformer_align.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/transformer_align.py",
"repo_id": "COCO-LM",
"token_count": 1469
} | 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.
#
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq.modules.fairseq_dropout import FairseqDropout
f... | COCO-LM/fairseq/fairseq/modules/downsampled_multihead_attention.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/downsampled_multihead_attention.py",
"repo_id": "COCO-LM",
"token_count": 5639
} | 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.
import torch
import torch.nn as nn
from fairseq.modules import Fp32GroupNorm
class KmeansVectorQuantizer(nn.Module):
def __init__(
... | COCO-LM/fairseq/fairseq/modules/kmeans_vector_quantizer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/kmeans_vector_quantizer.py",
"repo_id": "COCO-LM",
"token_count": 2060
} | 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.
import torch
def emulate_int(w, bits, method, scale=None, zero_point=None):
q = globals()[f"emulate_int{bits}_{method}"]
return q(w,... | COCO-LM/fairseq/fairseq/modules/quantization/scalar/ops.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/quantization/scalar/ops.py",
"repo_id": "COCO-LM",
"token_count": 699
} | 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.
"""isort:skip_file"""
import importlib
import os
from fairseq import registry
from fairseq.optim.bmuf import FairseqBMUF # noqa
from fairseq... | COCO-LM/fairseq/fairseq/optim/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/__init__.py",
"repo_id": "COCO-LM",
"token_count": 537
} | 195 |
# 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 argparse import Namespace
from fairseq.dataclass.utils import gen_parser_from_dataclass
from fairseq.optim import FairseqOptimizer
cla... | COCO-LM/fairseq/fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py",
"repo_id": "COCO-LM",
"token_count": 800
} | 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 importlib
import os
from abc import ABC, abstractmethod
from fairseq import registry
from omegaconf import DictConfig
class BaseSco... | COCO-LM/fairseq/fairseq/scoring/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/scoring/__init__.py",
"repo_id": "COCO-LM",
"token_count": 546
} | 197 |
# 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 numpy as np
from fairseq.data import (
AppendTokenDataset,
ConcatDataset,
DenoisingDataset,
D... | COCO-LM/fairseq/fairseq/tasks/multilingual_denoising.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/multilingual_denoising.py",
"repo_id": "COCO-LM",
"token_count": 4582
} | 198 |
# 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 contextlib
import copy
import importlib
import logging
import os
import sys
import tempfile
import warnings
from iterto... | COCO-LM/fairseq/fairseq/utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/utils.py",
"repo_id": "COCO-LM",
"token_count": 11060
} | 199 |
#include "ATen/ATen.h"
#include "ATen/AccumulateType.h"
#include "ATen/cuda/CUDAContext.h"
#include <THC/THCDeviceUtils.cuh>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_bf16.h>
#include "type_shim.h"
template<typename U> __device__
void cuWelfordOnlineSum(
const U curr,
U& mu,
U& sigma2,
U& co... | COCO-LM/fairseq/fused_ops/csrc/layernorm/layernorm_kernel.cu/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/csrc/layernorm/layernorm_kernel.cu",
"repo_id": "COCO-LM",
"token_count": 14286
} | 200 |
#!/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.
# fail fast
set -e
# python get_glue_data.py --data_dir $1
# raw glue data as downloaded by glue download script (https://gist.gi... | COCO-LM/fairseq/preprocess/glue/process.sh/0 | {
"file_path": "COCO-LM/fairseq/preprocess/glue/process.sh",
"repo_id": "COCO-LM",
"token_count": 2776
} | 201 |
#!/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 argparse
from fairseq.data import Dictionary, data_utils, indexed_dataset
def get_parser():
parser = argp... | COCO-LM/fairseq/scripts/read_binarized.py/0 | {
"file_path": "COCO-LM/fairseq/scripts/read_binarized.py",
"repo_id": "COCO-LM",
"token_count": 526
} | 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 functools
import tempfile
import torch
def spawn_and_init(fn, world_size, args=None):
if args is None:
args = ()
wit... | COCO-LM/fairseq/tests/distributed/utils.py/0 | {
"file_path": "COCO-LM/fairseq/tests/distributed/utils.py",
"repo_id": "COCO-LM",
"token_count": 805
} | 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 unittest
import torch
from fairseq.data import LanguagePairDataset, TokenBlockDataset
from fairseq.data.concat_dataset import ConcatDa... | COCO-LM/fairseq/tests/test_concat_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_concat_dataset.py",
"repo_id": "COCO-LM",
"token_count": 948
} | 204 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import uuid
from fairseq import metrics
class TestMetrics(unittest.TestCase):
def test_nesting(self):
with metr... | COCO-LM/fairseq/tests/test_metrics.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_metrics.py",
"repo_id": "COCO-LM",
"token_count": 1257
} | 205 |
# COCO-LM (Huggingface)
This repository contains the Huggingface version of scripts for fine-tuning COCO-LM pretrained models on GLUE and SQuAD benchmarks. The scripts are based on the [Huggingface Transformers Library](https://github.com/huggingface/transformers).
Paper: [COCO-LM: Correcting and Contrasting Text Seq... | COCO-LM/huggingface/README.md/0 | {
"file_path": "COCO-LM/huggingface/README.md",
"repo_id": "COCO-LM",
"token_count": 1951
} | 206 |
datadir: /data/CMIP6/AWI-ESM
name: geopotential
cmip_name: zg
era_name: z
run: r1i1p1f1
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/AWI-ESM/config_geopotential.yml/0 | {
"file_path": "ClimaX/snakemake_configs/AWI-ESM/config_geopotential.yml",
"repo_id": "ClimaX",
"token_count": 64
} | 207 |
datadir: /data/CMIP6/HAMMOZ
name: temperature
cmip_name: ta
era_name: t
run: r1i1p1f1
version: v20190628
res:
- 1.40625
# - 5.625
| ClimaX/snakemake_configs/HAMMOZ/config_temperature.yml/0 | {
"file_path": "ClimaX/snakemake_configs/HAMMOZ/config_temperature.yml",
"repo_id": "ClimaX",
"token_count": 67
} | 208 |
datadir: /data/CMIP6/TaiESM1
server_prefix: https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/CMIP
name: temperature
cmip_name: ta
era_name: t
run: r1i1p1f1
res:
- 1.40625
# - 5.625
| ClimaX/snakemake_configs/TaiESM1/config_temperature.yml/0 | {
"file_path": "ClimaX/snakemake_configs/TaiESM1/config_temperature.yml",
"repo_id": "ClimaX",
"token_count": 99
} | 209 |
import argparse
import xarray as xr
import numpy as np
import xesmf as xe
from glob import glob
import os
def regrid(
ds_in,
ddeg_out,
method='bilinear',
reuse_weights=True,
cmip=False,
rename=None
):
"""
Regrid horizontally.
:param ds_in: Input xarray datase... | ClimaX/src/data_preprocessing/regrid.py/0 | {
"file_path": "ClimaX/src/data_preprocessing/regrid.py",
"repo_id": "ClimaX",
"token_count": 2416
} | 210 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import sys
import torch
from torchvision.utils import save_image
from options.train_options import TrainOptions
import data
from util.iter_counter import IterationCounter
from util.util import print_current_errors
from util.util import ... | CoCosNet-v2/train.py/0 | {
"file_path": "CoCosNet-v2/train.py",
"repo_id": "CoCosNet-v2",
"token_count": 1723
} | 211 |
"""
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 sys
import argparse
import os
from util import util
import torch
import models
import data
import pickle
class BaseOptions():
def _... | CoCosNet/options/base_options.py/0 | {
"file_path": "CoCosNet/options/base_options.py",
"repo_id": "CoCosNet",
"token_count": 4619
} | 212 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import cv2
from PIL import Image
import numpy as np
from skimage import feature
# parts = ['skin', 'hair', 'l_brow', 'r_brow', 'l_eye', 'r_eye', 'l_ear', 'r_ear', 'nose', 'u_lip', 'mouth', 'l_lip', 'neck',
# 'cloth', 'hat',... | CoCosNet/util/mask_to_edge.py/0 | {
"file_path": "CoCosNet/util/mask_to_edge.py",
"repo_id": "CoCosNet",
"token_count": 1054
} | 213 |
CUDA_VISIBLE_DEBVISES=0 python run.py \
--prefix codenet \
--output_dir ../saved_models/inference \
--data_cache_dir ../saved_models/inference \
--eval_data_path ../data/codenetmut_test.json \
--model_name_or_path microsoft/codeexecutor \
--block_size 1024 \
--per_gpu_train_batch_size 8 \
... | CodeBERT/CodeExecutor/inference/run.sh/0 | {
"file_path": "CodeBERT/CodeExecutor/inference/run.sh",
"repo_id": "CodeBERT",
"token_count": 268
} | 214 |
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-level classification tasks."""
def __init__(self, config):
sup... | CodeBERT/GraphCodeBERT/clonedetection/model.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/clonedetection/model.py",
"repo_id": "CodeBERT",
"token_count": 1311
} | 215 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torch
from torch.autograd import Variable
import copy
class Seq2Seq(nn.Module):
"""
Build Seqence-to-Sequence.
Parameters:
* `encoder`- encoder of seq2seq model. e.g... | CodeBERT/GraphCodeBERT/translation/model.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/translation/model.py",
"repo_id": "CodeBERT",
"token_count": 4898
} | 216 |
# Code Completion
## Dependency
- pip install torch
- pip install transformers
- pip install javalang
## Data Download
```bash
unzip dataset.zip
cd dataset/javaCorpus/
bash download.sh
python preprocess.py --base_dir=token_completion --output_dir=./
wget https://github.com/microsoft/CodeXGLUE/raw/main/Code-Code/C... | CodeBERT/UniXcoder/downstream-tasks/code-completion/README.md/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-completion/README.md",
"repo_id": "CodeBERT",
"token_count": 1029
} | 217 |
# Zero-shot Code-to-Code Search
Given a source code as the query, the task aims to retrieve codes with the same semantics from a collection of candidates in zero-shot setting. We collect 11,744/15,594/23,530 functions from [CodeNet](https://github.com/IBM/Project_CodeNet) corpus in Ruby/Python/Java. Each function s... | CodeBERT/UniXcoder/downstream-tasks/zero-shot-search/README.md/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/zero-shot-search/README.md",
"repo_id": "CodeBERT",
"token_count": 337
} | 218 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import logging
import os
from src.postprocess import PostProcessor
from src.execution import evaluate_with_test_code, evaluate_with_test_cases
from src.io_utils import Tools
from src.agreement import DataManager, DualAgreement
fr... | CodeT/CodeT/main.py/0 | {
"file_path": "CodeT/CodeT/main.py",
"repo_id": "CodeT",
"token_count": 914
} | 219 |
#!/usr/bin/env bash
set -e
trap 'exitScript' ERR
help()
{
cat <<- _EOF_
Help for Codex CLI Bash setup script
Usage: source bash_setup.sh [optional parameters]
-o orgId Set the OpenAI organization id.
-k apiKey Set the OpenAI API key.
-e engineId Set the OpenAI engine id.
-d Pri... | Codex-CLI/scripts/bash_setup.sh/0 | {
"file_path": "Codex-CLI/scripts/bash_setup.sh",
"repo_id": "Codex-CLI",
"token_count": 2218
} | 220 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: face.py
Description: Face section of the Cognitive Face API.
"""
from . import util
def detect(image, face_id=True, landmarks=False, attributes=''):
"""Detect human faces in an image and returns face locations, and
optionally with `face_id`s, landmarks, ... | Cognitive-Face-Python/cognitive_face/face.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/face.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 3006
} | 221 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: test_large_person_group_person.py
Description: Unittests for Large Person Group Person section of the Cognitive
Face API.
"""
import unittest
import cognitive_face as CF
from . import util
class TestLargePersonGroupPerson(unittest.TestCase):
"""Unitte... | Cognitive-Face-Python/cognitive_face/tests/test_large_person_group_person.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/tests/test_large_person_group_person.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 779
} | 222 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: panel_identification.py
Description: Identification Panel for Python SDK sample.
"""
import os
import uuid
import wx
import wx.lib.scrolledpanel as scrolled
import util
import model
from view import base
class IdentificationPanel(base.MyPanel):
"""Identif... | Cognitive-Face-Python/sample/view/panel_identification.py/0 | {
"file_path": "Cognitive-Face-Python/sample/view/panel_identification.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 4424
} | 223 |
# Copyright (c) Microsoft. All rights reserved.
import logging
from time import gmtime, strftime
import sys
def create_logger(name, silent=False, to_disk=False, log_file=None):
"""Logger wrapper"""
# setup logger
log = logging.getLogger(name)
log.setLevel(logging.DEBUG)
log.propagate = False
f... | ContextualSP/adaptershare/data_utils/log_wrapper.py/0 | {
"file_path": "ContextualSP/adaptershare/data_utils/log_wrapper.py",
"repo_id": "ContextualSP",
"token_count": 431
} | 224 |
#!/usr/bin/env bash
###############################
# Training script for domain adaptation
# By Xiaodong
###############################
set -e
if [[ $# -lt 5 ]]; then
echo "run_domain_adaptation.sh <data_dir> <init_checkpoint> <train> <test> <batch-size>"
exit 1
fi
data_dir=$1
ICKPT=$2
TRAIN=$3
TEST=$4
ba... | ContextualSP/adaptershare/experiments/domain_adaptation/run_domain_adaptation.sh/0 | {
"file_path": "ContextualSP/adaptershare/experiments/domain_adaptation/run_domain_adaptation.sh",
"repo_id": "ContextualSP",
"token_count": 472
} | 225 |
import os
import argparse
from sys import path
path.append(os.getcwd())
from data_utils.task_def import DataFormat
from data_utils.log_wrapper import create_logger
from experiments.ner.ner_utils import load_conll_chunk, load_conll_ner, load_conll_pos
from experiments.common_utils import dump_rows
logger = create_logg... | ContextualSP/adaptershare/experiments/ner/prepro.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/ner/prepro.py",
"repo_id": "ContextualSP",
"token_count": 1397
} | 226 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import torch
import random
import torch.nn as nn
from torch.nn.utils import weight_norm
from torch.nn.parameter import Parameter
import torch.nn.functional as F
from module.dropout_wrapper import DropoutWrapper
from module.similarity import FlatSimilarityWr... | ContextualSP/adaptershare/module/san.py/0 | {
"file_path": "ContextualSP/adaptershare/module/san.py",
"repo_id": "ContextualSP",
"token_count": 2756
} | 227 |
from transformers import BertConfig, BertModel, BertTokenizer
from module.san_model import SanModel
MODEL_CLASSES = {
"bert": (BertConfig, BertModel, BertTokenizer),
# "xlnet": (XLNetConfig, XLNetModel, XLNetTokenizer),
# "roberta": (RobertaConfig, RobertaModel, RobertaTokenizer),
# "albert": (AlbertCo... | ContextualSP/adaptershare/pretrained_models.py/0 | {
"file_path": "ContextualSP/adaptershare/pretrained_models.py",
"repo_id": "ContextualSP",
"token_count": 275
} | 228 |
import os
import re
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import BertTokenizer, AdamW, get_linear_schedule_with_warmup
from models import *
from utils import *
from datetime import datetime
import logging
from dataclasses import dataclass, field
def get_logger(log_dir: st... | ContextualSP/awakening_latent_grounding/distill.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/distill.py",
"repo_id": "ContextualSP",
"token_count": 6781
} | 229 |
#!/usr/bin/env bash
wget https://ai.tencent.com/ailab/nlp/en/dialogue/datasets/Restoration-200K.zip
unzip -j Restoration-200K.zip
rm -rf Restoration-200K.zip
python ../../preprocess.py --dataset Multi | ContextualSP/incomplete_utterance_rewriting/dataset/Multi/download.sh/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/dataset/Multi/download.sh",
"repo_id": "ContextualSP",
"token_count": 77
} | 230 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Author: Qian Liu (SivilTaram)
# Original Repo: https://github.com/microsoft/ContextualSP
from typing import Dict
from typing import List
import numpy as np
import torch
import torch.nn as nn
from allennlp.data import Vocabulary
from allennlp.m... | ContextualSP/incomplete_utterance_rewriting/src/model.py/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/src/model.py",
"repo_id": "ContextualSP",
"token_count": 9456
} | 231 |
# coding: utf-8
import json
import dill
import hashlib
import os
import torch
from allennlp.common.util import JsonDict, sanitize
from allennlp.data import Instance
from allennlp.data import Vocabulary
from allennlp.models.archival import load_archive
from parsers.irnet.context.converter import ActionConverter
from ... | ContextualSP/interactive_text_to_sql/parsers/parser.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/parsers/parser.py",
"repo_id": "ContextualSP",
"token_count": 1776
} | 232 |
# coding: utf-8
import logging
import sys
import random
import os
from tqdm import tqdm
import numpy as np
import torch
from src.data import SpiderAlignDataset
from src.aligner_model import BertAlignerModel
from src.utils.utils import AverageMeter
logging.basicConfig(level=logging.INFO,
format=... | ContextualSP/interactive_text_to_sql/src/train_spider_aligner.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/train_spider_aligner.py",
"repo_id": "ContextualSP",
"token_count": 4785
} | 233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.