text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
import pytest
import pytest_asyncio
from mock import AsyncMock, patch
from azure.cosmos.aio import CosmosClient, DatabaseProxy
from api.dependencies.database import Database
from models.domain.request_action import RequestAction
from models.domain.resource import Resource
from models.domain.user_resource import UserRe... | AzureTRE/api_app/tests_ma/conftest.py/0 | {
"file_path": "AzureTRE/api_app/tests_ma/conftest.py",
"repo_id": "AzureTRE",
"token_count": 10402
} | 100 |
import random
from unittest.mock import AsyncMock
import uuid
import pytest
from mock import patch
from fastapi import status
from models.domain.resource import ResourceHistoryItem
from tests_ma.test_api.conftest import create_admin_user, create_test_user
from .test_workspaces import FAKE_CREATE_TIMESTAMP, FAKE_UPDAT... | AzureTRE/api_app/tests_ma/test_api/test_routes/test_shared_services.py/0 | {
"file_path": "AzureTRE/api_app/tests_ma/test_api/test_routes/test_shared_services.py",
"repo_id": "AzureTRE",
"token_count": 7928
} | 101 |
import pytest
import pytest_asyncio
from mock import patch
from models.domain.user_resource_template import UserResourceTemplate
from db.repositories.resource_templates import ResourceTemplateRepository
from db.errors import EntityDoesNotExist, InvalidInput
from models.domain.resource import ResourceType
from models.d... | AzureTRE/api_app/tests_ma/test_db/test_repositories/test_resource_templates_repository.py/0 | {
"file_path": "AzureTRE/api_app/tests_ma/test_db/test_repositories/test_resource_templates_repository.py",
"repo_id": "AzureTRE",
"token_count": 4827
} | 102 |
from fastapi import HTTPException, status
import pytest
import pytest_asyncio
import time
from resources import strings
from services.airlock import validate_user_allowed_to_access_storage_account, get_required_permission, \
validate_request_status, cancel_request, delete_review_user_resource, check_email_exists
fr... | AzureTRE/api_app/tests_ma/test_services/test_airlock.py/0 | {
"file_path": "AzureTRE/api_app/tests_ma/test_services/test_airlock.py",
"repo_id": "AzureTRE",
"token_count": 11025
} | 103 |
PHONY: pip-install install-cli build-package
help: ## show this help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%s\033[0m|%s\n", $$1, $$2}' \
| column -t -s '|'
pip-install: ## install required dependencides
pip install -r requirements.txt
install-cli... | AzureTRE/cli/Makefile/0 | {
"file_path": "AzureTRE/cli/Makefile",
"repo_id": "AzureTRE",
"token_count": 209
} | 104 |
import logging
import click
from tre.api_client import ApiClient
from tre.output import output, output_option, query_option
from .contexts import WorkspaceServiceTemplateContext, pass_workspace_service_template_context
from .user_resource_templates.user_resource_templates import user_resource_templates
from .user_res... | AzureTRE/cli/tre/commands/workspace_service_templates/workspace_service_template.py/0 | {
"file_path": "AzureTRE/cli/tre/commands/workspace_service_templates/workspace_service_template.py",
"repo_id": "AzureTRE",
"token_count": 694
} | 105 |
import click
from tre.commands.workspaces.contexts import WorkspaceContext
class WorkspaceServiceContext(object):
def __init__(self, workspace_id: str, workspace_service_id: str):
self.workspace_id = workspace_id
self.workspace_service_id = workspace_service_id
@staticmethod
def add_serv... | AzureTRE/cli/tre/commands/workspaces/workspace_services/contexts.py/0 | {
"file_path": "AzureTRE/cli/tre/commands/workspaces/workspace_services/contexts.py",
"repo_id": "AzureTRE",
"token_count": 461
} | 106 |
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/azure/azapi" {
version = "1.9.0"
constraints = "1.9.0"
hashes = [
"h1:zaLH2Owmj61RX2G1Cy6VDy8Ttfzx+lDsSCyiu5cXkm4=",
"zh:349569471fbf387feaaf8b88da1690669e201147c... | AzureTRE/core/terraform/.terraform.lock.hcl/0 | {
"file_path": "AzureTRE/core/terraform/.terraform.lock.hcl",
"repo_id": "AzureTRE",
"token_count": 3943
} | 107 |
terraform {
# In modules we should only specify the min version
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.8"
}
}
}
| AzureTRE/core/terraform/appgateway/main.tf/0 | {
"file_path": "AzureTRE/core/terraform/appgateway/main.tf",
"repo_id": "AzureTRE",
"token_count": 76
} | 108 |
# the zones defined in this file aren't used by the core system,
# but are a preperation for shared/workspace services deployment.
resource "azurerm_private_dns_zone" "non_core" {
for_each = local.private_dns_zone_names_non_core
name = module.terraform_azurerm_environment_configuration.pr... | AzureTRE/core/terraform/dns_zones_non_core.tf/0 | {
"file_path": "AzureTRE/core/terraform/dns_zones_non_core.tf",
"repo_id": "AzureTRE",
"token_count": 575
} | 109 |
output "core_resource_group_name" {
value = azurerm_resource_group.core.name
}
output "core_resource_group_location" {
value = azurerm_resource_group.core.location
}
output "log_analytics_name" {
value = module.azure_monitor.log_analytics_workspace_name
}
output "azure_tre_fqdn" {
value = module.appgateway.a... | AzureTRE/core/terraform/outputs.tf/0 | {
"file_path": "AzureTRE/core/terraform/outputs.tf",
"repo_id": "AzureTRE",
"token_count": 1021
} | 110 |
#!/bin/bash
set -euo pipefail
# Use this for debug only
# set -o xtrace
# AZURE_CORE_OUTPUT=jsonc # force CLI output to JSON for the script (user can still change default for interactive usage in the dev container)
function show_usage()
{
cat << USAGE
Utility script for creating an application administrator for T... | AzureTRE/devops/scripts/aad/create_application_administrator.sh/0 | {
"file_path": "AzureTRE/devops/scripts/aad/create_application_administrator.sh",
"repo_id": "AzureTRE",
"token_count": 2445
} | 111 |
#!/bin/bash
# This script is designed to be `source`d to create reusable helper functions
function construct_tre_url()
{
tre_id=$1
location=$2
azure_environment=$3
declare -A cloudapp_endpoint_suffixes=( ["AzureCloud"]="cloudapp.azure.com" ["AzureUSGovernment"]="cloudapp.usgovcloudapi.net" )
domain=${cloud... | AzureTRE/devops/scripts/construct_tre_url.sh/0 | {
"file_path": "AzureTRE/devops/scripts/construct_tre_url.sh",
"repo_id": "AzureTRE",
"token_count": 145
} | 112 |
#!/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
register_template() {
local template_dir=$1
local bundle_name
bundle_name=$(basename "$template_dir")
local bundle_type=$2
local parent_bundle=$... | AzureTRE/devops/scripts/publish_and_register_all_bundles.sh/0 | {
"file_path": "AzureTRE/devops/scripts/publish_and_register_all_bundles.sh",
"repo_id": "AzureTRE",
"token_count": 563
} | 113 |
# Introduction to Authentication and Authorization
[Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/fundamentals/whatis) is the backbone of Authentication and Authorization in the Trusted Research Environment. Microsoft Entra ID holds the identities of all the TRE/workspace users, including administrators,... | AzureTRE/docs/tre-admins/auth.md/0 | {
"file_path": "AzureTRE/docs/tre-admins/auth.md",
"repo_id": "AzureTRE",
"token_count": 1790
} | 114 |
# Installing base workspace
## Publishing and registering the base workspace bundle
Run the following in a terminal to build, publish and register the base workpace bundle:
```cmd
make workspace_bundle BUNDLE=base
```
This will prepare the template for use with your TRE.
## Creating a base workspace
Now that we h... | AzureTRE/docs/tre-admins/setup-instructions/installing-base-workspace.md/0 | {
"file_path": "AzureTRE/docs/tre-admins/setup-instructions/installing-base-workspace.md",
"repo_id": "AzureTRE",
"token_count": 790
} | 115 |
# TRE API
The TRE API is a service that users can interact with to request changes to workspaces e.g., to create, update, delete workspaces and workspace services inside each workspace.
This page is a guide for a developer looking to make a change to the API and debug it.
## Repository folder structure
```text
api_... | AzureTRE/docs/tre-developers/api.md/0 | {
"file_path": "AzureTRE/docs/tre-developers/api.md",
"repo_id": "AzureTRE",
"token_count": 2011
} | 116 |
# Guacamole User Resource Service bundle (Windows)
This is a User Resource Service template. It defines a Windows 10/Server 2019 VM to be used by TRE researchers and to be connected to using a [Guacamole server](https://guacamole.apache.org/).
It blocks all inbound and outbound traffic to the internet and allows only ... | AzureTRE/docs/tre-templates/user-resources/guacamole-windows-vm.md/0 | {
"file_path": "AzureTRE/docs/tre-templates/user-resources/guacamole-windows-vm.md",
"repo_id": "AzureTRE",
"token_count": 138
} | 117 |
# Unrestricted workspace
The unrestricted workspace template is a workspace template that allows for unrestricted access to the Internet from inside the workspace virtual network. This is useful for working on open data sets where data exfiltration is not a concern.
This workspace template builds upon the base worksp... | AzureTRE/docs/tre-templates/workspaces/unrestricted.md/0 | {
"file_path": "AzureTRE/docs/tre-templates/workspaces/unrestricted.md",
"repo_id": "AzureTRE",
"token_count": 71
} | 118 |
# Terms and Definitions
Trusted Research Environments (TRE) enforce a secure boundary around distinct workspaces to enable information governance controls to be enforced.

A Trusted Research Environment (typically one per organization, or one per department in large orga... | AzureTRE/docs/using-tre/terms-definitions.md/0 | {
"file_path": "AzureTRE/docs/using-tre/terms-definitions.md",
"repo_id": "AzureTRE",
"token_count": 1042
} | 119 |
# Maintainers
This document is targeted at maintainers of the AzureTRE project.
For information on developing and contributing to AzureTRE, see the [TRE Developers docs](https://microsoft.github.io/AzureTRE/tre-developers/)
## PR Comment bot commands
**Notes**
- these commands are not immediate - you need to wait fo... | AzureTRE/maintainers.md/0 | {
"file_path": "AzureTRE/maintainers.md",
"repo_id": "AzureTRE",
"token_count": 1094
} | 120 |
#!/bin/bash
set -e
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/'
}
VERSION=${1:-"$(get_latest_release hashicorp/terraform)"}
INSTALL_DIR=${2:-"$HOME/.local/bin"}
CMD=terraform
NAME=Terraform
echo -e "\e[34m»»» 📦 \e[32... | AzureTRE/resource_processor/scripts/terraform.sh/0 | {
"file_path": "AzureTRE/resource_processor/scripts/terraform.sh",
"repo_id": "AzureTRE",
"token_count": 347
} | 121 |
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Initialize_message_variable": {
"inputs": {
"variables": [
{
"name": "message",
"type": "strin... | AzureTRE/templates/shared_services/airlock_notifier/app/AirlockNotifier/workflow.json/0 | {
"file_path": "AzureTRE/templates/shared_services/airlock_notifier/app/AirlockNotifier/workflow.json",
"repo_id": "AzureTRE",
"token_count": 5732
} | 122 |
variable "tre_id" {
type = string
description = "Unique TRE ID"
}
variable "tre_resource_id" {
type = string
description = "Resource ID"
}
variable "tre_url" {
type = string
description = "TRE URL"
default = ""
}
variable "smtp_server_address" {
type = string
}
variable "smt... | AzureTRE/templates/shared_services/airlock_notifier/terraform/variables.tf/0 | {
"file_path": "AzureTRE/templates/shared_services/airlock_notifier/terraform/variables.tf",
"repo_id": "AzureTRE",
"token_count": 235
} | 123 |
# See https://microsoft.github.io/AzureTRE/tre-developers/letsencrypt/
resource "azurerm_storage_account" "staticweb" {
name = local.staticweb_storage_name
resource_group_name = data.azurerm_resource_group.rg.name
location = data.azurerm_resource_group... | AzureTRE/templates/shared_services/certs/terraform/staticweb.tf/0 | {
"file_path": "AzureTRE/templates/shared_services/certs/terraform/staticweb.tf",
"repo_id": "AzureTRE",
"token_count": 472
} | 124 |
variable "tre_id" {
type = string
description = "Unique TRE ID"
}
variable "tre_resource_id" {
type = string
description = "Resource ID"
}
variable "gitea_allowed_fqdns" {
type = string
description = "comma seperated string of allowed FQDNs for Gitea"
default = "github.com, www.... | AzureTRE/templates/shared_services/gitea/terraform/variables.tf/0 | {
"file_path": "AzureTRE/templates/shared_services/gitea/terraform/variables.tf",
"repo_id": "AzureTRE",
"token_count": 320
} | 125 |
{
"name": "docker",
"online": true,
"storage": {
"blobStoreName": "default",
"strictContentTypeValidation": true,
"write_policy": "ALLOW"
},
"proxy": {
"remoteUrl": "https://download.docker.com/linux/ubuntu/",
"contentMaxAge": 1440,
"metadataMaxAge": 1440
},
"negativeCa... | AzureTRE/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/docker_proxy_conf.json/0 | {
"file_path": "AzureTRE/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/docker_proxy_conf.json",
"repo_id": "AzureTRE",
"token_count": 372
} | 126 |
locals {
short_service_id = substr(var.tre_resource_id, -4, -1)
short_workspace_id = substr(var.workspace_id, -4, -1)
core_vnet = "vnet-${var.tre_id}"
core_resource_group_name = "rg-${var.tre_id}"
workspace_resource_name_suffix = "${var.tre_id}-ws-${local.s... | AzureTRE/templates/workspace_services/azureml/terraform/locals.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/azureml/terraform/locals.tf",
"repo_id": "AzureTRE",
"token_count": 533
} | 127 |
data "azurerm_resource_group" "ws" {
name = "rg-${local.workspace_resource_name_suffix}"
}
data "azurerm_virtual_network" "ws" {
name = "vnet-${local.workspace_resource_name_suffix}"
resource_group_name = data.azurerm_resource_group.ws.name
}
data "azurerm_subnet" "aml" {
name =... | AzureTRE/templates/workspace_services/azureml/user_resources/aml_compute/terraform/data.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/azureml/user_resources/aml_compute/terraform/data.tf",
"repo_id": "AzureTRE",
"token_count": 280
} | 128 |
locals {
databricks_subnets = cidrsubnets(var.address_space, 1, 1)
container_subnet_address_space = local.databricks_subnets[0] # .0 - .127
host_subnet_address_space = local.databricks_subnets[1] # .128 - .254
short_service_id = substr(var.tre_resource_id, -4, -1)
short_workspac... | AzureTRE/templates/workspace_services/databricks/terraform/locals.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/databricks/terraform/locals.tf",
"repo_id": "AzureTRE",
"token_count": 827
} | 129 |
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/azurerm" {
version = "3.22.0"
constraints = "3.22.0"
hashes = [
"h1:bxkMviG7vvNV2aPZQPall0mdIGOojsYeJvKbscPCZeM=",
"zh:03441438f73965fef3a60582573dc9137... | AzureTRE/templates/workspace_services/gitea/terraform/.terraform.lock.hcl/0 | {
"file_path": "AzureTRE/templates/workspace_services/gitea/terraform/.terraform.lock.hcl",
"repo_id": "AzureTRE",
"token_count": 2015
} | 130 |
# The OpenID extension requires multiple parameters, by setting the 'enable-environment-properties', these parameters are fetched from env vars.
# (see https://guacamole.apache.org/doc/gug/configuring-guacamole.html). The required parameters are defined here (https://guacamole.apache.org/doc/gug/openid-auth.html):
# op... | AzureTRE/templates/workspace_services/guacamole/guacamole-server/docker/guacamole/guacamole.properties/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/guacamole-server/docker/guacamole/guacamole.properties",
"repo_id": "AzureTRE",
"token_count": 216
} | 131 |
/**
*
*/
package org.apache.guacamole.auth.azuretre.connection;
| AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/test/java/org/apache/guacamole/auth/azuretre/connection/package-info.java/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/guacamole-server/guacamole-auth-azure/src/test/java/org/apache/guacamole/auth/azuretre/connection/package-info.java",
"repo_id": "AzureTRE",
"token_count": 25
} | 132 |
# Local .terraform directories
**/.terraform/*
# TF backend files
**/*_backend.tf
# Porter files it uses for local build
./cnab/**
Dockerfile.tmpl
.env*
terraform/deploy.sh
terraform/destroy.sh
| AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-export-reviewvm/.dockerignore/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-export-reviewvm/.dockerignore",
"repo_id": "AzureTRE",
"token_count": 74
} | 133 |
variable "workspace_id" {
type = string
}
variable "tre_id" {
type = string
}
variable "parent_service_id" {
type = string
}
variable "tre_resource_id" {
type = string
}
variable "image" {
type = string
}
variable "vm_size" {
type = string
}
variable "image_gallery_id" {
type = string
default = ""
}
... | AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-export-reviewvm/terraform/variables.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-export-reviewvm/terraform/variables.tf",
"repo_id": "AzureTRE",
"token_count": 139
} | 134 |
#!/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
# Get Docker Public key from Nexus
curl -fsSL "${NEXUS_PROXY_URL}"/repository/docker-public-key/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker... | AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/get_apt_keys.sh/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/get_apt_keys.sh",
"repo_id": "AzureTRE",
"token_count": 191
} | 135 |
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/azurerm" {
version = "3.57.0"
constraints = "3.57.0"
hashes = [
"h1:SOBKU/ioGnpuQpAx6dgaD0EzfAM2W+uS9e6p59viSxs=",
"zh:028202b0ae01f1262dac076b383cb68b5... | AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/terraform/.terraform.lock.hcl/0 | {
"file_path": "AzureTRE/templates/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/terraform/.terraform.lock.hcl",
"repo_id": "AzureTRE",
"token_count": 1347
} | 136 |
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/azurerm" {
version = "2.97.0"
constraints = "2.97.0"
hashes = [
"h1:XxT+XM/leTXa21aTnJjPBfNBQ8cLE4gYDg01WEZsV1U=",
"zh:0aac80e6d2b8ddf33d558ac893d52688e... | AzureTRE/templates/workspace_services/innereye/terraform/.terraform.lock.hcl/0 | {
"file_path": "AzureTRE/templates/workspace_services/innereye/terraform/.terraform.lock.hcl",
"repo_id": "AzureTRE",
"token_count": 3268
} | 137 |
resource "local_file" "mlflow_windows_config" {
content = data.template_file.mlflow_windows_config.rendered
filename = "${path.module}/../mlflow-vm-config/windows/config.ps1"
}
resource "local_file" "mlflow_linux_config" {
content = data.template_file.mlflow_linux_config.rendered
filename = "${path.module}/.... | AzureTRE/templates/workspace_services/mlflow/terraform/web_app.tf/0 | {
"file_path": "AzureTRE/templates/workspace_services/mlflow/terraform/web_app.tf",
"repo_id": "AzureTRE",
"token_count": 2677
} | 138 |
# syntax=docker/dockerfile-upstream:1.4.0
FROM --platform=linux/amd64 debian:bullseye-slim
# PORTER_INIT
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
# sqlcmd is required for schemas initialization in AzureSynapse
SHELL ["/bin/... | AzureTRE/templates/workspace_services/ohdsi/Dockerfile.tmpl/0 | {
"file_path": "AzureTRE/templates/workspace_services/ohdsi/Dockerfile.tmpl",
"repo_id": "AzureTRE",
"token_count": 512
} | 139 |
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/azurerm" {
version = "3.58.0"
constraints = "3.58.0"
hashes = [
"h1:Hvlt3hgTiip6xMeq8/EDGqF8NoVuZjYdTZdO79YNXsw=",
"zh:22b19802605ca3e2b811e33650438be36... | AzureTRE/templates/workspace_services/ohdsi/terraform/.terraform.lock.hcl/0 | {
"file_path": "AzureTRE/templates/workspace_services/ohdsi/terraform/.terraform.lock.hcl",
"repo_id": "AzureTRE",
"token_count": 2015
} | 140 |
ARM_CLIENT_ID="__CHANGE_ME__"
ARM_CLIENT_SECRET="__CHANGE_ME__"
ARM_TENANT_ID="__CHANGE_ME__"
ARM_SUBSCRIPTION_ID="__CHANGE_ME__"
AUTH_TENANT_ID="__CHANGE_ME__"
# These are passed in if Terraform will create the Workspace Microsoft Entra ID Application
REGISTER_AAD_APPLICATION=true
CREATE_AAD_GROUPS=true
AUTH_CLIENT_I... | AzureTRE/templates/workspaces/airlock-import-review/.env.sample/0 | {
"file_path": "AzureTRE/templates/workspaces/airlock-import-review/.env.sample",
"repo_id": "AzureTRE",
"token_count": 443
} | 141 |
terraform {
# In modules we should only specify the min version
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.8.0"
}
azuread = {
source = "hashicorp/azuread"
version = ">= 2.20"
}
random = {
source = "hashicorp/random"
versio... | AzureTRE/templates/workspaces/base/terraform/aad/providers.tf/0 | {
"file_path": "AzureTRE/templates/workspaces/base/terraform/aad/providers.tf",
"repo_id": "AzureTRE",
"token_count": 170
} | 142 |
resource "azurerm_resource_group" "ws" {
location = var.location
name = "rg-${local.workspace_resource_name_suffix}"
tags = merge(
local.tre_workspace_tags,
{
project = "Azure Trusted Research Environment",
source = "https://github.com/microsoft/AzureTRE/"
},
)
lifecycle { ignore... | AzureTRE/templates/workspaces/base/terraform/workspace.tf/0 | {
"file_path": "AzureTRE/templates/workspaces/base/terraform/workspace.tf",
"repo_id": "AzureTRE",
"token_count": 1661
} | 143 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="//static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000... | AzureTRE/ui/app/public/index.html/0 | {
"file_path": "AzureTRE/ui/app/public/index.html",
"repo_id": "AzureTRE",
"token_count": 606
} | 144 |
import { Stack, Shimmer, TooltipHost, Icon } from "@fluentui/react";
import { useContext, useEffect, useState } from "react";
import { CostsContext } from "../../contexts/CostsContext";
import { LoadingState } from "../../models/loadingState";
import { WorkspaceContext } from "../../contexts/WorkspaceContext";
import {... | AzureTRE/ui/app/src/components/shared/CostsTag.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/CostsTag.tsx",
"repo_id": "AzureTRE",
"token_count": 1098
} | 145 |
import { DefaultPalette, IStackItemStyles, IStackStyles, Stack } from "@fluentui/react";
import moment from "moment";
import React from "react";
import { Resource } from "../../models/resource";
import { ComplexPropertyModal } from "./ComplexItemDisplay";
interface ResourcePropertyPanelProps {
resource: Resource
}
... | AzureTRE/ui/app/src/components/shared/ResourcePropertyPanel.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/ResourcePropertyPanel.tsx",
"repo_id": "AzureTRE",
"token_count": 1290
} | 146 |
import { Callout, DirectionalHint, FontWeights, Icon, Link, mergeStyleSets, MessageBar, MessageBarType, Panel, ProgressIndicator, Text } from '@fluentui/react';
import React, { useEffect, useState } from 'react';
import { completedStates, inProgressStates, Operation, successStates } from '../../../models/operation';
im... | AzureTRE/ui/app/src/components/shared/notifications/NotificationPanel.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/notifications/NotificationPanel.tsx",
"repo_id": "AzureTRE",
"token_count": 2218
} | 147 |
import React from "react";
import { CreateFormResource } from "../models/resourceType";
export const CreateUpdateResourceContext = React.createContext({
openCreateForm: (createFormResource: CreateFormResource) => { }
});
| AzureTRE/ui/app/src/contexts/CreateUpdateResourceContext.ts/0 | {
"file_path": "AzureTRE/ui/app/src/contexts/CreateUpdateResourceContext.ts",
"repo_id": "AzureTRE",
"token_count": 56
} | 148 |
import { Resource } from "./resource";
export interface SharedService extends Resource {
} | AzureTRE/ui/app/src/models/sharedService.ts/0 | {
"file_path": "AzureTRE/ui/app/src/models/sharedService.ts",
"repo_id": "AzureTRE",
"token_count": 20
} | 149 |
{
"chemical2id": {
"naloxone": "D009270",
"clonidine": "D003000",
"nalozone": "-1",
"alpha-methyldopa": "D008750",
"[3h]-naloxone": "-1",
"[3h]-dihydroergocryptine": "-1",
"lidocaine": "D008012",
"suxamethonium": "D013390",
"suxamethonium chlor... | BioGPT/data/BC5CDR/raw/train.entities.json/0 | {
"file_path": "BioGPT/data/BC5CDR/raw/train.entities.json",
"repo_id": "BioGPT",
"token_count": 48619
} | 150 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import sys
import re
out_file = sys.argv[1]
prefix = [
'(learned[0-9]+ )+',
'we can conclude that',
'we have that',
'in conclusion,',
]
def strip_prefix(line):
for p in prefix:
res = re.search(p, line)
... | BioGPT/examples/QA-PubMedQA/postprocess.py/0 | {
"file_path": "BioGPT/examples/QA-PubMedQA/postprocess.py",
"repo_id": "BioGPT",
"token_count": 645
} | 151 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
SAVE_DIR=../../checkpoints/RE-DDI-BioGPT
mkdir -p ${SAVE_DIR}
fairseq-train \
../../data/DDI/relis-bin --save-dir ${SAVE_DIR} \
--user-dir ../../src \
--finetune-from-model ../../checkpoints/Pre-trained-BioGPT/checkpoint.pt \
--t... | BioGPT/examples/RE-DDI/train.sh/0 | {
"file_path": "BioGPT/examples/RE-DDI/train.sh",
"repo_id": "BioGPT",
"token_count": 362
} | 152 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import logging
import os
from dataclasses import dataclass, field
from typing import Optional
import torch
from fairseq import search, utils
from fairseq.data import (
Dictionary,
data_utils,
indexed_dataset,
)
from fairseq.tasks im... | BioGPT/src/language_modeling_prompt.py/0 | {
"file_path": "BioGPT/src/language_modeling_prompt.py",
"repo_id": "BioGPT",
"token_count": 6301
} | 153 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import bitblas
from bitblas.base.roller.policy import TensorCorePolicy, DefaultPolicy
from bitblas.base.roller.arch import CUDA
from bitblas.gpu.matmul_analysis import get_tensorized_func_and_tags
from bitblas.gpu import Matmul
from bitblas.utils ... | BitBLAS/benchmark/dsl/matmul_dequantize_int1.py/0 | {
"file_path": "BitBLAS/benchmark/dsl/matmul_dequantize_int1.py",
"repo_id": "BitBLAS",
"token_count": 4475
} | 154 |
Please checkout https://github.com/LeiWang1999/AutoGPTQ for details currently. The relative pull request to the official AutoGPTQ is still under construction.
| BitBLAS/integration/AutoGPTQ/README.md/0 | {
"file_path": "BitBLAS/integration/AutoGPTQ/README.md",
"repo_id": "BitBLAS",
"token_count": 39
} | 155 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from string import Template
import os
import tvm
from tvm import IRModule
from tvm.target import Target
from bitblas.utils import match_global_kernel, auto_detect_nvidia_target
from bitblas.base.analysis import get_reduction_blocks
from bitblas.o... | BitBLAS/integration/bitdistiller/kernel_generator_dynzeros.py/0 | {
"file_path": "BitBLAS/integration/bitdistiller/kernel_generator_dynzeros.py",
"repo_id": "BitBLAS",
"token_count": 2997
} | 156 |
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
echo "Add MIT liscense boilerplate..."
PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# TO source code root
pushd "${PWD}/../../" > /dev/null
EXITCODE=0
for SRC_FILE in $(find . -path './3rdparty' -prune -false -o -path '.... | BitBLAS/maint/scripts/apply_mit_license.sh/0 | {
"file_path": "BitBLAS/maint/scripts/apply_mit_license.sh",
"repo_id": "BitBLAS",
"token_count": 957
} | 157 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import tvm
from tvm.target import Target
from .arch_base import TileDevice
from typing import List, Dict
def check_sm_version(arch: str) -> int:
sm_version = arch.replace("sm_", "")
return int(sm_version) if sm_version.isdigit() else -1... | BitBLAS/python/bitblas/base/roller/arch/cuda.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/roller/arch/cuda.py",
"repo_id": "BitBLAS",
"token_count": 1010
} | 158 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import bitblas
from bitblas.ops.operator import OperatorConfig, Operator
from dataclasses import asdict
import os
import json
import tempfile
from hashlib import sha256
import shutil
import tvm
from tvm.contrib.tar import tar
import logging
logge... | BitBLAS/python/bitblas/cache/operator.py/0 | {
"file_path": "BitBLAS/python/bitblas/cache/operator.py",
"repo_id": "BitBLAS",
"token_count": 3124
} | 159 |
# 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/reduction.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/reduction.py",
"repo_id": "BitBLAS",
"token_count": 5814
} | 160 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import tvm
import numpy as np
from tvm.target import Target
from bitblas.utils.tensor_adapter import tvm_tensor_to_torch
from typing import List, Union, Optional, Any, Tuple
from .operator import Operator, TransformKind
from .impl.matmul_impl impo... | BitBLAS/python/bitblas/ops/matmul.py/0 | {
"file_path": "BitBLAS/python/bitblas/ops/matmul.py",
"repo_id": "BitBLAS",
"token_count": 4463
} | 161 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from .general import CUDASourceWrapper, CUDASourceWrapperWithDynamic # noqa: F401
| BitBLAS/python/bitblas/wrapper/__init__.py/0 | {
"file_path": "BitBLAS/python/bitblas/wrapper/__init__.py",
"repo_id": "BitBLAS",
"token_count": 45
} | 162 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import pytest
import bitblas
from bitblas import MatmulConfig, Matmul
import logging
from bitblas import set_log_level
set_log_level(logging.DEBUG)
def get_codegen_result(ops):
code = ops.get_source()
return code
# fmt: off
@pytest.ma... | BitBLAS/testing/python/operators/test_general_matmul_ops.py/0 | {
"file_path": "BitBLAS/testing/python/operators/test_general_matmul_ops.py",
"repo_id": "BitBLAS",
"token_count": 5477
} | 163 |
from ..datasets import SBUCaptionDataset
from .datamodule_base import BaseDataModule
class SBUCaptionDataModule(BaseDataModule):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@property
def dataset_cls(self):
return SBUCaptionDataset
@property
def dataset_... | BridgeTower/src/datamodules/sbu_datamodule.py/0 | {
"file_path": "BridgeTower/src/datamodules/sbu_datamodule.py",
"repo_id": "BridgeTower",
"token_count": 143
} | 164 |
from .meter_module import METERTransformerSS
from .bt_module import BTTransformer
| BridgeTower/src/modules/__init__.py/0 | {
"file_path": "BridgeTower/src/modules/__init__.py",
"repo_id": "BridgeTower",
"token_count": 22
} | 165 |
from torchvision import transforms
from PIL import Image
class MinMaxResize:
def __init__(self, shorter=800, longer=1333):
self.min = shorter
self.max = longer
def __call__(self, x):
w, h = x.size
scale = self.min / min(w, h)
if h < w:
newh, neww = self.min... | BridgeTower/src/transforms/utils.py/0 | {
"file_path": "BridgeTower/src/transforms/utils.py",
"repo_id": "BridgeTower",
"token_count": 843
} | 166 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from data.pix2pix_dataset import Pix2pixDataset
from data.image_folder import make_dataset
class CustomDataset(Pix2pixDataset):
""" Dataset that loads images from directories
Use option --label_dir, --image_dir, --instance_dir to sp... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/data/custom_dataset.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/data/custom_dataset.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 894
} | 167 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from collections import OrderedDict
import data
from options.test_options import TestOptions
from models.pix2pix_model import Pix2PixModel
from util.visualizer import Visualizer
import torchvision.utils as vutils
import warnings
warnin... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/test_face.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/test_face.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 399
} | 168 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from collections import OrderedDict
from torch.autograd import Variable
from options.test_options import TestOptions
from models.models import create_model
from models.mapping_model import Pix2PixHDModel_Mapping
import util.util as util... | Bringing-Old-Photos-Back-to-Life/Global/test.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/test.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 2865
} | 169 |
from .CLAPWrapper import CLAPWrapper as CLAP | CLAP/msclap/__init__.py/0 | {
"file_path": "CLAP/msclap/__init__.py",
"repo_id": "CLAP",
"token_count": 14
} | 170 |
.wy-table-responsive table td kbd {
white-space: nowrap;
}
.wy-table-responsive table td {
white-space: normal !important;
}
.wy-table-responsive {
overflow: visible !important;
}
| COCO-LM/fairseq/docs/_static/theme_overrides.css/0 | {
"file_path": "COCO-LM/fairseq/docs/_static/theme_overrides.css",
"repo_id": "COCO-LM",
"token_count": 69
} | 171 |
Overview
========
Fairseq can be extended through user-supplied `plug-ins
<https://en.wikipedia.org/wiki/Plug-in_(computing)>`_. We support five kinds of
plug-ins:
- :ref:`Models` define the neural network architecture and encapsulate all of the
learnable parameters.
- :ref:`Criterions` compute the loss function gi... | COCO-LM/fairseq/docs/overview.rst/0 | {
"file_path": "COCO-LM/fairseq/docs/overview.rst",
"repo_id": "COCO-LM",
"token_count": 859
} | 172 |
#!/usr/bin/env python
# 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
from tqdm import tqdm
def main():
parser = argparse.ArgumentParser(
desc... | COCO-LM/fairseq/examples/backtranslation/extract_bt_data.py/0 | {
"file_path": "COCO-LM/fairseq/examples/backtranslation/extract_bt_data.py",
"repo_id": "COCO-LM",
"token_count": 1172
} | 173 |
#!/usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import sacremoses
def main(args):
"""Tokenizes, preserving tabs"""
mt = sacremoses.MosesTokeniz... | COCO-LM/fairseq/examples/constrained_decoding/tok.py/0 | {
"file_path": "COCO-LM/fairseq/examples/constrained_decoding/tok.py",
"repo_id": "COCO-LM",
"token_count": 313
} | 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 fairseq.tasks.translation import TranslationTask
from fairseq.tasks.language_modeling import LanguageModelingTask
from fairseq import che... | COCO-LM/fairseq/examples/fast_noisy_channel/noisy_channel_translation.py/0 | {
"file_path": "COCO-LM/fairseq/examples/fast_noisy_channel/noisy_channel_translation.py",
"repo_id": "COCO-LM",
"token_count": 3284
} | 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 multilingual_translation_latent_depth # noqa
from .loss import latent_depth # noqa
from .models import latent_multilingual_tra... | COCO-LM/fairseq/examples/latent_depth/latent_depth_src/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/examples/latent_depth/latent_depth_src/__init__.py",
"repo_id": "COCO-LM",
"token_count": 103
} | 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 torch
from fairseq import utils
from fairseq.modules import TransformerEncoderLayer
from .multihead_linear_attention import MultiheadL... | COCO-LM/fairseq/examples/linformer/linformer_src/modules/linformer_sentence_encoder_layer.py/0 | {
"file_path": "COCO-LM/fairseq/examples/linformer/linformer_src/modules/linformer_sentence_encoder_layer.py",
"repo_id": "COCO-LM",
"token_count": 1213
} | 177 |
# MBART: Multilingual Denoising Pre-training for Neural Machine Translation
[https://arxiv.org/abs/2001.08210]
## Introduction
MBART is a sequence-to-sequence denoising auto-encoder pre-trained on large-scale monolingual corpora in many languages using the BART objective. mBART is one of the first methods for pre-tra... | COCO-LM/fairseq/examples/mbart/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/mbart/README.md",
"repo_id": "COCO-LM",
"token_count": 1979
} | 178 |
#!/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_lotus.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/download_lotus.sh",
"repo_id": "COCO-LM",
"token_count": 932
} | 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 multiprocessing import Pool
import numpy as np
from fairseq import options
from fairseq.data import dictionary
from fairseq.... | COCO-LM/fairseq/examples/noisychannel/rerank.py/0 | {
"file_path": "COCO-LM/fairseq/examples/noisychannel/rerank.py",
"repo_id": "COCO-LM",
"token_count": 7934
} | 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.
import argparse
import re
import sys
class OOVIndexError(IndexError):
def __init__(self, pos, source_seq, target_... | COCO-LM/fairseq/examples/pointer_generator/postprocess.py/0 | {
"file_path": "COCO-LM/fairseq/examples/pointer_generator/postprocess.py",
"repo_id": "COCO-LM",
"token_count": 1401
} | 181 |
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# data should be downloaded and processed with reprocess_RACE.py
if [[ $# -ne 2 ]]; then
echo "Run as following:"
echo "./exa... | COCO-LM/fairseq/examples/roberta/preprocess_RACE.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/roberta/preprocess_RACE.sh",
"repo_id": "COCO-LM",
"token_count": 932
} | 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 time
from functools import partial
from multiprocessing.pool import ThreadPool as Pool
from . import DEFAULT_EOS, GET, SEND
class Ag... | COCO-LM/fairseq/examples/simultaneous_translation/eval/agents/agent.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/eval/agents/agent.py",
"repo_id": "COCO-LM",
"token_count": 907
} | 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 as nn
import torch.nn.functional as F
from examples.simultaneous_translation.utils.functions import... | COCO-LM/fairseq/examples/simultaneous_translation/modules/monotonic_multihead_attention.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/modules/monotonic_multihead_attention.py",
"repo_id": "COCO-LM",
"token_count": 11073
} | 184 |
#!/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.
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import concurrent.f... | COCO-LM/fairseq/examples/speech_recognition/datasets/asr_prep_json.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/datasets/asr_prep_json.py",
"repo_id": "COCO-LM",
"token_count": 1667
} | 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 csv
from pathlib import Path
import zipfile
from functools import reduce
from multiprocessing import cpu_count
f... | COCO-LM/fairseq/examples/speech_to_text/data_utils.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_to_text/data_utils.py",
"repo_id": "COCO-LM",
"token_count": 5149
} | 186 |
#!/bin/bash
# Adapted from https://github.com/facebookresearch/MIXER/blob/master/prepareData.sh
echo 'Cloning Moses github repository (for tokenization scripts)...'
git clone https://github.com/moses-smt/mosesdecoder.git
echo 'Cloning Subword NMT repository (for BPE pre-processing)...'
git clone https://github.com/rs... | COCO-LM/fairseq/examples/translation/prepare-wmt14en2de.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/translation/prepare-wmt14en2de.sh",
"repo_id": "COCO-LM",
"token_count": 1897
} | 187 |
# wav2vec 2.0
wav2vec 2.0 learns speech representations on unlabeled data as described in [wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations (Baevski et al., 2020)](https://arxiv.org/abs/2006.11477).
We learned speech representations in multiple languages as well in [Unsupervised Cross-l... | COCO-LM/fairseq/examples/wav2vec/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/wav2vec/README.md",
"repo_id": "COCO-LM",
"token_count": 6946
} | 188 |
#!/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.
"""
Helper script to pre-compute embeddings for a flashlight (previously called wav2letter++) dataset
"""
import argpa... | COCO-LM/fairseq/examples/wav2vec/vq-wav2vec_featurize.py/0 | {
"file_path": "COCO-LM/fairseq/examples/wav2vec/vq-wav2vec_featurize.py",
"repo_id": "COCO-LM",
"token_count": 3859
} | 189 |
/**
* 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 <map>
#include <array>
#include <cstring>
#include <cstdio>
typedef struct
{
size_t reflen;
size_t pre... | COCO-LM/fairseq/fairseq/clib/libbleu/libbleu.cpp/0 | {
"file_path": "COCO-LM/fairseq/fairseq/clib/libbleu/libbleu.cpp",
"repo_id": "COCO-LM",
"token_count": 1312
} | 190 |
# @package _group_
activation_fn: "relu"
dropout: 0.3
attention_dropout: 0.1
activation_dropout: 0.1
relu_dropout: 0.1
decoder_embed_dim: 1024
decoder_output_dim: 1024
decoder_input_dim: 1024
decoder_ffn_embed_dim: 4096
decoder_layers: 16
decoder_attention_heads: 8
decoder_normalize_before: true
no_decoder_final_norm: ... | COCO-LM/fairseq/fairseq/config/model/transformer_lm/transformer_lm_wiki103.yaml/0 | {
"file_path": "COCO-LM/fairseq/fairseq/config/model/transformer_lm/transformer_lm_wiki103.yaml",
"repo_id": "COCO-LM",
"token_count": 403
} | 191 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, ... | COCO-LM/fairseq/fairseq/criterions/nat_loss.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/criterions/nat_loss.py",
"repo_id": "COCO-LM",
"token_count": 3101
} | 192 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq import utils
from . import FairseqDataset
def backtranslate_samples(samples, collate_fn, generate_fn, cuda=True):... | COCO-LM/fairseq/fairseq/data/backtranslation_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/backtranslation_dataset.py",
"repo_id": "COCO-LM",
"token_count": 2472
} | 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.
from dataclasses import dataclass, field
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
from fairseq.dataclass... | COCO-LM/fairseq/fairseq/data/encoders/fastbpe.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/encoders/fastbpe.py",
"repo_id": "COCO-LM",
"token_count": 467
} | 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 logging
import numpy as np
import torch
from fairseq.data import FairseqDataset, data_utils
logger = logging.getLogger(__name__)
d... | COCO-LM/fairseq/fairseq/data/language_pair_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/language_pair_dataset.py",
"repo_id": "COCO-LM",
"token_count": 9079
} | 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 hashlib
import logging
import math
import numpy as np
from fairseq.data import SampledMultiDataset
from .sampled_multi_dataset import... | COCO-LM/fairseq/fairseq/data/multilingual/sampled_multi_epoch_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/multilingual/sampled_multi_epoch_dataset.py",
"repo_id": "COCO-LM",
"token_count": 3554
} | 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 numpy as np
from fairseq.data import data_utils
from . import BaseWrapperDataset
class TruncateDataset(BaseWrapperDataset):
"""T... | COCO-LM/fairseq/fairseq/data/shorten_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/shorten_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1016
} | 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.
from enum import Enum, EnumMeta
from typing import List
class StrEnumMeta(EnumMeta):
# this is workaround for submitit pickling leading ... | COCO-LM/fairseq/fairseq/dataclass/constants.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/dataclass/constants.py",
"repo_id": "COCO-LM",
"token_count": 648
} | 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 bisect
import time
from collections import OrderedDict
from typing import Dict, Optional
try:
import torch
def type_as(a, b)... | COCO-LM/fairseq/fairseq/logging/meters.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/logging/meters.py",
"repo_id": "COCO-LM",
"token_count": 3631
} | 199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.