text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
resource "azurerm_resource_group" "rg" {
location = data.azurerm_resource_group.rg.location
name = local.resource_group_name
tags = merge(
local.tre_shared_service_tags,
{
project = "Azure Trusted Research Environment",
source = "https://github.com/microsoft/AzureTRE/"
},
)
lifec... | AzureTRE/templates/shared_services/databricks-auth/terraform/main.tf/0 | {
"file_path": "AzureTRE/templates/shared_services/databricks-auth/terraform/main.tf",
"repo_id": "AzureTRE",
"token_count": 823
} | 118 |
# Azure Provider source and version being used
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.53.0"
}
}
backend "azurerm" {}
}
provider "azurerm" {
features {}
}
| AzureTRE/templates/shared_services/firewall/terraform/providers.tf/0 | {
"file_path": "AzureTRE/templates/shared_services/firewall/terraform/providers.tf",
"repo_id": "AzureTRE",
"token_count": 99
} | 119 |
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/azurerm" {
version = "3.53.0"
constraints = "3.53.0"
hashes = [
"h1:bK70LV1NldhodSm58cUpawKwdUL1A5AKKglAV2wZ/QY=",
"zh:078ece8318ad7d6c1cd2e5f2044188e74... | AzureTRE/templates/shared_services/sonatype-nexus-vm/terraform/.terraform.lock.hcl/0 | {
"file_path": "AzureTRE/templates/shared_services/sonatype-nexus-vm/terraform/.terraform.lock.hcl",
"repo_id": "AzureTRE",
"token_count": 1932
} | 120 |
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/azure/azapi" {
version = "1.1.0"
constraints = "1.1.0"
hashes = [
"h1:IR+AHCwfjl1c0baWwfOwZ6QZtHj41H2syTgHkJtAr/M=",
"zh:2a25df6325a49f9e821f0b02c7da86167fc19a3ba... | AzureTRE/templates/workspace_services/azureml/terraform/.terraform.lock.hcl/0 | {
"file_path": "AzureTRE/templates/workspace_services/azureml/terraform/.terraform.lock.hcl",
"repo_id": "AzureTRE",
"token_count": 2645
} | 121 |
---
schemaVersion: 1.0.0
name: tre-service-databricks
version: 1.0.3
description: "An Azure TRE service for Azure Databricks."
registry: azuretre
dockerfile: Dockerfile.tmpl
credentials:
- name: azure_tenant_id
env: ARM_TENANT_ID
- name: azure_subscription_id
env: ARM_SUBSCRIPTION_ID
- name: azure_clien... | AzureTRE/templates/workspace_services/databricks/porter.yaml/0 | {
"file_path": "AzureTRE/templates/workspace_services/databricks/porter.yaml",
"repo_id": "AzureTRE",
"token_count": 2182
} | 122 |
ARG GITEA_TAG=1.17.3
ARG CERTIFICATE_URL=https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem
FROM gitea/gitea:${GITEA_TAG}
# need to pass args to stage
ARG CERTIFICATE_URL
RUN wget -q -O /usr/local/share/ca-certificates/mysql.crt.pem ${CERTIFICATE_URL} && update-ca-certificates
COPY . /
RUN /usr/sbin/add... | AzureTRE/templates/workspace_services/gitea/docker/Dockerfile/0 | {
"file_path": "AzureTRE/templates/workspace_services/gitea/docker/Dockerfile",
"repo_id": "AzureTRE",
"token_count": 193
} | 123 |
variable "workspace_id" {
type = string
}
variable "tre_id" {
type = string
}
variable "id" {
type = string
}
variable "mgmt_resource_group_name" {
type = string
}
variable "mgmt_acr_name" {
type = string
}
variable "aad_authority_url" {
type = string
}
variable "gitea_storage_limit" {
type = numbe... | AzureTRE/templates/workspace_services/gitea/terraform/variables.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/gitea/terraform/variables.tf",
"repo_id": "AzureTRE",
"token_count": 188
} | 124 |
#!/usr/bin/env sh
echo >&2 "tomcat exited. code=${1}"
# terminate other services to exit from the container
exec s6-svscanctl -t /var/run/s6/services | AzureTRE/templates/workspace_services/guacamole/guacamole-server/docker/services/tomcat/finish/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/guacamole-server/docker/services/tomcat/finish",
"repo_id": "AzureTRE",
"token_count": 53
} | 125 |
{
"guacamoleVersion" : "1.4.0",
"name" : "Azure Trusted Research Environment Integration",
"namespace" : "guac-azuretre",
"authProviders" : [
"org.apache.guacamole.auth.azuretre.AzureTREAuthenticationProvider"
]
}
| AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/main/resources/guac-manifest.json/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/main/resources/guac-manifest.json",
"repo_id": "AzureTRE",
"token_count": 110
} | 126 |
locals {
short_service_id = substr(var.tre_resource_id, -4, -1)
short_workspace_id = substr(var.workspace_id, -4, -1)
workspace_resource_name_suffix = "${var.tre_id}-ws-${local.short_workspace_id}"
service_resource_name_suffix = "${var.tre_id}-ws-${local.short_workspace_id}-svc-${loc... | AzureTRE/templates/workspace_services/guacamole/terraform/locals.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/terraform/locals.tf",
"repo_id": "AzureTRE",
"token_count": 869
} | 127 |
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://github.com/microsoft/AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-import-reviewvm/template_schema.json",
"type": "object",
"title": "Import review Virtual Machine",
"description": "Windows virtua... | AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-import-reviewvm/template_schema.json/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-import-reviewvm/template_schema.json",
"repo_id": "AzureTRE",
"token_count": 568
} | 128 |
---
schemaVersion: 1.0.0
name: tre-service-guacamole-linuxvm
version: 0.6.9
description: "An Azure TRE User Resource Template for Guacamole (Linux)"
dockerfile: Dockerfile.tmpl
registry: azuretre
custom:
# For information on vm_sizes and image_options, see README.me in the guacamole/user-resources folder
vm_sizes:... | AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml",
"repo_id": "AzureTRE",
"token_count": 4068
} | 129 |
export TF_LOG=""
terraform init -input=false -backend=true -reconfigure -upgrade \
-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" \
... | AzureTRE/templates/workspace_services/mlflow/terraform/deploy.sh/0 | {
"file_path": "AzureTRE/templates/workspace_services/mlflow/terraform/deploy.sh",
"repo_id": "AzureTRE",
"token_count": 170
} | 130 |
# Azure Provider source and version being used
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.18.0"
}
random = {
source = "hashicorp/random"
version = "=3.4.2"
}
}
backend "azurerm" {}
}
provider "azurerm" {
features {
key_v... | AzureTRE/templates/workspace_services/mysql/terraform/main.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/mysql/terraform/main.tf",
"repo_id": "AzureTRE",
"token_count": 859
} | 131 |
create schema IF NOT EXISTS webapi_security;
DROP TABLE IF EXISTS webapi_security.security;
CREATE TABLE webapi_security.security
(
email character varying(255),
password character varying(255)
);
GRANT USAGE ON SCHEMA webapi_security TO PUBLIC;
GRANT ALL ON SCHEMA webapi_security TO GROUP ohdsi_admin;
do ... | AzureTRE/templates/workspace_services/ohdsi/sql/atlas_create_security.sql/0 | {
"file_path": "AzureTRE/templates/workspace_services/ohdsi/sql/atlas_create_security.sql",
"repo_id": "AzureTRE",
"token_count": 404
} | 132 |
resource "azurerm_key_vault_secret" "jdbc_connection_string_webapi_admin" {
name = "jdbc-connectionstring-${local.short_service_id}"
key_vault_id = data.azurerm_key_vault.ws.id
value = "jdbc:postgresql://${azurerm_postgresql_flexible_server.postgres.fqdn}:5432/${local.postgres_webapi_database_name}... | AzureTRE/templates/workspace_services/ohdsi/terraform/ohdsi_web_api.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/ohdsi/terraform/ohdsi_web_api.tf",
"repo_id": "AzureTRE",
"token_count": 4147
} | 133 |
resource "azurerm_log_analytics_workspace" "workspace" {
name = "log-${var.tre_id}-ws-${local.short_workspace_id}"
resource_group_name = var.resource_group_name
location = var.location
retention_in_days = 30
sku = "PerGB2018"
tag... | AzureTRE/templates/workspaces/base/terraform/azure-monitor/azure-monitor.tf/0 | {
"file_path": "AzureTRE/templates/workspaces/base/terraform/azure-monitor/azure-monitor.tf",
"repo_id": "AzureTRE",
"token_count": 3342
} | 134 |
variable "location" {
type = string
}
variable "tre_id" {
type = string
}
variable "address_spaces" {
type = string
}
variable "ws_resource_group_name" {
type = string
}
variable "tre_workspace_tags" {
type = map(string)
}
variable "tre_resource_id" {
type = string
}
variable "arm_environment" {
type = st... | AzureTRE/templates/workspaces/base/terraform/network/variables.tf/0 | {
"file_path": "AzureTRE/templates/workspaces/base/terraform/network/variables.tf",
"repo_id": "AzureTRE",
"token_count": 116
} | 135 |
# TRE UI
Please see the docs for a full overview and deployment instructions.
The UI was built using Create React App and Microsoft Fluent UI. Further details on this in the ./app/README.
## Run the UI
- Ensure `deploy_ui=false` is not set in your `./config.yaml` file
- In the root of the repo, run `make tre-deploy`... | AzureTRE/ui/README.md/0 | {
"file_path": "AzureTRE/ui/README.md",
"repo_id": "AzureTRE",
"token_count": 308
} | 136 |
import { IconButton, Spinner, Stack, TooltipHost } from "@fluentui/react";
import React, { useState } from "react";
import { Text } from '@fluentui/react/lib/Text';
interface CliCommandProps {
command: string,
title: string,
isLoading: boolean
}
export const CliCommand: React.FunctionComponent<CliCommandProps> ... | AzureTRE/ui/app/src/components/shared/CliCommand.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/CliCommand.tsx",
"repo_id": "AzureTRE",
"token_count": 1233
} | 137 |
import React from 'react';
import { ProgressIndicator, Stack } from '@fluentui/react';
import { ResourceContextMenu } from '../shared/ResourceContextMenu';
import { ComponentAction, Resource, ResourceUpdate } from '../../models/resource';
import { StatusBadge } from './StatusBadge';
import { PowerStateBadge } from './P... | AzureTRE/ui/app/src/components/shared/ResourceHeader.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/ResourceHeader.tsx",
"repo_id": "AzureTRE",
"token_count": 1336
} | 138 |
import { DefaultButton, DialogFooter, FontWeights, getTheme, IButtonStyles, IconButton, IIconProps, IStackItemStyles, IStackStyles, mergeStyleSets, MessageBar, MessageBarType, PrimaryButton, Shimmer, Spinner, SpinnerSize, Stack, TextField } from "@fluentui/react";
import { useCallback, useContext, useEffect, useState }... | AzureTRE/ui/app/src/components/shared/airlock/AirlockReviewRequest.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/airlock/AirlockReviewRequest.tsx",
"repo_id": "AzureTRE",
"token_count": 5620
} | 139 |
import { FontIcon, Spinner, SpinnerSize, Stack, getTheme, mergeStyles } from '@fluentui/react';
import React, { useContext, useEffect, useRef, useState } from 'react';
import { Route, Routes, useParams } from 'react-router-dom';
import { ApiEndpoint } from '../../models/apiEndpoints';
import { WorkspaceService } from '... | AzureTRE/ui/app/src/components/workspaces/WorkspaceProvider.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/workspaces/WorkspaceProvider.tsx",
"repo_id": "AzureTRE",
"token_count": 5199
} | 140 |
export enum LoadingState {
Ok = 'ok',
Error = 'error',
Loading = 'loading',
AccessDenied = "access-denied",
NotSupported = "not-supported"
}
| AzureTRE/ui/app/src/models/loadingState.ts/0 | {
"file_path": "AzureTRE/ui/app/src/models/loadingState.ts",
"repo_id": "AzureTRE",
"token_count": 61
} | 141 |
import { getTheme } from "@fluentui/react";
const { palette } = getTheme();
export const successButtonStyles = {
root: {
background: palette.green,
color: palette.white,
borderColor: palette.green
},
rootDisabled: {
background: 'rgb(16 124 16 / 60%)',
color: palette.white,
borderColor: p... | AzureTRE/ui/app/src/styles.ts/0 | {
"file_path": "AzureTRE/ui/app/src/styles.ts",
"repo_id": "AzureTRE",
"token_count": 276
} | 142 |
import sys
import json
from itertools import groupby
from turtle import title
inp_f = sys.argv[1]
out_f = sys.argv[2]
def read_pubtator(file):
file = open(file, "r")
lines = (line.strip() for line in file)
for k, g in groupby(lines, key=bool):
g = list(g)
if g[0]:
yield g
... | BioGPT/data/BC5CDR/raw/BC5CDR_Evaluation-0.0.3/data/test/rment.py/0 | {
"file_path": "BioGPT/data/BC5CDR/raw/BC5CDR_Evaluation-0.0.3/data/test/rment.py",
"repo_id": "BioGPT",
"token_count": 397
} | 143 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import sys
data_dir=sys.argv[1]
def build_target_seq(tgt):
tgt = 'the type of this document is ' + tgt + '.'
return tgt
def loader(fname, fn):
ret = []
cnt = 0
file = open(fname)
for line in file:
... | BioGPT/examples/DC-HoC/rebuild_data.py/0 | {
"file_path": "BioGPT/examples/DC-HoC/rebuild_data.py",
"repo_id": "BioGPT",
"token_count": 570
} | 144 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse
from src.transformer_lm_prompt import TransformerLanguageModelPrompt
parser = argparse.ArgumentParser()
parser.add_argument("--data_dir", type=str, default='')
parser.add_argument("--model_dir", type=str, default=None)
parser.ad... | BioGPT/inference.py/0 | {
"file_path": "BioGPT/inference.py",
"repo_id": "BioGPT",
"token_count": 559
} | 145 |
0.0.1.dev4 | BitBLAS/VERSION/0 | {
"file_path": "BitBLAS/VERSION",
"repo_id": "BitBLAS",
"token_count": 8
} | 146 |
#!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
nvidia-smi --query-gpu=memory.used --format=csv -lms 500
| BitBLAS/integration/BitNet/nvidia_measure_memory.sh/0 | {
"file_path": "BitBLAS/integration/BitNet/nvidia_measure_memory.sh",
"repo_id": "BitBLAS",
"token_count": 50
} | 147 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Analysis on TIR blocks, loops and functions."""
from typing import List, Optional, Set, Union
from typing_extensions import Literal
from tvm import ir, tir, DataType
from tvm._ffi import get_global_func
from tvm.target.target import Target
fro... | BitBLAS/python/bitblas/base/analysis.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/analysis.py",
"repo_id": "BitBLAS",
"token_count": 4460
} | 148 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from collections import OrderedDict
from typing import Dict, List
from tvm import arith
class Statement():
def __init__(self, output: str, dependent_region: dict, var_map: OrderedDict, range_map: OrderedDict):
self.output = output
... | BitBLAS/python/bitblas/base/roller/shape_inference/common.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/roller/shape_inference/common.py",
"repo_id": "BitBLAS",
"token_count": 1227
} | 149 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import tvm
from tvm.tir.function import TensorIntrin
from tvm.script import tir as T
from typing import Dict, Literal
from bitblas.quantization import (
_tir_packed_int_to_int_convert,
_tir_packed_to_signed_convert,
_tir_packed_to_unsi... | BitBLAS/python/bitblas/gpu/intrin/lop3.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/intrin/lop3.py",
"repo_id": "BitBLAS",
"token_count": 34970
} | 150 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import Literal
from tvm import DataType
from tvm import IRModule
from tvm.ir import GlobalVar
from tvm.script import tir as T
# fmt: off
# TIR interleave weight impl-> 2D implementation
def tir_interleave_weight(
N: int = 2,
... | BitBLAS/python/bitblas/ops/impl/lop3_permutate_impl.py/0 | {
"file_path": "BitBLAS/python/bitblas/ops/impl/lop3_permutate_impl.py",
"repo_id": "BitBLAS",
"token_count": 4120
} | 151 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import Optional, Tuple, Union, List, Dict
from tvm.ir import IRModule
from tvm.ir.transform import PassContext, module_pass
from tvm import relax
from tvm import tir
from enum import Enum
from tvm.ir import GlobalVar
from tvm.tir impor... | BitBLAS/python/bitblas/relax/transform/weight_only_propagate.py/0 | {
"file_path": "BitBLAS/python/bitblas/relax/transform/weight_only_propagate.py",
"repo_id": "BitBLAS",
"token_count": 8746
} | 152 |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <gtest/gtest.h>
#include <stdio.h>
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include "fast_decoding.hpp"
#define cudaCheckLastError(ans) \
{ \
gpuAssert((ans), _... | BitBLAS/testing/cpp/lop3_type_conversion/lowprecision_to_float16.cu/0 | {
"file_path": "BitBLAS/testing/cpp/lop3_type_conversion/lowprecision_to_float16.cu",
"repo_id": "BitBLAS",
"token_count": 20778
} | 153 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import bitblas
import numpy as np
from bitblas.quantization.utils import general_compress, interleave_weight
from bitblas.ops.matmul import MatmulWeightOnlyDequantize
M = 1
N = 4096
K = 1024
bitblas_matmul = MatmulWeightOnlyDequant... | BitBLAS/testing/python/weight_only/correctness/test_fp16xint4_correctness.py/0 | {
"file_path": "BitBLAS/testing/python/weight_only/correctness/test_fp16xint4_correctness.py",
"repo_id": "BitBLAS",
"token_count": 446
} | 154 |
date ; hostname ; pwd
EXP_NODES=1
EXP_IS=384
EXP_PGB=8
EXP_PGEB=32
EXP_LR=5e-6
EXP_BS=64
EXP_ME=10
EXP_WS=0.1
EXP_WD=0.008
EXP_LMH=10
EXP_LMC=5
EXP_THL=2
EXP_HHS=1.5
EXP_LP=BridgeTower_pt_base.ckpt
EXP_RGM=blip_randaug_wc
EXP_CDR=0.1
export MASTER_ADDR=$HOSTNAME
export MASTER_PORT=19800
export NODE_RANK=0
PREFIX_NAM... | BridgeTower/scripts/ftfpt_base_nlvr2.sh/0 | {
"file_path": "BridgeTower/scripts/ftfpt_base_nlvr2.sh",
"repo_id": "BridgeTower",
"token_count": 643
} | 155 |
from ..datasets import CocoCaptionKarpathyDataset
from .datamodule_base import BaseDataModule
class CocoCaptionKarpathyDataModule(BaseDataModule):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@property
def dataset_cls(self):
return CocoCaptionKarpathyDataset
... | BridgeTower/src/datamodules/coco_caption_karpathy_datamodule.py/0 | {
"file_path": "BridgeTower/src/datamodules/coco_caption_karpathy_datamodule.py",
"repo_id": "BridgeTower",
"token_count": 189
} | 156 |
from glob import glob
from .base_dataset import BaseDataset
import io
from PIL import Image
class SBUCaptionDataset(BaseDataset):
def __init__(self, *args, split="", **kwargs):
assert split in ["train", "val", "test"]
if split == "test":
split = "val"
if split == "train":
... | BridgeTower/src/datasets/sbu_caption_dataset.py/0 | {
"file_path": "BridgeTower/src/datasets/sbu_caption_dataset.py",
"repo_id": "BridgeTower",
"token_count": 253
} | 157 |
""" Swin Transformer
A PyTorch impl of : `Swin Transformer: Hierarchical Vision Transformer using Shifted Windows`
- https://arxiv.org/pdf/2103.14030
Code/weights from https://github.com/microsoft/Swin-Transformer, original copyright/license info below
"""
# --------------------------------------------------------
... | BridgeTower/src/modules/swin_transformer.py/0 | {
"file_path": "BridgeTower/src/modules/swin_transformer.py",
"repo_id": "BridgeTower",
"token_count": 12225
} | 158 |
import json
import pandas as pd
import pyarrow as pa
import random
import os
from tqdm import tqdm
from glob import glob
from collections import defaultdict
def path2rest(path, iid2captions):
name = path.split("/")[-1]
iid = int(name[:-4])
with open(path, "rb") as fp:
binary = fp.read()
cdi... | BridgeTower/src/utils/write_vg.py/0 | {
"file_path": "BridgeTower/src/utils/write_vg.py",
"repo_id": "BridgeTower",
"token_count": 923
} | 159 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import re
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
def get_nonspade_norm_layer(opt, norm_type="ins... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/normalization.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/normalization.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 1711
} | 160 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch.utils.data as data
from PIL import Image
import torchvision.transforms as transforms
import numpy as np
import random
class BaseDataset(data.Dataset):
def __init__(self):
super(BaseDataset, self).__init__()
def name... | Bringing-Old-Photos-Back-to-Life/Global/data/base_dataset.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/data/base_dataset.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 1626
} | 161 |
import tempfile
from pathlib import Path
import argparse
import shutil
import os
import glob
import cv2
import cog
from run import run_cmd
class Predictor(cog.Predictor):
def setup(self):
parser = argparse.ArgumentParser()
parser.add_argument(
"--input_folder", type=str, default="input... | Bringing-Old-Photos-Back-to-Life/predict.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/predict.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 4489
} | 162 |
import torch
import torch.nn as nn
def move_data_to_device(x, device):
if 'float' in str(x.dtype):
x = torch.Tensor(x)
elif 'int' in str(x.dtype):
x = torch.LongTensor(x)
else:
return x
return x.to(device)
def do_mixup(x, mixup_lambda):
"""Mixup x of even indexes (0, 2, ... | CLAP/msclap/models/pytorch_utils.py/0 | {
"file_path": "CLAP/msclap/models/pytorch_utils.py",
"repo_id": "CLAP",
"token_count": 2744
} | 163 |
.. fairseq documentation master file, created by
sphinx-quickstart on Fri Aug 17 21:45:30 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
:github_url: https://github.com/pytorch/fairseq
fairseq documentation
=====================
Fairseq... | COCO-LM/fairseq/docs/index.rst/0 | {
"file_path": "COCO-LM/fairseq/docs/index.rst",
"repo_id": "COCO-LM",
"token_count": 333
} | 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.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class AdaptiveMask(nn.Module):
"""Soft masking function f... | COCO-LM/fairseq/examples/adaptive_span/adaptive_span_attention.py/0 | {
"file_path": "COCO-LM/fairseq/examples/adaptive_span/adaptive_span_attention.py",
"repo_id": "COCO-LM",
"token_count": 2622
} | 165 |
# 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 os
import os.path as op
from collections import namedtuple
from multiprocessing import cpu_count
from typing import Li... | COCO-LM/fairseq/examples/byte_level_bpe/get_bitext.py/0 | {
"file_path": "COCO-LM/fairseq/examples/byte_level_bpe/get_bitext.py",
"repo_id": "COCO-LM",
"token_count": 4114
} | 166 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .laser_task import * # noqa
from .laser_lstm import * # noqa
from .laser_transformer import * # noqa
| COCO-LM/fairseq/examples/laser/laser_src/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/examples/laser/laser_src/__init__.py",
"repo_id": "COCO-LM",
"token_count": 87
} | 167 |
# Linformer: Self-Attention with Linear Complexity (Wang et al., 2020)
This example contains code to train Linformer models as described in our paper
[Linformer: Self-Attention with Linear Complexity](https://arxiv.org/abs/2006.04768).
## Training a new Linformer RoBERTa model
You can mostly follow the [RoBERTa pret... | COCO-LM/fairseq/examples/linformer/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/linformer/README.md",
"repo_id": "COCO-LM",
"token_count": 249
} | 168 |
#!/usr/bin/env 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.
SCRIPT=`realpath $0`
MECAB=`dirname $SCRIPT`/thirdparty/mecab-0.996-ko-0.9.2
export PATH=$PATH:"$MECAB/bin":"$MECAB/lib"
e... | COCO-LM/fairseq/examples/m2m_100/tokenizers/seg_ko.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/m2m_100/tokenizers/seg_ko.sh",
"repo_id": "COCO-LM",
"token_count": 153
} | 169 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import glob
import argparse
from utils.dedup import deup
import sys
WORKDIR_ROOT = os.environ.get('WORKDIR_ROOT', None)
if WORKD... | COCO-LM/fairseq/examples/multilingual/data_scripts/dedup_all.py/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/dedup_all.py",
"repo_id": "COCO-LM",
"token_count": 762
} | 170 |
grep "seg id" | sed 's/<seg id="[0-9]\+">//g' | sed 's/<\/seg>//g'
| COCO-LM/fairseq/examples/multilingual/data_scripts/utils/strip_sgm.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/utils/strip_sgm.sh",
"repo_id": "COCO-LM",
"token_count": 42
} | 171 |
#!/usr/bin/env python3 -u
import argparse
import fileinput
import logging
import os
import sys
from fairseq.models.transformer import TransformerModel
logging.getLogger().setLevel(logging.INFO)
def main():
parser = argparse.ArgumentParser(description="")
parser.add_argument("--en2fr", required=True, help=... | COCO-LM/fairseq/examples/paraphraser/paraphrase.py/0 | {
"file_path": "COCO-LM/fairseq/examples/paraphraser/paraphrase.py",
"repo_id": "COCO-LM",
"token_count": 1100
} | 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 math
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.criterions import FairseqCriterion, register_... | COCO-LM/fairseq/examples/rxf/rxf_src/sentence_prediction_r3f.py/0 | {
"file_path": "COCO-LM/fairseq/examples/rxf/rxf_src/sentence_prediction_r3f.py",
"repo_id": "COCO-LM",
"token_count": 3192
} | 173 |
# 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 sys
from scorers import build_scorer
from tornado import ioloop, web
DEFAULT_HOSTNAME = "localhost"
DEFAU... | COCO-LM/fairseq/examples/simultaneous_translation/eval/server.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/eval/server.py",
"repo_id": "COCO-LM",
"token_count": 1059
} | 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 __future__ import absolute_import, division, print_function, unicode_literals
import logging
import math
import torch
import torch.nn.f... | COCO-LM/fairseq/examples/speech_recognition/criterions/cross_entropy_acc.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/criterions/cross_entropy_acc.py",
"repo_id": "COCO-LM",
"token_count": 2351
} | 175 |
#!/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 math
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq.models import (
Fairs... | COCO-LM/fairseq/examples/speech_recognition/models/w2l_conv_glu_enc.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/models/w2l_conv_glu_enc.py",
"repo_id": "COCO-LM",
"token_count": 2915
} | 176 |
import math
import os
import json
import numpy as np
import torch
import torchaudio.compliance.kaldi as kaldi
import yaml
from fairseq import checkpoint_utils, tasks
from fairseq.file_io import PathManager
try:
from simuleval import READ_ACTION, WRITE_ACTION, DEFAULT_EOS
from simuleval.agents import SpeechAgen... | COCO-LM/fairseq/examples/speech_to_text/simultaneous_translation/agents/fairseq_simul_st_agent.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_to_text/simultaneous_translation/agents/fairseq_simul_st_agent.py",
"repo_id": "COCO-LM",
"token_count": 5691
} | 177 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from dataclasses import dataclass, field
from typing import Dict, List, Optional
import torch
from fairseq.dataclass import Fa... | COCO-LM/fairseq/examples/truncated_bptt/transformer_xl_model.py/0 | {
"file_path": "COCO-LM/fairseq/examples/truncated_bptt/transformer_xl_model.py",
"repo_id": "COCO-LM",
"token_count": 2391
} | 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 torch.nn as nn
import torch.nn.functional as F
from fairseq.data import Dictionary
from fairseq.models import (
FairseqDecoder,
... | COCO-LM/fairseq/fairseq/benchmark/dummy_model.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/benchmark/dummy_model.py",
"repo_id": "COCO-LM",
"token_count": 1569
} | 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.
import math
from dataclasses import dataclass, field
import torch
from fairseq import metrics, utils
from fairseq.criterions import FairseqCr... | COCO-LM/fairseq/fairseq/criterions/label_smoothed_cross_entropy.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/criterions/label_smoothed_cross_entropy.py",
"repo_id": "COCO-LM",
"token_count": 2932
} | 180 |
import importlib
import os
from abc import ABC, abstractmethod
from typing import Dict, Optional
class AudioFeatureTransform(ABC):
@classmethod
@abstractmethod
def from_config_dict(cls, config: Optional[Dict] = None):
pass
AUDIO_FEATURE_TRANSFORM_REGISTRY = {}
AUDIO_FEATURE_TRANSFORM_CLASS_NAMES... | COCO-LM/fairseq/fairseq/data/audio/feature_transforms/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/audio/feature_transforms/__init__.py",
"repo_id": "COCO-LM",
"token_count": 1146
} | 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.
import os
from collections import Counter
from multiprocessing import Pool
import torch
from fairseq import utils
from fairseq.binarizer impo... | COCO-LM/fairseq/fairseq/data/dictionary.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/dictionary.py",
"repo_id": "COCO-LM",
"token_count": 6848
} | 182 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq.data import encoders
def get_whole_word_mask(args, dictionary):
bpe = encoders.build_bpe(args)
if bpe is n... | COCO-LM/fairseq/fairseq/data/encoders/utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/encoders/utils.py",
"repo_id": "COCO-LM",
"token_count": 409
} | 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 logging
import time
from collections import OrderedDict
from typing import Dict, List
import numpy as np
from fairseq.data import data... | COCO-LM/fairseq/fairseq/data/multi_corpus_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/multi_corpus_dataset.py",
"repo_id": "COCO-LM",
"token_count": 3758
} | 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
from . import BaseWrapperDataset
class PrependTokenDataset(BaseWrapperDataset):
def __init__(self, dat... | COCO-LM/fairseq/fairseq/data/prepend_token_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/prepend_token_dataset.py",
"repo_id": "COCO-LM",
"token_count": 460
} | 185 |
#!/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 logging
import os
import shutil
from typing import List, Optional
logger = logging.getLogger(__file__)
try:... | COCO-LM/fairseq/fairseq/file_io.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/file_io.py",
"repo_id": "COCO-LM",
"token_count": 2581
} | 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 logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.model_parallel.model... | COCO-LM/fairseq/fairseq/model_parallel/models/pipeline_parallel_transformer/model.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/model_parallel/models/pipeline_parallel_transformer/model.py",
"repo_id": "COCO-LM",
"token_count": 16338
} | 187 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, List, Optional, Tuple
import torch.nn as nn
from fairseq import utils
from torch import Tensor
class FairseqDecode... | COCO-LM/fairseq/fairseq/models/fairseq_decoder.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/fairseq_decoder.py",
"repo_id": "COCO-LM",
"token_count": 1588
} | 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.
"""isort:skip_file"""
from .fairseq_nat_model import *
from .nonautoregressive_transformer import *
from .nat_crf_transformer import *
from .i... | COCO-LM/fairseq/fairseq/models/nat/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/nat/__init__.py",
"repo_id": "COCO-LM",
"token_count": 137
} | 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.
"""
Unsupervised Cross-lingual Representation Learning at Scale
"""
from fairseq.models import register_model
from .hub_interface import Robe... | COCO-LM/fairseq/fairseq/models/roberta/model_xlmr.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/roberta/model_xlmr.py",
"repo_id": "COCO-LM",
"token_count": 559
} | 190 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
from typing import List, Tuple
import numpy as np
import torch
import torch.nn as nn
imp... | COCO-LM/fairseq/fairseq/models/wav2vec/wav2vec2.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/wav2vec/wav2vec2.py",
"repo_id": "COCO-LM",
"token_count": 16096
} | 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.
*/
#include <torch/extension.h>
#include <vector>
std::vector<at::Tensor> dynamicconv_cuda_forward(
at::Tensor input,
at::Te... | COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/dynamicconv_cuda.cpp/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/dynamicconv_cuda.cpp",
"repo_id": "COCO-LM",
"token_count": 597
} | 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.
def gen_forward():
kernels = [3, 5, 7, 15, 31, 63, 127, 255]
seqs = [32 * x for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,... | COCO-LM/fairseq/fairseq/modules/lightconv_layer/cuda_function_gen.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/lightconv_layer/cuda_function_gen.py",
"repo_id": "COCO-LM",
"token_count": 5202
} | 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
import torch.nn as nn
import torch.nn.functional as F
class PQEmbedding(nn.Module):
"""
Quantized counterpart of nn.Emb... | COCO-LM/fairseq/fairseq/modules/quantization/pq/modules/qemb.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/quantization/pq/modules/qemb.py",
"repo_id": "COCO-LM",
"token_count": 1746
} | 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 math
import torch
from .multihead_attention import MultiheadAttention
class SparseMultiheadAttention(MultiheadAttention):
"""Sp... | COCO-LM/fairseq/fairseq/modules/sparse_multihead_attention.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/sparse_multihead_attention.py",
"repo_id": "COCO-LM",
"token_count": 2293
} | 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.
import torch
import torch.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adamax")
class FairseqAdamax(... | COCO-LM/fairseq/fairseq/optim/adamax.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/adamax.py",
"repo_id": "COCO-LM",
"token_count": 3023
} | 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.
from dataclasses import dataclass, field
from typing import Optional, List
from omegaconf import II
from fairseq.dataclass import FairseqData... | COCO-LM/fairseq/fairseq/optim/lr_scheduler/polynomial_decay_schedule.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/lr_scheduler/polynomial_decay_schedule.py",
"repo_id": "COCO-LM",
"token_count": 1430
} | 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 math
from typing import List, Optional
import torch
import torch.nn as nn
from fairseq.token_generation_constraints import (
Const... | COCO-LM/fairseq/fairseq/search.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/search.py",
"repo_id": "COCO-LM",
"token_count": 14454
} | 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 logging
import os
import numpy as np
from fairseq import utils
from fairseq.data import (
ConcatSentencesDataset,
Dictionary,
... | COCO-LM/fairseq/fairseq/tasks/sentence_ranking.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/sentence_ranking.py",
"repo_id": "COCO-LM",
"token_count": 3408
} | 199 |
#!/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.
"""
Translate pre-processed data with a trained model.
"""
import ast
import logging
import math
import os
import sy... | COCO-LM/fairseq/fairseq_cli/generate.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq_cli/generate.py",
"repo_id": "COCO-LM",
"token_count": 8440
} | 200 |
#include <torch/extension.h>
// CUDA forward declarations
std::vector<at::Tensor> softmax_xentropy_cuda(
const at::Tensor &input,
const at::Tensor &labels,
const bool half_to_float);
at::Tensor softmax_xentropy_backward_cuda(
const at::Tensor &grad_loss,
const at::Tensor &logits,
const at::Te... | COCO-LM/fairseq/fused_ops/csrc/xentropy/interface.cpp/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/csrc/xentropy/interface.cpp",
"repo_id": "COCO-LM",
"token_count": 632
} | 201 |
#!/usr/bin/env bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Path to pretrained COCO-LM checkpoints
PRETRAINED_MODEL_PATH=$1
# Path to processed SQuAD 2.0 dataset (containing pickle files) 'path/to/squad2_data'
DATA_DIR=$2
# Output path for results and fine-tuned model
OUTPUT_PATH=... | COCO-LM/fairseq/run_squad.sh/0 | {
"file_path": "COCO-LM/fairseq/run_squad.sh",
"repo_id": "COCO-LM",
"token_count": 1050
} | 202 |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
... | COCO-LM/fairseq/scripts/spm_decode.py/0 | {
"file_path": "COCO-LM/fairseq/scripts/spm_decode.py",
"repo_id": "COCO-LM",
"token_count": 601
} | 203 |
#!/usr/bin/env python3
import argparse
import os
import unittest
from inspect import currentframe, getframeinfo
import numpy as np
import torch
from examples.speech_recognition.data.data_utils import lengths_to_encoder_padding_mask
from fairseq.data import data_utils as fairseq_data_utils
from fairseq.data.dictionary... | COCO-LM/fairseq/tests/speech_recognition/asr_test_base.py/0 | {
"file_path": "COCO-LM/fairseq/tests/speech_recognition/asr_test_base.py",
"repo_id": "COCO-LM",
"token_count": 8394
} | 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 io
import tempfile
import unittest
import torch
from fairseq.data import Dictionary
class TestDictionary(unittest.TestCase):
def... | COCO-LM/fairseq/tests/test_dictionary.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_dictionary.py",
"repo_id": "COCO-LM",
"token_count": 1903
} | 205 |
import contextlib
import unittest
import tempfile
from io import StringIO
import numpy as np
from tests.test_binaries import train_language_model
from tests.utils import create_dummy_data, preprocess_lm_data
try:
from pyarrow import plasma
from fairseq.data.plasma_utils import PlasmaView, PlasmaStore
PY... | COCO-LM/fairseq/tests/test_plasma_utils.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_plasma_utils.py",
"repo_id": "COCO-LM",
"token_count": 2240
} | 206 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# The script is largely adapted from the huggingface transformers library
import os
import logging
from collections import Counter
import torch
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class Dictionary:
"""A ma... | COCO-LM/huggingface/cocolm/tokenization_utils.py/0 | {
"file_path": "COCO-LM/huggingface/cocolm/tokenization_utils.py",
"repo_id": "COCO-LM",
"token_count": 3407
} | 207 |
# ------------------------------------------
# CSWin Transformer
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# written By Xiaoyi Dong
# ------------------------------------------
import argparse
import time
import yaml
import os
import logging
from collections import OrderedDict
from conte... | CSWin-Transformer/main.py/0 | {
"file_path": "CSWin-Transformer/main.py",
"repo_id": "CSWin-Transformer",
"token_count": 16147
} | 208 |
{% extends "main.html" %}
<!-- Render hero under tabs -->
{% block tabs %}
{{ super() }}
<!-- github button -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
<style>
.md-footer-copyright {
display: none
}
.md-footer-nav__inner {
display: none
}
.md-conte... | ClimaX/docs/overrides/home.html/0 | {
"file_path": "ClimaX/docs/overrides/home.html",
"repo_id": "ClimaX",
"token_count": 4406
} | 209 |
datadir: /data/CMIP6/MPI-ESM
server_prefix: https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/CMIP
name: 10m_v_component_of_wind
cmip_name: vas
era_name: v10
output_type: 6hrPlevPt
run: r1i1p1f1
version: v20190710
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/MPI-ESM/config_10m_v_component_of_wind.yml/0 | {
"file_path": "ClimaX/snakemake_configs/MPI-ESM/config_10m_v_component_of_wind.yml",
"repo_id": "ClimaX",
"token_count": 127
} | 210 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
class GANLoss(nn.Module):
def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0,
tensor=torch.FloatTensor, opt=None):
super(GANL... | CoCosNet-v2/models/networks/loss.py/0 | {
"file_path": "CoCosNet-v2/models/networks/loss.py",
"repo_id": "CoCosNet-v2",
"token_count": 1815
} | 211 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import re
import argparse
from argparse import Namespace
import torch
import numpy as np
import importlib
from PIL import Image
def feature_normalize(feature_in, eps=1e-10):
feature_in_norm = torch.norm(feature_in, 2, 1, keepdim=... | CoCosNet-v2/util/util.py/0 | {
"file_path": "CoCosNet-v2/util/util.py",
"repo_id": "CoCosNet-v2",
"token_count": 1436
} | 212 |
"""
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 importlib
import torch.utils.data
from data.base_dataset import BaseDataset
def find_dataset_using_name(dataset_name):
# Given the ... | CoCosNet/data/__init__.py/0 | {
"file_path": "CoCosNet/data/__init__.py",
"repo_id": "CoCosNet",
"token_count": 777
} | 213 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import sys
from collections import OrderedDict, namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from util.util import feature_normalize, mse_loss
import matplotlib.pyplot as plt
i... | CoCosNet/models/networks/ContextualLoss.py/0 | {
"file_path": "CoCosNet/models/networks/ContextualLoss.py",
"repo_id": "CoCosNet",
"token_count": 7439
} | 214 |
# -*- coding: utf-8 -*-
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import gzip
import os
import json
import numpy as np
from more_itertools import chunked
DATA_DIR='../data/codesearch'
def format_str(string):
for char in ['\r\n', '\r', '\n']:
string = string.replace(char, '... | CodeBERT/CodeBERT/codesearch/process_data.py/0 | {
"file_path": "CodeBERT/CodeBERT/codesearch/process_data.py",
"repo_id": "CodeBERT",
"token_count": 941
} | 215 |
# CodeReviewer
This repo provides the code for reproducing the experiments in [CodeReviewer: Pre-Training for Automating Code Review Activities](https://arxiv.org/abs/2203.09095). **CodeReviewer** is a model pre-trained with code change and code review data to support code review tasks.
The pre-trained checkpoint of ... | CodeBERT/CodeReviewer/README.md/0 | {
"file_path": "CodeBERT/CodeReviewer/README.md",
"repo_id": "CodeBERT",
"token_count": 1736
} | 216 |
# Code Pretraining Models
This repo contains code pretraining models in the CodeBERT series from Microsoft, including six models as of June 2023.
- CodeBERT (EMNLP 2020)
- GraphCodeBERT (ICLR 2021)
- UniXcoder (ACL 2022)
- CodeReviewer (ESEC/FSE 2022)
- CodeExecutor (ACL 2023)
- LongCoder (ICML 2023)
# CodeBERT
This... | CodeBERT/README.md/0 | {
"file_path": "CodeBERT/README.md",
"repo_id": "CodeBERT",
"token_count": 2413
} | 217 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.