text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# Uncomment this line to see each command for debugging (careful: this will show secrets!)
# set -o xtrace
export TF_LOG=""
# This script assumes you have created an .env from the sample and the variables
# will come from there.
# shellcheck disable=SC2154
te... | AzureTRE/templates/workspace_services/gitea/terraform/deploy.sh/0 | {
"file_path": "AzureTRE/templates/workspace_services/gitea/terraform/deploy.sh",
"repo_id": "AzureTRE",
"token_count": 254
} | 128 |
<html>
<head>
<script type="text/javascript">
if (window.location.href.indexOf("?") != -1) {
window.location = window.location.href.replace("?", "guacamole/#");
} else {
window.location = window.location.href + "guacamole/";
}
</script>
</head>
<body>
Redirecting to Guacamole...
</body>
<... | AzureTRE/templates/workspace_services/guacamole/guacamole-server/docker/index.jsp/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/guacamole-server/docker/index.jsp",
"repo_id": "AzureTRE",
"token_count": 134
} | 129 |
/*
* 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 the Apache License, Version 2.0 (the
* "License"); you ... | AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/main/java/org/apache/guacamole/auth/azuretre/AzureTREAuthenticationProvider.java/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/main/java/org/apache/guacamole/auth/azuretre/AzureTREAuthenticationProvider.java",
"repo_id": "AzureTRE",
"token_count": 1998
} | 130 |
package org.apache.guacamole.auth.azuretre.user;
/*
* 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 the Apa... | AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/test/java/org/apache/guacamole/auth/azuretre/user/AzureTREAuthenticatedUserTest.java/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/test/java/org/apache/guacamole/auth/azuretre/user/AzureTREAuthenticatedUserTest.java",
"repo_id": "AzureTRE",
"token_count": 1962
} | 131 |
resource "azurerm_healthcare_workspace" "healthcare_workspace" {
name = "hs${local.service_resource_name_suffix}"
resource_group_name = data.azurerm_resource_group.ws.name
location = data.azurerm_resource_group.ws.location
tags = local.workspace_service_tags
lifecycle... | AzureTRE/templates/workspace_services/health-services/terraform/main.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/health-services/terraform/main.tf",
"repo_id": "AzureTRE",
"token_count": 1122
} | 132 |
export TF_LOG=""
terraform init -input=false -backend=true -reconfigure \
-backend-config="resource_group_name=$TF_VAR_mgmt_resource_group_name" \
-backend-config="storage_account_name=$TF_VAR_mgmt_storage_account_name" \
-backend-config="container_name=$TF_VAR_terraform_state_container_name" \
-backend... | AzureTRE/templates/workspace_services/innereye/terraform/deploy.sh/0 | {
"file_path": "AzureTRE/templates/workspace_services/innereye/terraform/deploy.sh",
"repo_id": "AzureTRE",
"token_count": 159
} | 133 |
export AZURE_STORAGE_CONNECTION_STRING="${MLFlow_Connection_String}"
pip install mlflow==1.24.0
pip install azure-storage-blob==12.10.0
pip install azure-identity==1.8.0
| AzureTRE/templates/workspace_services/mlflow/mlflow-vm-config/linux/template_config.sh/0 | {
"file_path": "AzureTRE/templates/workspace_services/mlflow/mlflow-vm-config/linux/template_config.sh",
"repo_id": "AzureTRE",
"token_count": 69
} | 134 |
ID="__CHANGE_ME__"
WORKSPACE_ID="__CHANGE_ME__"
SQL_SKU="__CHANGE_ME__"
STORAGE_MB="__CHANGE_ME__"
DB_NAME="__CHANGE_ME__"
| AzureTRE/templates/workspace_services/mysql/.env.sample/0 | {
"file_path": "AzureTRE/templates/workspace_services/mysql/.env.sample",
"repo_id": "AzureTRE",
"token_count": 63
} | 135 |
{
"schemaType": "ParameterSet",
"schemaVersion": "1.0.1",
"namespace": "",
"name": "tre-workspace-service-ohdsi",
"parameters": [
{
"name": "tre_id",
"source": {
"env": "TRE_ID"
}
},
{
"name": "id",
"source": {
"env": "ID"
}
},
{
"n... | AzureTRE/templates/workspace_services/ohdsi/parameters.json/0 | {
"file_path": "AzureTRE/templates/workspace_services/ohdsi/parameters.json",
"repo_id": "AzureTRE",
"token_count": 816
} | 136 |
resource "random_password" "atlas_security_admin_password" {
length = 8
special = false
}
resource "azurerm_key_vault_secret" "atlas_security_admin_password" {
name = "atlas-security-admin-password-${local.short_service_id}"
key_vault_id = data.azurerm_key_vault.ws.id
value = random_password.... | AzureTRE/templates/workspace_services/ohdsi/terraform/atlas_security.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/ohdsi/terraform/atlas_security.tf",
"repo_id": "AzureTRE",
"token_count": 643
} | 137 |
{
"schemaType": "ParameterSet",
"schemaVersion": "1.0.1",
"namespace": "",
"name": "tre-workspace-airlock-import-review",
"parameters": [
{
"name": "address_spaces",
"source": {
"env": "ADDRESS_SPACES"
}
},
{
"name": "azure_location",
"source": {
"env"... | AzureTRE/templates/workspaces/airlock-import-review/parameters.json/0 | {
"file_path": "AzureTRE/templates/workspaces/airlock-import-review/parameters.json",
"repo_id": "AzureTRE",
"token_count": 1500
} | 138 |
data "azurerm_user_assigned_identity" "airlock_id" {
name = "id-airlock-${var.tre_id}"
resource_group_name = "rg-${var.tre_id}"
}
data "azurerm_user_assigned_identity" "api_id" {
name = "id-api-${var.tre_id}"
resource_group_name = "rg-${var.tre_id}"
}
data "azurerm_private_dns_zo... | AzureTRE/templates/workspaces/base/terraform/airlock/data.tf/0 | {
"file_path": "AzureTRE/templates/workspaces/base/terraform/airlock/data.tf",
"repo_id": "AzureTRE",
"token_count": 403
} | 139 |
locals {
short_workspace_id = substr(var.tre_resource_id, -4, -1)
workspace_resource_name_suffix = "${var.tre_id}-ws-${local.short_workspace_id}"
storage_name = lower(replace("stg${substr(local.workspace_resource_name_suffix, -8, -1)}", "-", ""))
keyvault_name = lo... | AzureTRE/templates/workspaces/base/terraform/locals.tf/0 | {
"file_path": "AzureTRE/templates/workspaces/base/terraform/locals.tf",
"repo_id": "AzureTRE",
"token_count": 259
} | 140 |
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1 {
margin-top: 0;
font-weight: normal;
}
h2 {
... | AzureTRE/ui/app/src/App.scss/0 | {
"file_path": "AzureTRE/ui/app/src/App.scss",
"repo_id": "AzureTRE",
"token_count": 2337
} | 141 |
import React, { useEffect, useState } from 'react';
import { AnimationClassNames, Callout, IconButton, FontWeights, Stack, Text, getTheme, mergeStyles, mergeStyleSets, StackItem, IButtonStyles } from '@fluentui/react';
import { HttpMethod, useAuthApiCall } from '../../hooks/useAuthApiCall';
import { ApiEndpoint } from ... | AzureTRE/ui/app/src/components/shared/Footer.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/Footer.tsx",
"repo_id": "AzureTRE",
"token_count": 1635
} | 142 |
import React, { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { ApiEndpoint } from '../../models/apiEndpoints';
import { useAuthApiCall, HttpMethod } from '../../hooks/useAuthApiCall';
import { Spinner, SpinnerSize } from '@fluentui/react';
import { LoadingState }... | AzureTRE/ui/app/src/components/shared/SharedServiceItem.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/SharedServiceItem.tsx",
"repo_id": "AzureTRE",
"token_count": 875
} | 143 |
{
"id": "36847de7-aa82-40a8-bbe7-d211bd677467",
"resourceId": "8c70974a-5f66-4ae9-9502-7a54e9e0bb86",
"resourcePath": "/workspaces/1e800001-7385-46a1-9f6d-490a6201ea01/workspace-services/8c70974a-5f66-4ae9-9502-7a54e9e0bb86",
"resourceVersion": 0,
"status": "deploying",
"action": "install",
... | AzureTRE/ui/app/src/components/shared/notifications/dummyOp.json/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/notifications/dummyOp.json",
"repo_id": "AzureTRE",
"token_count": 393
} | 144 |
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
import { RootState, AppDispatch } from '../store/store';
// basically alias the generic hooks to give them type information for nicer usage throughout the app
export const useAppDispatch = () => useDispatch<AppDispatch>();
export const useAp... | AzureTRE/ui/app/src/hooks/customReduxHooks.ts/0 | {
"file_path": "AzureTRE/ui/app/src/hooks/customReduxHooks.ts",
"repo_id": "AzureTRE",
"token_count": 100
} | 145 |
export interface User {
email: string,
id: string,
name: string,
roleAssignments: Array<any>,
roles: Array<string>
} | AzureTRE/ui/app/src/models/user.ts/0 | {
"file_path": "AzureTRE/ui/app/src/models/user.ts",
"repo_id": "AzureTRE",
"token_count": 53
} | 146 |
{
"chemical2id": {
"lithium carbonate": "D016651",
"lithium": "D008094",
"phenobarbital": "D010634",
"ammonia": "D000641",
"valproic acid": "D014635",
"vpa": "D014635",
"nh3": "D000641",
"haloperidol": "D006220",
"apomorphine": "D001058",
... | BioGPT/data/BC5CDR/raw/valid.entities.json/0 | {
"file_path": "BioGPT/data/BC5CDR/raw/valid.entities.json",
"repo_id": "BioGPT",
"token_count": 45139
} | 147 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
DATA_DIR=../../data/PubMedQA
prefix=biogpt-large-pqal_qcl_ansis
RAW_DATA_DIR=${DATA_DIR}/raw
OUTPUT_DIR=${DATA_DIR}/${prefix}-bin
if [ -d "${OUTPUT_DIR}" ]; then
rm -rf ${OUTPUT_DIR}
fi
python rebuild_data.py ${RAW_DATA_DIR} ${prefix}
cp $... | BioGPT/examples/QA-PubMedQA/preprocess_large.sh/0 | {
"file_path": "BioGPT/examples/QA-PubMedQA/preprocess_large.sh",
"repo_id": "BioGPT",
"token_count": 761
} | 148 |
# Contributing
That would be awesome if you want to contribute something to BitBLAS!
- [Contributing](contributing.md#contributing)
- [Reporting Bugs](contributing.md#reporting-bugs)
- [Asking Questions](contributing.md#asking-questions)
- [Submitting Pull Requests](contributing.md#submitting-pull-requests)
-... | BitBLAS/CONTRIBUTING.md/0 | {
"file_path": "BitBLAS/CONTRIBUTING.md",
"repo_id": "BitBLAS",
"token_count": 513
} | 149 |
# 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, input... | BitBLAS/integration/BitNet/benchmark_inference_latency.py/0 | {
"file_path": "BitBLAS/integration/BitNet/benchmark_inference_latency.py",
"repo_id": "BitBLAS",
"token_count": 723
} | 150 |
// 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
${kernel_body}
int ladder_gemm_fp16xint2_fp16(half *input_0, half *input_1, half *output, c... | BitBLAS/integration/bitdistiller/template/kernel_template.int2.bitblas.cu.template/0 | {
"file_path": "BitBLAS/integration/bitdistiller/template/kernel_template.int2.bitblas.cu.template",
"repo_id": "BitBLAS",
"token_count": 190
} | 151 |
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# install torch
pip install torch==2.1.0
# install llvm
apt-get install llvm-10
# clone and build tvm
git submodule update --init --recursive
cd 3rdparty/tvm
mkdir build
cp cmake/config.cmake build
cd build
echo "set(USE_LLVM llvm... | BitBLAS/maint/scripts/installation.sh/0 | {
"file_path": "BitBLAS/maint/scripts/installation.sh",
"repo_id": "BitBLAS",
"token_count": 219
} | 152 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Hint definition for schedule"""
from typing import Dict, List, Tuple
from . import PrimFuncNode
import numpy as np
from .rasterization import *
class TensorCoreExtraConfig:
"""
This class is used to store extra information for tensorco... | BitBLAS/python/bitblas/base/roller/hint.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/roller/hint.py",
"repo_id": "BitBLAS",
"token_count": 3200
} | 153 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
GPU-generic schedule rules.
For CUDA/ROCm/Vulkan/Metal-specific rules, use `tvm.dlight.cuda/rocm/vulkan/metal` instead
"""
from .fallback import Fallback # noqa: F401
from .element_wise import ElementWise # noqa: F401
from .gemv import GEMV ... | BitBLAS/python/bitblas/gpu/__init__.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/__init__.py",
"repo_id": "BitBLAS",
"token_count": 319
} | 154 |
# 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/transpose.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/transpose.py",
"repo_id": "BitBLAS",
"token_count": 2290
} | 155 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from abc import ABC, abstractmethod
import tvm
from tvm import IRModule
from tvm.target import Target
from tvm.tir import PrimFunc
from tvm.contrib.dlpack import to_pytorch_func
from tvm._ffi.base import _LIB, raise_last_ffi_error
from tvm._ffi._c... | BitBLAS/python/bitblas/ops/operator.py/0 | {
"file_path": "BitBLAS/python/bitblas/ops/operator.py",
"repo_id": "BitBLAS",
"token_count": 6197
} | 156 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import pytest
import bitblas
from bitblas.ops.lop3_permutate import LOP3Permutate, LOP3PermutateConfig
import tvm
target = tvm.target.Target("llvm")
# fmt: off
@pytest.mark.parametrize("M,N,datatype,dequantize_bits,storage_dtype", [
(1024, 1... | BitBLAS/testing/python/operators/test_lop3_permutate_ops.py/0 | {
"file_path": "BitBLAS/testing/python/operators/test_lop3_permutate_ops.py",
"repo_id": "BitBLAS",
"token_count": 404
} | 157 |
from ..datasets import VisualGenomeCaptionDataset
from .datamodule_base import BaseDataModule
class VisualGenomeCaptionDataModule(BaseDataModule):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@property
def dataset_cls(self):
return VisualGenomeCaptionDataset
... | BridgeTower/src/datamodules/vg_caption_datamodule.py/0 | {
"file_path": "BridgeTower/src/datamodules/vg_caption_datamodule.py",
"repo_id": "BridgeTower",
"token_count": 145
} | 158 |
import torch
import torch.nn as nn
import pytorch_lightning as pl
import torch.nn.functional as F
from .bert_model import BertConfig, BertModel, BertCrossLayer
from . import swin_transformer as swin
from . import vit_model as vit
from .vit_model import resize_pos_embed
from . import heads, objectives, meter_utils
from ... | BridgeTower/src/modules/bt_module.py/0 | {
"file_path": "BridgeTower/src/modules/bt_module.py",
"repo_id": "BridgeTower",
"token_count": 14215
} | 159 |
import re
contractions = {
"aint": "ain't",
"arent": "aren't",
"cant": "can't",
"couldve": "could've",
"couldnt": "couldn't",
"couldn'tve": "couldn't've",
"couldnt've": "couldn't've",
"didnt": "didn't",
"doesnt": "doesn't",
"dont": "don't",
"hadnt": "hadn't",
"hadnt've":... | BridgeTower/src/utils/glossary.py/0 | {
"file_path": "BridgeTower/src/utils/glossary.py",
"repo_id": "BridgeTower",
"token_count": 2254
} | 160 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch.utils.data as data
from PIL import Image
import os
IMG_EXTENSIONS = [
".jpg",
".JPG",
".jpeg",
".JPEG",
".png",
".PNG",
".ppm",
".PPM",
".bmp",
".BMP",
".tiff",
".webp",
]
def is_ima... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/data/image_folder.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/data/image_folder.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 1309
} | 161 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import time
import numpy as np
# Helper class that keeps track of training iterations
class IterationCounter:
def __init__(self, opt, dataset_size):
self.opt = opt
self.dataset_size = dataset_size
self.fir... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/util/iter_counter.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/util/iter_counter.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 1311
} | 162 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
from detection_models.sync_batchnorm import DataParallelWithCallback
from detection_models.antialiasing import Downsample
class UNet(nn.Module):
def __init__(
self,
... | Bringing-Old-Photos-Back-to-Life/Global/detection_models/networks.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/detection_models/networks.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 5734
} | 163 |
# TEXT ENCODER CONFIG
text_model: 'gpt2'
text_len: 77
transformer_embed_dim: 768
freeze_text_encoder_weights: True
# AUDIO ENCODER CONFIG
audioenc_name: 'HTSAT'
out_emb: 768
sampling_rate: 44100
duration: 7
fmin: 50
fmax: 8000 #14000
n_fft: 1024 # 1028
hop_size: 320
mel_bins: 64
window_size: 1024
# PROJECTION SPACE... | CLAP/msclap/configs/config_2023.yml/0 | {
"file_path": "CLAP/msclap/configs/config_2023.yml",
"repo_id": "CLAP",
"token_count": 180
} | 164 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# fairseq documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 17 21:45:30 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | COCO-LM/fairseq/docs/conf.py/0 | {
"file_path": "COCO-LM/fairseq/docs/conf.py",
"repo_id": "COCO-LM",
"token_count": 1307
} | 165 |
.. role:: hidden
:class: hidden-section
.. module:: fairseq.tasks
.. _Tasks:
Tasks
=====
Tasks store dictionaries and provide helpers for loading/iterating over
Datasets, initializing the Model/Criterion and calculating the loss.
Tasks can be selected via the ``--task`` command-line argument. Once selected, a
... | COCO-LM/fairseq/docs/tasks.rst/0 | {
"file_path": "COCO-LM/fairseq/docs/tasks.rst",
"repo_id": "COCO-LM",
"token_count": 483
} | 166 |
# Cross-lingual Retrieval for Iterative Self-Supervised Training
https://arxiv.org/pdf/2006.09526.pdf
## Introduction
CRISS is a multilingual sequence-to-sequnce pretraining method where mining and training processes are applied iteratively, improving cross-lingual alignment and translation ability at the same time.... | COCO-LM/fairseq/examples/criss/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/criss/README.md",
"repo_id": "COCO-LM",
"token_count": 561
} | 167 |
# GottBERT: a pure German language model
## Introduction
[GottBERT](http://arxiv.org/abs/2012.02110) is a pretrained language model trained on 145GB of German text based on RoBERTa.
## Example usage
### fairseq
##### Load GottBERT from torch.hub (PyTorch >= 1.1):
```python
import torch
gottbert = torch.hub.load('py... | COCO-LM/fairseq/examples/gottbert/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/gottbert/README.md",
"repo_id": "COCO-LM",
"token_count": 785
} | 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 math
import torch
from torch.nn.modules.loss import _Loss
class LatentLayersKLLoss(_Loss):
def __init__(self, args):
sup... | COCO-LM/fairseq/examples/latent_depth/latent_depth_src/loss/latent_depth.py/0 | {
"file_path": "COCO-LM/fairseq/examples/latent_depth/latent_depth_src/loss/latent_depth.py",
"repo_id": "COCO-LM",
"token_count": 1908
} | 169 |
# Beyond English-Centric Multilingual Machine Translation
## Introduction
In this work, we create a true Many-to-Many multilingual translation model that can translate directly between any pair of 100 languages. Our focus on non-English-Centric models brings gains of more than 10 BLEU when directly translating between... | COCO-LM/fairseq/examples/m2m_100/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/m2m_100/README.md",
"repo_id": "COCO-LM",
"token_count": 4271
} | 170 |
#!/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 fileinput
import sacremoses
def main():
parser = argparse.ArgumentParser(description="... | COCO-LM/fairseq/examples/megatron_11b/detok.py/0 | {
"file_path": "COCO-LM/fairseq/examples/megatron_11b/detok.py",
"repo_id": "COCO-LM",
"token_count": 332
} | 171 |
#!/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_wat19_my.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/download_wat19_my.sh",
"repo_id": "COCO-LM",
"token_count": 527
} | 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.
from fairseq import options
def get_reranking_parser(default_task="translation"):
parser = options.get_parser("Generation and reranking"... | COCO-LM/fairseq/examples/noisychannel/rerank_options.py/0 | {
"file_path": "COCO-LM/fairseq/examples/noisychannel/rerank_options.py",
"repo_id": "COCO-LM",
"token_count": 3147
} | 173 |
# Training with Quantization Noise for Extreme Model Compression ({Fan\*, Stock\*} *et al.*, 2020)
This page contains information for how to train and quantize models with Quantization Noise, for both scalar quantization like `int8` and Iterative Product Quantization.
Check out our paper [here](https://arxiv.org/abs/20... | COCO-LM/fairseq/examples/quant_noise/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/quant_noise/README.md",
"repo_id": "COCO-LM",
"token_count": 5153
} | 174 |
# 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 wsc_criterion # noqa
from . import wsc_task # noqa
| COCO-LM/fairseq/examples/roberta/wsc/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/examples/roberta/wsc/__init__.py",
"repo_id": "COCO-LM",
"token_count": 70
} | 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.
from . import DEFAULT_EOS, GET, register_agent
from .simul_trans_agent import SimulTransAgent
from .word_splitter import SPLITTER_DICT
@regi... | COCO-LM/fairseq/examples/simultaneous_translation/eval/agents/simul_trans_text_agent.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/eval/agents/simul_trans_text_agent.py",
"repo_id": "COCO-LM",
"token_count": 1234
} | 176 |
# 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
# automatically import any Python files in the criterions/ directory
for file in os.listdir(os.path.dirname(__fil... | COCO-LM/fairseq/examples/simultaneous_translation/utils/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/utils/__init__.py",
"repo_id": "COCO-LM",
"token_count": 163
} | 177 |
# Flashlight Decoder
This script runs decoding for pre-trained speech recognition models.
## Usage
Assuming a few variables:
```bash
exp_dir=<path-to-experiment-directory>
data=<path-to-data-directory>
lm_model=<path-to-language-model>
lexicon=<path-to-lexicon>
```
Example usage for decoding a fine-tuned Wav2Vec m... | COCO-LM/fairseq/examples/speech_recognition/hydra/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/hydra/README.md",
"repo_id": "COCO-LM",
"token_count": 482
} | 178 |
[[Back]](..)
# S2T Example: Speech Recognition (ASR) on LibriSpeech
[LibriSpeech](https://www.danielpovey.com/files/2015_icassp_librispeech.pdf) is a de-facto standard English ASR
benchmark. We provide competitive
vanilla [Transformer](https://papers.nips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf) ... | COCO-LM/fairseq/examples/speech_to_text/docs/librispeech_example.md/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_to_text/docs/librispeech_example.md",
"repo_id": "COCO-LM",
"token_count": 1197
} | 179 |
# Mixture Models for Diverse Machine Translation: Tricks of the Trade (Shen et al., 2019)
This page includes instructions for reproducing results from the paper [Mixture Models for Diverse Machine Translation: Tricks of the Trade (Shen et al., 2019)](https://arxiv.org/abs/1902.07816).
## Download data
First, follow ... | COCO-LM/fairseq/examples/translation_moe/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/translation_moe/README.md",
"repo_id": "COCO-LM",
"token_count": 1289
} | 180 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Data pre-processing: build vocabularies and binarize training data.
"""
import argparse
import glob
import os
impor... | COCO-LM/fairseq/examples/wav2vec/wav2vec_manifest.py/0 | {
"file_path": "COCO-LM/fairseq/examples/wav2vec/wav2vec_manifest.py",
"repo_id": "COCO-LM",
"token_count": 991
} | 181 |
/**
* 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.
*/
#include <torch/torch.h> // @manual=//caffe2:torch_extension
#include <pybind11/detail/common.h>
#include <pybind11/pybi... | COCO-LM/fairseq/fairseq/clib/libnat/edit_dist.cpp/0 | {
"file_path": "COCO-LM/fairseq/fairseq/clib/libnat/edit_dist.cpp",
"repo_id": "COCO-LM",
"token_count": 2924
} | 182 |
# @package _group_
quantize_targets: true
final_dim: 256
encoder_layerdrop: 0.05
dropout_input: 0.1
dropout_features: 0.1
feature_grad_mult: 0.1
| COCO-LM/fairseq/fairseq/config/model/wav2vec2/wav2vec2_base.yaml/0 | {
"file_path": "COCO-LM/fairseq/fairseq/config/model/wav2vec2/wav2vec2_base.yaml",
"repo_id": "COCO-LM",
"token_count": 61
} | 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 math
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, ... | COCO-LM/fairseq/fairseq/criterions/sentence_ranking.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/criterions/sentence_ranking.py",
"repo_id": "COCO-LM",
"token_count": 2081
} | 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 numpy as np
import torch.nn.functional as F
from fairseq.data import BaseWrapperDataset
from fairseq.data.data_utils import get_buckets... | COCO-LM/fairseq/fairseq/data/bucket_pad_length_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/bucket_pad_length_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1024
} | 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 numpy as np
import torch
from fairseq.data import FairseqDataset
class BlockPairDataset(FairseqDataset):
"""Break a ... | COCO-LM/fairseq/fairseq/data/legacy/block_pair_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/legacy/block_pair_dataset.py",
"repo_id": "COCO-LM",
"token_count": 6450
} | 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.
from collections import OrderedDict
import torch
from torch.utils.data.dataloader import default_collate
from . import FairseqDataset
def ... | COCO-LM/fairseq/fairseq/data/nested_dictionary_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/nested_dictionary_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1898
} | 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 functools import lru_cache
import numpy as np
import torch
from fairseq.data import Dictionary, data_utils
from . import BaseWrapperDat... | COCO-LM/fairseq/fairseq/data/span_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/span_dataset.py",
"repo_id": "COCO-LM",
"token_count": 687
} | 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 ast
import inspect
import logging
import os
import re
from argparse import ArgumentError, ArgumentParser, Namespace
from dataclasses im... | COCO-LM/fairseq/fairseq/dataclass/utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/dataclass/utils.py",
"repo_id": "COCO-LM",
"token_count": 8103
} | 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.
"""
Wrapper around various loggers and progress bars (e.g., tqdm).
"""
import atexit
import json
import logging
import os
import sys
from col... | COCO-LM/fairseq/fairseq/logging/progress_bar.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/logging/progress_bar.py",
"repo_id": "COCO-LM",
"token_count": 6660
} | 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.
"""isort:skip_file"""
import argparse
import importlib
import os
from fairseq.dataclass import FairseqDataclass
from fairseq.dataclass.utils ... | COCO-LM/fairseq/fairseq/models/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/__init__.py",
"repo_id": "COCO-LM",
"token_count": 3133
} | 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 logging
import os
import sys
from typing import Dict, List, Optional
import torch
from fairseq.models import (
FairseqIncrementalD... | COCO-LM/fairseq/fairseq/models/huggingface/hf_gpt2.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/huggingface/hf_gpt2.py",
"repo_id": "COCO-LM",
"token_count": 2626
} | 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 math
import torch
import torch.nn.functional as F
from fairseq.models.nat import (
_apply_del_words,
_apply_ins_masks,
_ap... | COCO-LM/fairseq/fairseq/models/nat/nonautoregressive_ensembles.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/nat/nonautoregressive_ensembles.py",
"repo_id": "COCO-LM",
"token_count": 4769
} | 193 |
from .squad_head import * # noqa | COCO-LM/fairseq/fairseq/models/squad/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/squad/__init__.py",
"repo_id": "COCO-LM",
"token_count": 12
} | 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.
import torch
from torch import nn
from torch.nn.modules.utils import _single
from torch import Tensor
class ConvTBC(torch.nn.Module):
""... | COCO-LM/fairseq/fairseq/modules/conv_tbc.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/conv_tbc.py",
"repo_id": "COCO-LM",
"token_count": 701
} | 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.
"""
See "Gaussian Error Linear Units (GELUs)" by Dan Hendrycks and Kevin Gimpel with
the corresponding GitHub repo: https://github.com/hendryck... | COCO-LM/fairseq/fairseq/modules/gelu.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/gelu.py",
"repo_id": "COCO-LM",
"token_count": 295
} | 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 math
from typing import Dict, Optional, Tuple
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.incr... | COCO-LM/fairseq/fairseq/modules/multihead_attention.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/multihead_attention.py",
"repo_id": "COCO-LM",
"token_count": 16513
} | 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 torch
import torch.nn.functional as F
from torch.nn.modules.conv import _ConvNd
from torch.nn.modules.utils import _pair
from ..ops im... | COCO-LM/fairseq/fairseq/modules/quantization/scalar/modules/qconv.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/quantization/scalar/modules/qconv.py",
"repo_id": "COCO-LM",
"token_count": 2199
} | 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.
from __future__ import absolute_import, division, print_function, unicode_literals
from collections.abc import Iterable
from itertools import... | COCO-LM/fairseq/fairseq/modules/vggblock.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/vggblock.py",
"repo_id": "COCO-LM",
"token_count": 1898
} | 199 |
# 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.optim import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("lamb")
class FairseqLAMB(LegacyFairseqOptimizer):
... | COCO-LM/fairseq/fairseq/optim/fused_lamb.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/fused_lamb.py",
"repo_id": "COCO-LM",
"token_count": 794
} | 200 |
# 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 multiprocessing
import os
import pdb
import sys
__all__ = ["set_trace"]
_stdin = [None]
_stdin_lock = multiprocessing.Lock()
try:
... | COCO-LM/fairseq/fairseq/pdb.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/pdb.py",
"repo_id": "COCO-LM",
"token_count": 518
} | 201 |
# 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
from dataclasses import dataclass, field
from typing import Optional
import numpy as np
import torch
from fairseq im... | COCO-LM/fairseq/fairseq/tasks/language_modeling.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/language_modeling.py",
"repo_id": "COCO-LM",
"token_count": 6013
} | 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.
"""Implements tracking of constraints for a beam item.
A list of constraints is given as a list of one or more token
sequences, each of lengt... | COCO-LM/fairseq/fairseq/token_generation_constraints.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/token_generation_constraints.py",
"repo_id": "COCO-LM",
"token_count": 6770
} | 203 |
#include <torch/extension.h>
void fused_adam_cuda(at::Tensor & p, at::Tensor & m, at::Tensor & v, at::Tensor & g, float lr, float beta1, float beta2, float eps, float grad_scale, int step, int bias_correction, float decay);
#define CHECK_CUDA(x) AT_ASSERTM(x.type().is_cuda(), #x " must be a CUDA tensor")
#define CHEC... | COCO-LM/fairseq/fused_ops/csrc/adam/interface.cpp/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/csrc/adam/interface.cpp",
"repo_id": "COCO-LM",
"token_count": 516
} | 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.
"""isort:skip_file"""
import functools
import importlib
dependencies = [
"dataclasses",
"hydra",
"numpy",
"omegaconf",
"... | COCO-LM/fairseq/hubconf.py/0 | {
"file_path": "COCO-LM/fairseq/hubconf.py",
"repo_id": "COCO-LM",
"token_count": 807
} | 205 |
-- 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.
--
-- Usage: convert_dictionary.lua <dict.th7>
require 'fairseq'
require 'torch'
require 'paths'
if #arg < 1 then
print('usage: convert... | COCO-LM/fairseq/scripts/convert_dictionary.lua/0 | {
"file_path": "COCO-LM/fairseq/scripts/convert_dictionary.lua",
"repo_id": "COCO-LM",
"token_count": 314
} | 206 |
# 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 signal
import time
import unittest
import torch
from torch import nn
from fairseq.distributed import DistributedTimeou... | COCO-LM/fairseq/tests/distributed/test_distributed_timeout_wrapper.py/0 | {
"file_path": "COCO-LM/fairseq/tests/distributed/test_distributed_timeout_wrapper.py",
"repo_id": "COCO-LM",
"token_count": 525
} | 207 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import logging
import json
import os
import random
import sys
import tempfile
import unittest
from io import StringIO
from t... | COCO-LM/fairseq/tests/test_binaries.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_binaries.py",
"repo_id": "COCO-LM",
"token_count": 47182
} | 208 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from fairseq.data import MonolingualDataset
from fairseq.tasks.language_modeling import LanguageModelingTask, La... | COCO-LM/fairseq/tests/test_lm_context_window.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_lm_context_window.py",
"repo_id": "COCO-LM",
"token_count": 788
} | 209 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from fairseq import utils
class TestUtils(unittest.TestCase):
def test_convert_padding_direction(self):
... | COCO-LM/fairseq/tests/test_utils.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_utils.py",
"repo_id": "COCO-LM",
"token_count": 1891
} | 210 |
""" Official evaluation script for SQuAD version 2.0.
Modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected to ... | COCO-LM/huggingface/utils_squad_evaluate.py/0 | {
"file_path": "COCO-LM/huggingface/utils_squad_evaluate.py",
"repo_id": "COCO-LM",
"token_count": 5684
} | 211 |
# ------------------------------------------
# CSWin Transformer
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# written By Xiaoyi Dong
# ------------------------------------------
import glob
import operator
import os
import logging
import torch
from timm.utils.model import unwrap_model, ... | CSWin-Transformer/checkpoint_saver.py/0 | {
"file_path": "CSWin-Transformer/checkpoint_saver.py",
"repo_id": "CSWin-Transformer",
"token_count": 2948
} | 212 |
datadir: /data/CMIP6/AWI-ESM
name: 10m_u_component_of_wind
cmip_name: uas
era_name: u10
run: r1i1p1f1
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/AWI-ESM/config_10m_u_component_of_wind.yml/0 | {
"file_path": "ClimaX/snakemake_configs/AWI-ESM/config_10m_u_component_of_wind.yml",
"repo_id": "ClimaX",
"token_count": 72
} | 213 |
datadir: /data/CMIP6/HAMMOZ
name: 2m_temperature
cmip_name: tas
era_name: t2m
run: r1i1p1f1
version: v20190628
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/HAMMOZ/config_2m_temperature.yml/0 | {
"file_path": "ClimaX/snakemake_configs/HAMMOZ/config_2m_temperature.yml",
"repo_id": "ClimaX",
"token_count": 73
} | 214 |
datadir: /data/CMIP6/TaiESM1
server_prefix: https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/CMIP
name: 2m_temperature
cmip_name: tas
era_name: t2m
run: r1i1p1f1
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/TaiESM1/config_2m_temperature.yml/0 | {
"file_path": "ClimaX/snakemake_configs/TaiESM1/config_2m_temperature.yml",
"repo_id": "ClimaX",
"token_count": 105
} | 215 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# credits: https://github.com/ashleve/lightning-hydra-template/blob/main/src/models/mnist_module.py
from typing import Any
import torch
from pytorch_lightning import LightningModule
from torchvision.transforms import transforms
from climax.arch... | ClimaX/src/climax/global_forecast/module.py/0 | {
"file_path": "ClimaX/src/climax/global_forecast/module.py",
"repo_id": "ClimaX",
"token_count": 3936
} | 216 |
# Copyright (c) Meta Platforms, Inc. and 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.
# --------------------------------------------------------
# Position embedding utils
# -----------------------------------... | ClimaX/src/climax/utils/pos_embed.py/0 | {
"file_path": "ClimaX/src/climax/utils/pos_embed.py",
"repo_id": "ClimaX",
"token_count": 1756
} | 217 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
from util.util import feature_normalize, mse_loss
class ContextualLoss_forward(nn.Module):
'''
input is Al, Bl, channel = 1, range ~ [0, 255]
'''
def __i... | CoCosNet-v2/models/networks/ContextualLoss.py/0 | {
"file_path": "CoCosNet-v2/models/networks/ContextualLoss.py",
"repo_id": "CoCosNet-v2",
"token_count": 1301
} | 218 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from .base_options import BaseOptions
class TrainOptions(BaseOptions):
def initialize(self, parser):
BaseOptions.initialize(self, parser)
# for displays
parser.add_argument('--display_freq', type=int, default=2000, ... | CoCosNet-v2/options/train_options.py/0 | {
"file_path": "CoCosNet-v2/options/train_options.py",
"repo_id": "CoCosNet-v2",
"token_count": 1340
} | 219 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import re
import sys
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.networks.sync_batchnorm import SynchronizedBatchNorm2d
import torch.nn.utils.spectral_norm as spectral_norm
try:
import ape... | CoCosNet/models/networks/normalization.py/0 | {
"file_path": "CoCosNet/models/networks/normalization.py",
"repo_id": "CoCosNet",
"token_count": 5275
} | 220 |
"""
Evaluation metrics to measure functional correctness of traces.
"""
text_identifier_num = 0
gold_identifier_num = 0
correct_identifier_num = 0
def get_output_from_trace(text):
output_list = []
parse_loc = []
start_len = 0
while True:
num = text.find("<line>",start_len)
if num == -1:... | CodeBERT/CodeExecutor/inference/metric.py/0 | {
"file_path": "CodeBERT/CodeExecutor/inference/metric.py",
"repo_id": "CodeBERT",
"token_count": 5504
} | 221 |
import os, json
import torch
import logging
import argparse
import random
import numpy as np
from tqdm import tqdm
import multiprocessing
import time
from itertools import cycle
from torch.utils.data import DataLoader, SequentialSampler, RandomSampler
from torch.utils.data.distributed import DistributedSampler
from tra... | CodeBERT/CodeReviewer/code/run_infer_msg.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/run_infer_msg.py",
"repo_id": "CodeBERT",
"token_count": 2234
} | 222 |
# Code Translation
## Task Definition
Code translation aims to migrate legacy software from one programming language in a platform toanother.
Given a piece of Java (C#) code, the task is to translate the code into C# (Java) version.
Models are evaluated by BLEU scores and accuracy (exactly match).
## Dataset
The d... | CodeBERT/GraphCodeBERT/translation/README.md/0 | {
"file_path": "CodeBERT/GraphCodeBERT/translation/README.md",
"repo_id": "CodeBERT",
"token_count": 1538
} | 223 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import json
from tqdm import tqdm
def files(path):
g = os.walk(path)
file=[]
for path,dir_list,file_list in g:
for file_name in file_list:
file.append(os.path.join(path, file_name))
return file
c... | CodeBERT/UniXcoder/downstream-tasks/clone-detection/POJ-104/dataset/preprocess.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/clone-detection/POJ-104/dataset/preprocess.py",
"repo_id": "CodeBERT",
"token_count": 774
} | 224 |
#!/usr/bin/python
'''
This script was adapted from the original version by hieuhoang1972 which is part of MOSES.
'''
# $Id: bleu.py 1307 2007-03-14 22:22:36Z hieuhoang1972 $
'''Provides:
cook_refs(refs, n=4): Transform a list of reference sentences as strings into a form usable by cook_test().
cook_test(test, refs... | CodeBERT/UniXcoder/downstream-tasks/code-summarization/bleu.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-summarization/bleu.py",
"repo_id": "CodeBERT",
"token_count": 2960
} | 225 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | CodeT/DIVERSE/code/src/run_ner.py/0 | {
"file_path": "CodeT/DIVERSE/code/src/run_ner.py",
"repo_id": "CodeT",
"token_count": 6324
} | 226 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
from make_window import MakeWindowWrapper
from build_vector import BuildVectorWrapper, BagOfWords
from search_code import CodeSearchWrapper
from build_prompt import BuildPromptWrapper
fro... | CodeT/RepoCoder/run_pipeline.py/0 | {
"file_path": "CodeT/RepoCoder/run_pipeline.py",
"repo_id": "CodeT",
"token_count": 1228
} | 227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.