text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
import React from 'react';
import { IContextualMenuProps, Persona, PersonaSize, PrimaryButton } from '@fluentui/react';
import { useAccount, useMsal } from '@azure/msal-react';
export const UserMenu: React.FunctionComponent = () => {
const { instance, accounts } = useMsal();
const account = useAccount(accounts[0] ... | AzureTRE/ui/app/src/components/shared/UserMenu.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/shared/UserMenu.tsx",
"repo_id": "AzureTRE",
"token_count": 417
} | 141 |
import React, { useContext, useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { ApiEndpoint } from '../../models/apiEndpoints';
import { useAuthApiCall, HttpMethod } from '../../hooks/useAuthApiCall';
import { UserResource } from '../../models/userResource';
import { ... | AzureTRE/ui/app/src/components/workspaces/UserResourceItem.tsx/0 | {
"file_path": "AzureTRE/ui/app/src/components/workspaces/UserResourceItem.tsx",
"repo_id": "AzureTRE",
"token_count": 838
} | 142 |
import { User } from "./user";
export interface AirlockRequest {
id: string;
resourceVersion: number;
createdBy: User;
createdWhen: number;
updatedBy: User;
updatedWhen: number;
history: Array<AirlockRequestHistoryItem>;
workspaceId: string;
type: AirlockRequestType;
files: Array<{name: string, siz... | AzureTRE/ui/app/src/models/airlock.ts/0 | {
"file_path": "AzureTRE/ui/app/src/models/airlock.ts",
"repo_id": "AzureTRE",
"token_count": 592
} | 143 |
/// <reference types="react-scripts" />
| AzureTRE/ui/app/src/react-app-env.d.ts/0 | {
"file_path": "AzureTRE/ui/app/src/react-app-env.d.ts",
"repo_id": "AzureTRE",
"token_count": 11
} | 144 |
# coding: utf-8
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from ast import Global
import os
import sys
from sklearn.metrics import f1_score
from sklearn.preprocessing import MultiLabelBinarizer
pred_file = sys.argv[1]
gold_file = sys.argv[2]
def convert_hoc_labels(lines):
labels = ... | BioGPT/examples/DC-HoC/hard_match_evaluation.py/0 | {
"file_path": "BioGPT/examples/DC-HoC/hard_match_evaluation.py",
"repo_id": "BioGPT",
"token_count": 585
} | 145 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import sys
import re
import json
out_file = sys.argv[1]
entity_file=sys.argv[2]
pmids_file = sys.argv[3]
prefix = [
'(learned[0-9]+ )+',
'in conclusion ,',
'we can conclude that',
'we have that',
]
def strip_pre... | BioGPT/examples/RE-BC5CDR/postprocess.py/0 | {
"file_path": "BioGPT/examples/RE-BC5CDR/postprocess.py",
"repo_id": "BioGPT",
"token_count": 1034
} | 146 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import sys
import json
import re
data_dir=sys.argv[1]
def map_relation_to_verb(relation):
special_mapping = {
"product of": "is the product of",
"negative modulator": "negatively modulates",
"other/unknown"... | BioGPT/examples/RE-DTI/rebuild_data.py/0 | {
"file_path": "BioGPT/examples/RE-DTI/rebuild_data.py",
"repo_id": "BioGPT",
"token_count": 2091
} | 147 |
## Matmul
`Matmul` is an operator class that performs matrix multiplication, supporting various optimizations and quantization strategies.
### MatmulConfig:
`MatmulConfig` is a configuration class for the `Matmul` operator, specifying the matrix multiplication operation's parameters and behaviors.
### Parameters:
... | BitBLAS/docs/PythonAPI.md/0 | {
"file_path": "BitBLAS/docs/PythonAPI.md",
"repo_id": "BitBLAS",
"token_count": 3821
} | 148 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse
import torch
from modeling_bitnet import BitnetForCausalLM
torch.set_grad_enabled(False)
parser = argparse.ArgumentParser()
parser.add_argument('--hf_path', default='1bitLLM/bitnet_b1_58-3B', type=str)
def profile(model, input... | BitBLAS/integration/BitNet/eval_gpu_memory.py/0 | {
"file_path": "BitBLAS/integration/BitNet/eval_gpu_memory.py",
"repo_id": "BitBLAS",
"token_count": 652
} | 149 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Policy for cuda core schedule"""
import functools
import math
from queue import PriorityQueue
from typing import Iterable, Dict, List, Optional
import numpy as np
import tvm
from ..arch import TileDevice
from ..bestfit import BestFit
from ..h... | BitBLAS/python/bitblas/base/roller/policy/default.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/roller/policy/default.py",
"repo_id": "BitBLAS",
"token_count": 13708
} | 150 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# 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
# reg... | BitBLAS/python/bitblas/gpu/gemv.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/gemv.py",
"repo_id": "BitBLAS",
"token_count": 15458
} | 151 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import tvm
from tvm.target import Target
import operator
from functools import reduce
from bitblas.base.roller.arch.cuda import CUDA
from typing import Any, List, Literal, Optional, Tuple, Union
from .operator import Operator, TransformKind
from .... | BitBLAS/python/bitblas/ops/general_matmul.py/0 | {
"file_path": "BitBLAS/python/bitblas/ops/general_matmul.py",
"repo_id": "BitBLAS",
"token_count": 9731
} | 152 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import numpy as np
import torch
import torch.nn as nn
def gen_quant4(k, n, groupsize=-1):
maxq = 2**4
w = torch.randn((k, n), dtype=torch.half, device="cpu")
original_w = w.clone()
if groupsize == -1:
groupsize = k
... | BitBLAS/python/bitblas/quantization/utils.py/0 | {
"file_path": "BitBLAS/python/bitblas/quantization/utils.py",
"repo_id": "BitBLAS",
"token_count": 1799
} | 153 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from tvm.script import ir as I
from tvm.script import tir as T
from tvm.script import relax as R
import tvm
import tvm.testing
from tvm import relax
from tvm.script import ir as I, relax as R, tir as T
from tvm import tir
from tvm.ir import IRMod... | BitBLAS/testing/python/transform/test_weight_only_transform.py/0 | {
"file_path": "BitBLAS/testing/python/transform/test_weight_only_transform.py",
"repo_id": "BitBLAS",
"token_count": 8023
} | 154 |
# Based on https://pytorch-lightning.readthedocs.io/en/stable/notebooks/lightning_examples/text-transformers.html
import copy
import os
from datetime import datetime
from typing import Optional
from pytorch_lightning.loggers import WandbLogger
import datasets
import torch
import pytorch_lightning as pl
from pytorch_li... | BridgeTower/run_glue.py/0 | {
"file_path": "BridgeTower/run_glue.py",
"repo_id": "BridgeTower",
"token_count": 6891
} | 155 |
#!/bin/bash
# General
## root dir, you can change it to your specified dir, but remember to change the path in the following script, root_dir in the config.py and src/utils/write_xxx.py
sudo mkdir -p ~/BT
sudo chmod -R 777 ~/BT
cd ~/BT
## plugins
sudo apt-get install software-properties-common tmux net-tools
# Bridge... | BridgeTower/setup.sh/0 | {
"file_path": "BridgeTower/setup.sh",
"repo_id": "BridgeTower",
"token_count": 1045
} | 156 |
from .base_dataset import BaseDataset
import io
from PIL import Image
class CocoCaptionKarpathyDataset(BaseDataset):
def __init__(self, *args, split="", **kwargs):
assert split in ["train", "val", "test"]
self.split = split
if split == "train":
names = ["coco_caption_karpathy_t... | BridgeTower/src/datasets/coco_caption_karpathy_dataset.py/0 | {
"file_path": "BridgeTower/src/datasets/coco_caption_karpathy_dataset.py",
"repo_id": "BridgeTower",
"token_count": 481
} | 157 |
import torch
import torch.nn as nn
import pytorch_lightning as pl
import torch.nn.functional as F
from .bert_model import BertConfig, BertModel, BertCrossLayer
from . import swin_transformer as swin
from . import vit_model as vit
from .vit_model import resize_pos_embed
from . import heads, objectives, meter_utils
from ... | BridgeTower/src/modules/meter_module.py/0 | {
"file_path": "BridgeTower/src/modules/meter_module.py",
"repo_id": "BridgeTower",
"token_count": 12305
} | 158 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torch.nn.utils.spectral_norm as spectral_norm
from models.networks.normalization import SPADE
# ResNet block that uses SPADE.
# It differs from the Res... | Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/architecture.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/architecture.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 2928
} | 159 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import struct
from PIL import Image
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
]
def is_image_file(filename):
return any(filename.endswith(extension) for extension... | Bringing-Old-Photos-Back-to-Life/Global/data/Create_Bigfile.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/data/Create_Bigfile.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 924
} | 160 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import torch
import sys
class BaseModel(torch.nn.Module):
def name(self):
return "BaseModel"
def initialize(self, opt):
self.opt = opt
self.gpu_ids = opt.gpu_ids
self.isTrain = opt.isTrain
... | Bringing-Old-Photos-Back-to-Life/Global/models/base_model.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/models/base_model.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 2124
} | 161 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import numpy as np
import os
import torch.nn as nn
# Converts a Tensor into a Numpy array
# |imtype|: the desired type of the converted numpy array
def t... | Bringing-Old-Photos-Back-to-Life/Global/util/util.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/util/util.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 790
} | 162 |
###### [Overview](#CLAP) | [Setup](#Setup) | [CLAP weights](#CLAP-weights) | [Usage](#Usage) | [Examples](#Examples) | [Citation](#Citation)
# CLAP
CLAP (Contrastive Language-Audio Pretraining) is a model that learns acoustic concepts from natural language supervision and enables “Zero-Shot” inference. The model has ... | CLAP/README.md/0 | {
"file_path": "CLAP/README.md",
"repo_id": "CLAP",
"token_count": 1399
} | 163 |
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from transformers import AutoModel
from .audio import get_audio_encoder
class Projection(nn.Module):
def __init__(self, d_in: int, d_out: int, p: float=0.5) -> None:
super().__init__()
self.linear1 = nn.Linear(d_in... | CLAP/msclap/models/clap.py/0 | {
"file_path": "CLAP/msclap/models/clap.py",
"repo_id": "CLAP",
"token_count": 1937
} | 164 |
# BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
[https://arxiv.org/abs/1910.13461](https://arxiv.org/abs/1910.13461)
## Introduction
BART is sequence-to-sequence model trained with denoising as pretraining objective. We show that this pretraining ob... | COCO-LM/fairseq/examples/bart/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/bart/README.md",
"repo_id": "COCO-LM",
"token_count": 3401
} | 165 |
#!/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.
#
source_lang=kk_KZ
target_lang=en_XX
MODEL=criss_checkpoints/criss.3rd.pt
SPM=criss_checkpoints/sentence.bpe.mo... | COCO-LM/fairseq/examples/criss/mining/mine_example.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/criss/mining/mine_example.sh",
"repo_id": "COCO-LM",
"token_count": 1345
} | 166 |
# Language Modeling with Gated Convolutional Networks (Dauphin et al., 2017)
## Example usage
First download and preprocess the data following the main [language modeling README](README.md).
Then to train a convolutional LM using the `fconv_lm_dauphin_wikitext103`
architecture:
```bash
fairseq-train --task language_... | COCO-LM/fairseq/examples/language_model/README.conv.md/0 | {
"file_path": "COCO-LM/fairseq/examples/language_model/README.conv.md",
"repo_id": "COCO-LM",
"token_count": 468
} | 167 |
import gzip
import argparse
from string import punctuation
def len_no_punc(s, punc):
return len([ch for ch in s if ch in punc])
def filter_overpunc(len_npunc, len_sen):
return len_npunc < 0.5*len_sen
def main(args):
punc = punctuation + "—|–"
print('Processing file {}'.format(args.input))
with gz... | COCO-LM/fairseq/examples/m2m_100/process_data/remove_too_much_punc.py/0 | {
"file_path": "COCO-LM/fairseq/examples/m2m_100/process_data/remove_too_much_punc.py",
"repo_id": "COCO-LM",
"token_count": 681
} | 168 |
import shutil
import os, sys
from subprocess import check_call, check_output
import glob
import argparse
import shutil
import pathlib
import itertools
def call_output(cmd):
print(f"Executing: {cmd}")
ret = check_output(cmd, shell=True)
print(ret)
return ret
def call(cmd):
print(cmd)
check_call... | COCO-LM/fairseq/examples/multilingual/data_scripts/binarize.py/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/binarize.py",
"repo_id": "COCO-LM",
"token_count": 3488
} | 169 |
import os, sys
import glob, itertools
import pandas as pd
WORKDIR_ROOT = os.environ.get('WORKDIR_ROOT', None)
if WORKDIR_ROOT is None or not WORKDIR_ROOT.strip():
print('please specify your working directory root in OS environment variable WORKDIR_ROOT. Exitting..."')
sys.exit(-1)
def load_langs(path):
... | COCO-LM/fairseq/examples/multilingual/data_scripts/remove_valid_test_in_train.py/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/remove_valid_test_in_train.py",
"repo_id": "COCO-LM",
"token_count": 5231
} | 170 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import os
import re
import subprocess
from contextlib import redirect_stdout
from fairseq import options
from fairseq_cli import ... | COCO-LM/fairseq/examples/noisychannel/rerank_utils.py/0 | {
"file_path": "COCO-LM/fairseq/examples/noisychannel/rerank_utils.py",
"repo_id": "COCO-LM",
"token_count": 14992
} | 171 |
# RoBERTa: A Robustly Optimized BERT Pretraining Approach
https://arxiv.org/abs/1907.11692
## Introduction
RoBERTa iterates on BERT's pretraining procedure, including training the model longer, with bigger batches over more data; removing the next sentence prediction objective; training on longer sequences; and dyna... | COCO-LM/fairseq/examples/roberta/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/roberta/README.md",
"repo_id": "COCO-LM",
"token_count": 5008
} | 172 |
[Better Fine-Tuning by Reducing Representational Collapse](https://arxiv.org/abs/2008.03156)
=====================
This repo contains the code to replicate all experiments from the _Better Fine-Tuning by Reducing Representational Collapse_ paper excluding the probing results.
The R3F sentence prediction criterion is r... | COCO-LM/fairseq/examples/rxf/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/rxf/README.md",
"repo_id": "COCO-LM",
"token_count": 867
} | 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
from agents import build_agent
from client import SimulSTEvaluationService, SimulSTLocalEvaluationService
from fairseq.regist... | COCO-LM/fairseq/examples/simultaneous_translation/eval/evaluate.py/0 | {
"file_path": "COCO-LM/fairseq/examples/simultaneous_translation/eval/evaluate.py",
"repo_id": "COCO-LM",
"token_count": 955
} | 174 |
### 2021 Update: We are merging this example into the [S2T framework](../speech_to_text), which supports more generic speech-to-text tasks (e.g. speech translation) and more flexible data processing pipelines. Please stay tuned.
# Speech Recognition
`examples/speech_recognition` is implementing ASR task in Fairseq, al... | COCO-LM/fairseq/examples/speech_recognition/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/README.md",
"repo_id": "COCO-LM",
"token_count": 1780
} | 175 |
#!/usr/bin/env python -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ast
import hashlib
import logging
import os
import shutil
import sys
from dataclasses import dataclass, field
... | COCO-LM/fairseq/examples/speech_recognition/hydra/infer.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/hydra/infer.py",
"repo_id": "COCO-LM",
"token_count": 7328
} | 176 |
#!/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 logging
from pathlib import Path
import shutil
from tempfile import NamedTemporaryFile
from typi... | COCO-LM/fairseq/examples/speech_to_text/prep_covost_data.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_to_text/prep_covost_data.py",
"repo_id": "COCO-LM",
"token_count": 4360
} | 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 torch
import torch.nn.functional as F
class MeanPoolGatingNetwork(torch.nn.Module):
"""A simple mean-pooling gating network for s... | COCO-LM/fairseq/examples/translation_moe/translation_moe_src/mean_pool_gating_network.py/0 | {
"file_path": "COCO-LM/fairseq/examples/translation_moe/translation_moe_src/mean_pool_gating_network.py",
"repo_id": "COCO-LM",
"token_count": 860
} | 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.
"""isort:skip_file"""
import os
import sys
try:
from .version import __version__ # noqa
except ImportError:
version_txt = os.path.jo... | COCO-LM/fairseq/fairseq/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/__init__.py",
"repo_id": "COCO-LM",
"token_count": 434
} | 179 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq import utils
from fairseq.criterions import LegacyFairseqCriterion, register_criterion
from torch import nn
@register_criterion... | COCO-LM/fairseq/fairseq/criterions/composite_loss.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/criterions/composite_loss.py",
"repo_id": "COCO-LM",
"token_count": 1734
} | 180 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from . import BaseWrapperDataset, data_utils
class AddTargetDataset(BaseWrapperDataset):
def __init__(
self,
... | COCO-LM/fairseq/fairseq/data/add_target_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/add_target_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1035
} | 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.
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import contextlib
import itertools
impo... | COCO-LM/fairseq/fairseq/data/data_utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/data_utils.py",
"repo_id": "COCO-LM",
"token_count": 9067
} | 182 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_tokenizer
from fairseq.dataclass import FairseqDataclass
@register_tokenizer("nltk", dataclass=Fa... | COCO-LM/fairseq/fairseq/data/encoders/nltk_tokenizer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/encoders/nltk_tokenizer.py",
"repo_id": "COCO-LM",
"token_count": 283
} | 183 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from typing import Dict
from fairseq.data.monolingual_dataset import MonolingualDataset
from . import Fairse... | COCO-LM/fairseq/fairseq/data/lm_context_window_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/lm_context_window_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1516
} | 184 |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | COCO-LM/fairseq/fairseq/data/squad/squad_metrics.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/squad/squad_metrics.py",
"repo_id": "COCO-LM",
"token_count": 10472
} | 185 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
A modified version of the legacy DistributedDataParallel module that uses c10d
communication primitives. This version is simpler than the ... | COCO-LM/fairseq/fairseq/distributed/legacy_distributed_data_parallel.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/distributed/legacy_distributed_data_parallel.py",
"repo_id": "COCO-LM",
"token_count": 2856
} | 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.
"""
Train a network across multiple GPUs.
"""
from fairseq.dataclass.configs import FairseqConfig
from fairseq.distributed import utils as di... | COCO-LM/fairseq/fairseq/model_parallel/megatron_trainer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/model_parallel/megatron_trainer.py",
"repo_id": "COCO-LM",
"token_count": 1073
} | 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 fairseq import utils
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,
)
from f... | COCO-LM/fairseq/fairseq/models/lstm_lm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/lstm_lm.py",
"repo_id": "COCO-LM",
"token_count": 2957
} | 188 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.data import encod... | COCO-LM/fairseq/fairseq/models/roberta/hub_interface.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/roberta/hub_interface.py",
"repo_id": "COCO-LM",
"token_count": 4271
} | 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.
import os
from typing import Any, Dict
from fairseq import checkpoint_utils
from fairseq.data.legacy.masked_lm_dictionary import MaskedLMDict... | COCO-LM/fairseq/fairseq/models/transformer_from_pretrained_xlm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/transformer_from_pretrained_xlm.py",
"repo_id": "COCO-LM",
"token_count": 2609
} | 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 torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_decoding_utils import wi... | COCO-LM/fairseq/fairseq/modules/dynamic_convolution.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/dynamic_convolution.py",
"repo_id": "COCO-LM",
"token_count": 5524
} | 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.
"""
LayerDrop as described in https://arxiv.org/abs/1909.11556.
"""
import torch
import torch.nn as nn
class LayerDropModuleList(nn.ModuleLi... | COCO-LM/fairseq/fairseq/modules/layer_drop.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/layer_drop.py",
"repo_id": "COCO-LM",
"token_count": 534
} | 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 logging
from operator import attrgetter
import torch.distributed as dist
import torch.nn as nn
from ..pq.utils import attrsetter, get... | COCO-LM/fairseq/fairseq/modules/quantization/scalar/utils.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/quantization/scalar/utils.py",
"repo_id": "COCO-LM",
"token_count": 1006
} | 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.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adadelta")
class Adadelta(LegacyFairseqOpt... | COCO-LM/fairseq/fairseq/optim/adadelta.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/adadelta.py",
"repo_id": "COCO-LM",
"token_count": 753
} | 194 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from 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/fixed_schedule.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/lr_scheduler/fixed_schedule.py",
"repo_id": "COCO-LM",
"token_count": 1150
} | 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 ctypes
import math
import sys
from dataclasses import dataclass, field
import torch
from fairseq.dataclass import FairseqDataclass
fro... | COCO-LM/fairseq/fairseq/scoring/bleu.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/scoring/bleu.py",
"repo_id": "COCO-LM",
"token_count": 2527
} | 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 logging
import os
import numpy as np
import torch
from fairseq import utils
from fairseq.data import (
ConcatDataset,
Dictiona... | COCO-LM/fairseq/fairseq/tasks/multilingual_masked_lm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/multilingual_masked_lm.py",
"repo_id": "COCO-LM",
"token_count": 6393
} | 197 |
__version__ = "1.0.0a0+6c15ee7"
| COCO-LM/fairseq/fairseq/version.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/version.py",
"repo_id": "COCO-LM",
"token_count": 20
} | 198 |
#include <torch/extension.h>
#include <vector>
std::vector<torch::Tensor> fwd_cuda(
bool is_training,
int heads,
torch::Tensor const& input,
float ... | COCO-LM/fairseq/fused_ops/csrc/softmax_dropout/interface.cpp/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/csrc/softmax_dropout/interface.cpp",
"repo_id": "COCO-LM",
"token_count": 1863
} | 199 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
DATASET_PATH=$1
DICT_PATH=$2
mkdir -p $DATASET_PATH
cp $DICT_PATH/sp.model $DATASET_PATH
cp $DICT_PATH/dict.txt $DATASET_PATH
export TRAIN_FILE=$DATASET_PATH/train-v2.0.json
if [ ! -f $TRAIN_FILE ]
then
wget https://rajpurkar.github.io/SQ... | COCO-LM/fairseq/preprocess/squad/process.sh/0 | {
"file_path": "COCO-LM/fairseq/preprocess/squad/process.sh",
"repo_id": "COCO-LM",
"token_count": 475
} | 200 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import re
import shutil
import sys
pt_regexp = re.compile(r"checkpoint(\d+|_\d+_\d+|_[a-z]+... | COCO-LM/fairseq/scripts/rm_pt.py/0 | {
"file_path": "COCO-LM/fairseq/scripts/rm_pt.py",
"repo_id": "COCO-LM",
"token_count": 2265
} | 201 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import unittest
import torch
from fairseq.token_generation_constraints import *
def tensorize(constraints: List[List[int]]) -> t... | COCO-LM/fairseq/tests/test_constraints.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_constraints.py",
"repo_id": "COCO-LM",
"token_count": 6160
} | 202 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from collections import OrderedDict
import torch
from fairseq.data import LanguagePairDataset, TokenBlockDataset
from fairseq... | COCO-LM/fairseq/tests/test_multi_corpus_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_multi_corpus_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1303
} | 203 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# The script is largely adapted from the huggingface transformers library
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import logging
import sys
from io import open
from transformers.configurat... | COCO-LM/huggingface/cocolm/configuration_cocolm.py/0 | {
"file_path": "COCO-LM/huggingface/cocolm/configuration_cocolm.py",
"repo_id": "COCO-LM",
"token_count": 1547
} | 204 |
# ------------------------------------------
# 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/finetune.py/0 | {
"file_path": "CSWin-Transformer/finetune.py",
"repo_id": "CSWin-Transformer",
"token_count": 19498
} | 205 |
# ------------------------------------------
# CSWin Transformer
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# written By Xiaoyi Dong
# ------------------------------------------
NUM_PROC=$1
shift
python -m torch.distributed.launch --nproc_per_node=$NUM_PROC main.py "$@"
| CSWin-Transformer/train.sh/0 | {
"file_path": "CSWin-Transformer/train.sh",
"repo_id": "CSWin-Transformer",
"token_count": 77
} | 206 |
<p align="center">
<img src="https://user-images.githubusercontent.com/1785175/215624212-fc92ccb1-f14c-4cb6-982f-61f50b9f3c21.png" width="320px">
</p>
[](https://microsoft.github.io/ClimaX)
[ Microsoft Corporation.
# Licensed under the MIT license.
import os
from typing import Dict, Optional
import numpy as np
import torch
import torchdata.datapipes as dp
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
... | ClimaX/src/climax/pretrain/datamodule.py/0 | {
"file_path": "ClimaX/src/climax/pretrain/datamodule.py",
"repo_id": "ClimaX",
"token_count": 3952
} | 210 |
import os
from glob import glob
import click
import xarray as xr
import numpy as np
import xesmf as xe
def regrid(
ds_in,
ddeg_out,
method='bilinear',
reuse_weights=True,
cmip=False,
rename=None
):
"""
Regrid horizontally.
:param ds_in: Input xarray dataset
... | ClimaX/src/data_preprocessing/regrid_climatebench.py/0 | {
"file_path": "ClimaX/src/data_preprocessing/regrid_climatebench.py",
"repo_id": "ClimaX",
"token_count": 1448
} | 211 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
class FlowHead(nn.Module):
def __init__(self, input_dim=32, hidden_dim=64):
super(FlowHead, self).__init__()
candidate_num = 16
self.conv1 = nn.Conv2... | CoCosNet-v2/models/networks/convgru.py/0 | {
"file_path": "CoCosNet-v2/models/networks/convgru.py",
"repo_id": "CoCosNet-v2",
"token_count": 1607
} | 212 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from data.base_dataset import BaseDataset, get_params, get_transform
import torch
import torchvision.transforms as transforms
from PIL import Image
import util.util as util
import os
import random
#from scipy.ndimage.filters import gaussian_filte... | CoCosNet/data/pix2pix_dataset.py/0 | {
"file_path": "CoCosNet/data/pix2pix_dataset.py",
"repo_id": "CoCosNet",
"token_count": 3306
} | 213 |
"""
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 re
import importlib
import torch
from argparse import Namespace
import numpy as np
from PIL import Image
import os
import sys
import argp... | CoCosNet/util/util.py/0 | {
"file_path": "CoCosNet/util/util.py",
"repo_id": "CoCosNet",
"token_count": 8833
} | 214 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import re
from io import StringIO
import tokenize
def remove_comments_and_docstrings(source, lang):
if lang in ['python']:
"""
Returns 'source' minus comments and docstrings.
"""
io_obj = StringIO(source)
... | CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/parser/utils.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/parser/utils.py",
"repo_id": "CodeBERT",
"token_count": 1972
} | 215 |
# batch size 12 for 16 GB GPU
mnt_dir="/home/codereview"
# You may change the following block for multiple gpu training
MASTER_HOST=localhost && echo MASTER_HOST: ${MASTER_HOST}
MASTER_PORT=23333 && echo MASTER_PORT: ${MASTER_PORT}
RANK=0 && echo RANK: ${RANK}
PER_NODE_GPU=1 && echo PER_NODE_GPU: ${PER_NODE_GPU}
WORL... | CodeBERT/CodeReviewer/code/sh/finetune-cls.sh/0 | {
"file_path": "CodeBERT/CodeReviewer/code/sh/finetune-cls.sh",
"repo_id": "CodeBERT",
"token_count": 586
} | 216 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | CodeBERT/GraphCodeBERT/codesearch/run.py/0 | {
"file_path": "CodeBERT/GraphCodeBERT/codesearch/run.py",
"repo_id": "CodeBERT",
"token_count": 10060
} | 217 |
{"index": "s262143287", "label": 3533, "func": ""}
{"index": "s760791944", "label": 3533, "func": ""}
{"index": "s450011718", "label": 3533, "func": ""}
{"index": "s528769751", "label": 3533, "func": ""}
{"index": "s791563124", "label": 3533, "func": ""}
{"index": "s433322217", "label": 3533, "func": ""}
{"index": "s96... | CodeBERT/UniXcoder/downstream-tasks/zero-shot-search/dataset/java.jsonl/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/zero-shot-search/dataset/java.jsonl",
"repo_id": "CodeBERT",
"token_count": 512704
} | 218 |
import re
from tqdm import tqdm
from multiset import Multiset
from functools import lru_cache
import random
import json
import pdb
import torch
import torch.nn.functional as F
import numpy as np
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
pipeline,
)
import time
class Bas... | CodeT/DIVERSE/code/src/utils.py/0 | {
"file_path": "CodeT/DIVERSE/code/src/utils.py",
"repo_id": "CodeT",
"token_count": 9365
} | 219 |
# CodeT
This repository contains projects that aims to equip large-scale pretrained language models with better programming and reasoning skills.
These projects are presented by Microsoft Research Asia and Microsoft Azure AI.
## Projects
- [[CodeT]](./CodeT/): Code Generation with Generated Tests
- [[DIVERSE]](./DIV... | CodeT/README.md/0 | {
"file_path": "CodeT/README.md",
"repo_id": "CodeT",
"token_count": 119
} | 220 |
###
# PowerShell script to clean up the Codex CLI settings for PowerShell
#
# File/Content to be removed:
# 1. PowerShell profile (Remove file if the content only has Codex CLI setup; otherwise, wipe the Codex CLI setup content)
# 2. OpenAI configuration file (openaiapirc)
###
$RepoRoot = (Get-Location)
$openAIConfig... | Codex-CLI/scripts/powershell_cleanup.ps1/0 | {
"file_path": "Codex-CLI/scripts/powershell_cleanup.ps1",
"repo_id": "Codex-CLI",
"token_count": 424
} | 221 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: face_list.py
Description: Face List section of the Cognitive Face API.
"""
from . import util
def add_face(image, face_list_id, user_data=None, target_face=None):
"""Add a face to a face list.
The input face is specified as an image with a `target_face`... | Cognitive-Face-Python/cognitive_face/face_list.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/face_list.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 2042
} | 222 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: test_large_person_group_person_face.py
Description: Unittests for Large Person Group Person Face section of the
Cognitive Face API.
"""
import unittest
import cognitive_face as CF
from . import util
class TestLargePersonGroupPersonFace(unittest.TestCase):... | Cognitive-Face-Python/cognitive_face/tests/test_large_person_group_person_face.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/tests/test_large_person_group_person_face.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 883
} | 223 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: view.py
Description: Subscription Panel for Python SDK sample.
"""
import wx
import wx.lib.agw.hyperlink as HL
import util
from view.base import MyPanel
class SubscriptionPanel(MyPanel):
"""Subscription Panel."""
def __init__(self, parent):
su... | Cognitive-Face-Python/sample/view/panel_subscription.py/0 | {
"file_path": "Cognitive-Face-Python/sample/view/panel_subscription.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1897
} | 224 |
NOTICES AND INFORMATION
Do Not Translate or Localize
This software incorporates material from third parties. Microsoft makes certain
open source code available at https://3rdpartysource.microsoft.com, or you may
send a check or money order for US $5.00, including the product name, the open
source component name, platf... | ContextualSP/NOTICE/0 | {
"file_path": "ContextualSP/NOTICE",
"repo_id": "ContextualSP",
"token_count": 10725
} | 225 |
export CUDA_VISIBLE_DEVICES=5
python t5_run_eval.py \
--model_name_or_path ./checkpoint/Mod/ControlExp_finetune_set1_seed1/checkpoint-50000 \
--subtask Mod \
--validation_file test \
--ebatch_size 16 \
--set set1 | ContextualSP/abstraction_probing/code/t5_code/Mod_ControlExp_test.sh/0 | {
"file_path": "ContextualSP/abstraction_probing/code/t5_code/Mod_ControlExp_test.sh",
"repo_id": "ContextualSP",
"token_count": 84
} | 226 |
# Copyright (c) Microsoft. All rights reserved.
from enum import Enum
from sklearn.metrics import matthews_corrcoef
from sklearn.metrics import accuracy_score, f1_score
from sklearn.metrics import roc_auc_score
from sklearn.metrics import confusion_matrix
from scipy.stats import pearsonr, spearmanr
from seqeval.metric... | ContextualSP/adaptershare/data_utils/metrics.py/0 | {
"file_path": "ContextualSP/adaptershare/data_utils/metrics.py",
"repo_id": "ContextualSP",
"token_count": 2246
} | 227 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import yaml
import os
import numpy as np
import argparse
import json
import sys
from tqdm.auto import tqdm
from data_utils.task_def import TaskType, DataFormat
from data_utils.log_wrapper import create_logger
from experiments.exp_def import TaskDefs, Encode... | ContextualSP/adaptershare/experiments/squad/squad_prepro.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/squad/squad_prepro.py",
"repo_id": "ContextualSP",
"token_count": 9977
} | 228 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import copy
from pytorch_pretrained_bert.modeling import BertEmbeddings, BertLayerNorm, BertConfig
from module.similarity import SelfAttnWrapper
from module.dropout_wrapper import DropoutWrapper
class SanLayer(... | ContextualSP/adaptershare/module/san_model.py/0 | {
"file_path": "ContextualSP/adaptershare/module/san_model.py",
"repo_id": "ContextualSP",
"token_count": 2247
} | 229 |
import os
import torch
import torch.nn as nn
from transformers import BertTokenizer
from collections import Counter
from models import *
from utils import *
def evaluate_squall(model: nn.Module, data_iter: DataLoader, enable_types: List[SQLTokenType], threshold: float):
eval_results, eval_logs = {}, []
for ev... | ContextualSP/awakening_latent_grounding/eval.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/eval.py",
"repo_id": "ContextualSP",
"token_count": 6808
} | 230 |
# %%
import sys
sys.path.append("..")
from utils import *
# %%
data_dir = 'data/wtq_grounding'
bert_version = 'bert-base-uncased'
tokenizer = BertTokenizer.from_pretrained(bert_version)
# tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
print('load Bert tokenizer over, vocab size = {}'.format(len(tokenize... | ContextualSP/awakening_latent_grounding/scripts/data_preprocess.squall.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/scripts/data_preprocess.squall.py",
"repo_id": "ContextualSP",
"token_count": 6736
} | 231 |
#!/usr/bin/env bash
wget https://raw.githubusercontent.com/chin-gyou/dialogue-utterance-rewriter/master/corpus.txt
python ../../preprocess.py --dataset Rewrite | ContextualSP/incomplete_utterance_rewriting/dataset/Rewrite/download.sh/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/dataset/Rewrite/download.sh",
"repo_id": "ContextualSP",
"token_count": 57
} | 232 |
from allennlp.models.archival import load_archive
from allennlp.predictors.predictor import Predictor
# WARNING: Do not exclude these imports
from predictor import RewritePredictor
from data_reader import RewriteDatasetReader
from model import UnifiedFollowUp
class PredictManager:
def __init__(self, archive_file... | ContextualSP/incomplete_utterance_rewriting/src/predict.py/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/src/predict.py",
"repo_id": "ContextualSP",
"token_count": 447
} | 233 |
# coding: utf-8
import time
import numpy as np
from scipy.optimize import linear_sum_assignment
from tqdm import tqdm
class BipartiteGraphSolver:
solver = linear_sum_assignment
@staticmethod
def find_min(cost_matrix):
row_ind, col_ind = BipartiteGraphSolver.solver(cost_matrix)
sum_cost ... | ContextualSP/interactive_text_to_sql/src/utils/algo_utils.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/utils/algo_utils.py",
"repo_id": "ContextualSP",
"token_count": 544
} | 234 |
import json
import tensorflow as tf
from tensorflow.python.client import timeline
class ProfiledSession(tf.Session):
def __init__(self, *args, **kwargs):
super(ProfiledSession, self).__init__(*args, **kwargs)
def run(self, fetches, feed_dict=None):
"""like Session.run, but return a Timeline o... | ContextualSP/lemon/executor/gtd/ml/profile.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/ml/profile.py",
"repo_id": "ContextualSP",
"token_count": 390
} | 235 |
import pytest
from gtd.io import IntegerDirectories
class TestIntegerDirectories(object):
@pytest.fixture
def int_dirs(self, tmpdir):
tmpdir.mkdir('152_blah')
tmpdir.mkdir('153_woo')
tmpdir.mkdir('1_') # no suffix, should still match
tmpdir.mkdir('-1') # no suffix, should st... | ContextualSP/lemon/executor/gtd/tests/test_io.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/tests/test_io.py",
"repo_id": "ContextualSP",
"token_count": 447
} | 236 |
from abc import ABCMeta, abstractmethod, abstractproperty
from strongsup.predicate import Predicate
class Executor(object, metaclass=ABCMeta):
@abstractmethod
def execute(self, y_toks, old_denotation=None):
"""Return the intermediate denotation of the formula.
Args:
y_toks (list[... | ContextualSP/lemon/executor/strongsup/executor.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/executor.py",
"repo_id": "ContextualSP",
"token_count": 820
} | 237 |
import os
from dependency.data_directory import DataDirectory
from strongsup.domain import Domain
from strongsup.dataset import DatasetFromFile
from strongsup.rlong.path_checker import RLongPathChecker
from strongsup.rlong.predicate import RLongPredicateType
from strongsup.rlong.predicates_computer import get_fixed_p... | ContextualSP/lemon/executor/strongsup/rlong/domain.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/rlong/domain.py",
"repo_id": "ContextualSP",
"token_count": 636
} | 238 |
from strongsup.path_checker import PathChecker
from strongsup.utils import EOU
class TablesPathChecker(PathChecker):
def __init__(self, config):
PathChecker.__init__(self, config)
self._max_stack_size = config.get('max_stack_size')
self._prune_idempotent = config.get('prune_idempotent')
... | ContextualSP/lemon/executor/strongsup/tables/path_checker.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tables/path_checker.py",
"repo_id": "ContextualSP",
"token_count": 403
} | 239 |
import pytest
import math
import tensorflow as tf
import numpy as np
from numpy.testing import assert_almost_equal
from gtd.utils import Bunch
from strongsup.example import Context
from strongsup.decoder import Decoder, DecoderConfig
from strongsup.predicate import Predicate
from strongsup.utils import EOS
from strong... | ContextualSP/lemon/executor/strongsup/tests/test_decoder.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tests/test_decoder.py",
"repo_id": "ContextualSP",
"token_count": 1481
} | 240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.