text
stringlengths
5
22M
id
stringlengths
12
177
metadata
dict
__index_level_0__
int64
0
1.37k
class TREError extends Error { constructor() { super(); Object.setPrototypeOf(this, new.target.prototype); } } export class APIError extends TREError { status?: number; exception?: any; userMessage?: string; endpoint?: string; }
AzureTRE/ui/app/src/models/exceptions.ts/0
{ "file_path": "AzureTRE/ui/app/src/models/exceptions.ts", "repo_id": "AzureTRE", "token_count": 79 }
142
import { configureStore } from "@reduxjs/toolkit"; import operationsReducer from "../components/shared/notifications/operationsSlice"; export const store = configureStore({ reducer: { operations: operationsReducer } }); export type AppDispatch = typeof store.dispatch; export type RootState = ReturnType<typeof...
AzureTRE/ui/app/src/store/store.ts/0
{ "file_path": "AzureTRE/ui/app/src/store/store.ts", "repo_id": "AzureTRE", "token_count": 96 }
143
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import argparse from fairseq.models.transformer_lm import TransformerLanguageModel parser = argparse.ArgumentParser() parser.add_argument("--data_dir", type=str, default="../../data/PubMed/data-bin") parser.add_argument("--model_dir", type=str, ...
BioGPT/examples/text-generation/interactive.py/0
{ "file_path": "BioGPT/examples/text-generation/interactive.py", "repo_id": "BioGPT", "token_count": 656 }
144
# Transparency FAQ for BitBLAS ## What is BitBLAS? BitBLAS is a lightweight framework designed for generating high-performance CUDA/HIP code for BLAS (Basic Linear Algebra Subprograms) operators, emphasizing swizzling and layout propagation. It leverages a Domain-Specific Language (DSL), specifically TIR Script, to o...
BitBLAS/TRANSPARENCY.md/0
{ "file_path": "BitBLAS/TRANSPARENCY.md", "repo_id": "BitBLAS", "token_count": 870 }
145
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
BitBLAS/integration/BitNet/modeling_bitnet.py/0
{ "file_path": "BitBLAS/integration/BitNet/modeling_bitnet.py", "repo_id": "BitBLAS", "token_count": 27678 }
146
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """Base infra""" from .analysis import ( BlockInfo, IterInfo, collect_block_iter_vars_used_in_access_region, collect_vars_used_in_prim_expr, detect_dominant_read, is_broadcast_epilogue, normalize_prim_func, ) from .com...
BitBLAS/python/bitblas/base/__init__.py/0
{ "file_path": "BitBLAS/python/bitblas/base/__init__.py", "repo_id": "BitBLAS", "token_count": 202 }
147
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from .tir import get_analyzer_by_tir # pylint: disable=unused-import
BitBLAS/python/bitblas/base/roller/shape_inference/__init__.py/0
{ "file_path": "BitBLAS/python/bitblas/base/roller/shape_inference/__init__.py", "repo_id": "BitBLAS", "token_count": 44 }
148
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from .lop3 import get_lop3_intrin_group # noqa: F401
BitBLAS/python/bitblas/gpu/intrin/__init__.py/0
{ "file_path": "BitBLAS/python/bitblas/gpu/intrin/__init__.py", "repo_id": "BitBLAS", "token_count": 41 }
149
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from bitblas.gpu.matmul_analysis import get_propagate_map from typing import Literal from tvm import te, IRModule, DataType from tvm.tir import IndexMap def select_implementation( M: int, N: int, datatype: Literal["float16", "int8", ...
BitBLAS/python/bitblas/ops/impl/ladder_permutate_impl.py/0
{ "file_path": "BitBLAS/python/bitblas/ops/impl/ladder_permutate_impl.py", "repo_id": "BitBLAS", "token_count": 1419 }
150
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from typing import Dict, Tuple from tvm.ir import IRModule from tvm.ir.transform import PassContext, module_pass from tvm import tir from tvm.tir.schedule import BlockRV from mlc_llm.quantization import quantization_schemes, GroupQuantizationSpec ...
BitBLAS/python/bitblas/relax/transform/annotate_decode_block.py/0
{ "file_path": "BitBLAS/python/bitblas/relax/transform/annotate_decode_block.py", "repo_id": "BitBLAS", "token_count": 2169 }
151
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include <cuda_runtime.h> #include <cuda_fp16.h> // Pack two half values. static inline __device__ __host__ unsigned __pack_half2(const half x, const half y) { unsigned v0 = *((unsigned short *)&x); unsigned v1 = *((unsigned short *)&y)...
BitBLAS/testing/cpp/lop3_type_conversion/fast_decoding.hpp/0
{ "file_path": "BitBLAS/testing/cpp/lop3_type_conversion/fast_decoding.hpp", "repo_id": "BitBLAS", "token_count": 18164 }
152
from .vg_caption_datamodule import VisualGenomeCaptionDataModule from .f30k_caption_karpathy_datamodule import F30KCaptionKarpathyDataModule from .coco_caption_karpathy_datamodule import CocoCaptionKarpathyDataModule from .conceptual_caption_datamodule import ConceptualCaptionDataModule from .sbu_datamodule import SBUC...
BridgeTower/src/datamodules/__init__.py/0
{ "file_path": "BridgeTower/src/datamodules/__init__.py", "repo_id": "BridgeTower", "token_count": 303 }
153
from .base_dataset import BaseDataset import sys import random class NLVR2Dataset(BaseDataset): def __init__(self, *args, split="", **kwargs): assert split in ["train", "val", "test"] self.split = split if split == "train": names = ["nlvr2_train"] elif split == "val": ...
BridgeTower/src/datasets/nlvr2_dataset.py/0
{ "file_path": "BridgeTower/src/datasets/nlvr2_dataset.py", "repo_id": "BridgeTower", "token_count": 872 }
154
""" Model creation / weight loading / state_dict helpers Hacked together by / Copyright 2020 Ross Wightman """ import logging import os import math from collections import OrderedDict from copy import deepcopy from typing import Any, Callable, Optional, Tuple import torch import torch.nn as nn from timm.models.featu...
BridgeTower/src/modules/swin_helpers.py/0
{ "file_path": "BridgeTower/src/modules/swin_helpers.py", "repo_id": "BridgeTower", "token_count": 9842 }
155
import json import pandas as pd import pyarrow as pa import os from tqdm import tqdm from collections import defaultdict label2id = {'contradiction': 0, 'neutral': 1, 'entailment': 2} def process(root, imgid, ann): with open(f"{root}/flickr30k-images/{imgid}.jpg", "rb") as fp: img = fp.read() senten...
BridgeTower/src/utils/write_snli.py/0
{ "file_path": "BridgeTower/src/utils/write_snli.py", "repo_id": "BridgeTower", "token_count": 999 }
156
FROM nvidia/cuda:11.1-base-ubuntu20.04 RUN apt update && DEBIAN_FRONTEND=noninteractive apt install git bzip2 wget unzip python3-pip python3-dev cmake libgl1-mesa-dev python-is-python3 libgtk2.0-dev -yq ADD . /app WORKDIR /app RUN cd Face_Enhancement/models/networks/ &&\ git clone https://github.com/vacancy/Synchron...
Bringing-Old-Photos-Back-to-Life/Dockerfile/0
{ "file_path": "Bringing-Old-Photos-Back-to-Life/Dockerfile", "repo_id": "Bringing-Old-Photos-Back-to-Life", "token_count": 540 }
157
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch import torch.nn as nn import torch.nn.functional as F from models.networks.base_network import BaseNetwork from models.networks.normalization import get_nonspade_norm_layer from models.networks.architecture import ResnetBlock as Resn...
Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/generator.py/0
{ "file_path": "Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/generator.py", "repo_id": "Bringing-Old-Photos-Back-to-Life", "token_count": 4241 }
158
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. class BaseDataLoader(): def __init__(self): pass def initialize(self, opt): self.opt = opt pass def load_data(): return None
Bringing-Old-Photos-Back-to-Life/Global/data/base_data_loader.py/0
{ "file_path": "Bringing-Old-Photos-Back-to-Life/Global/data/base_data_loader.py", "repo_id": "Bringing-Old-Photos-Back-to-Life", "token_count": 119 }
159
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch import torch.nn as nn import functools from torch.autograd import Variable import numpy as np from torch.nn.utils import spectral_norm # from util.util import SwitchNorm2d import torch.nn.functional as F ###########################...
Bringing-Old-Photos-Back-to-Life/Global/models/networks.py/0
{ "file_path": "Bringing-Old-Photos-Back-to-Life/Global/models/networks.py", "repo_id": "Bringing-Old-Photos-Back-to-Life", "token_count": 16443 }
160
# Old Photo Restoration (Official PyTorch Implementation) <img src='imgs/0001.jpg'/> ### [Project Page](http://raywzy.com/Old_Photo/) | [Paper (CVPR version)](https://arxiv.org/abs/2004.09484) | [Paper (Journal version)](https://arxiv.org/pdf/2009.07047v1.pdf) | [Pretrained Model](https://hkustconnect-my.sharepoint.c...
Bringing-Old-Photos-Back-to-Life/README.md/0
{ "file_path": "Bringing-Old-Photos-Back-to-Life/README.md", "repo_id": "Bringing-Old-Photos-Back-to-Life", "token_count": 4200 }
161
apiVersion: v1 kind: Pod metadata: name: photo-back2life spec: containers: - name: photos-back2life image: <YOUR IMAGE> volumeMounts: - mountPath: /in name: in-folder - mountPath: /out name: out-folder command: - python - /app/run.py args: ...
Bringing-Old-Photos-Back-to-Life/kubernetes-pod.yml/0
{ "file_path": "Bringing-Old-Photos-Back-to-Life/kubernetes-pod.yml", "repo_id": "Bringing-Old-Photos-Back-to-Life", "token_count": 393 }
162
import torch import torch.nn as nn from torch.nn import functional as nnf from enum import Enum from transformers import GPT2LMHeadModel from typing import Tuple, Optional def get_clapcap(name: str): if name == "ClapCaption": return ClapCaptionModel else: raise Exception('The ClapCap model {} ...
CLAP/msclap/models/mapper.py/0
{ "file_path": "CLAP/msclap/models/mapper.py", "repo_id": "CLAP", "token_count": 4039 }
163
## Hydra [Hydra](https://github.com/facebookresearch/hydra) is an open-source Python framework that simplifies the development of research and other complex applications. The key feature is the ability to dynamically create a hierarchical configuration by composition and override it through config files and the comman...
COCO-LM/fairseq/docs/hydra_integration.md/0
{ "file_path": "COCO-LM/fairseq/docs/hydra_integration.md", "repo_id": "COCO-LM", "token_count": 2942 }
164
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from torch.optim import Adagrad from fairseq.optim import LegacyFairseqOptimizer, register_optimizer @register_optimizer("adagrad_with_grad...
COCO-LM/fairseq/examples/adaptive_span/adagrad_with_grad_clip.py/0
{ "file_path": "COCO-LM/fairseq/examples/adaptive_span/adagrad_with_grad_clip.py", "repo_id": "COCO-LM", "token_count": 2256 }
165
# Neural Machine Translation with Byte-Level Subwords https://arxiv.org/abs/1909.03341 We provide an implementation of byte-level byte-pair encoding (BBPE), taking IWSLT 2017 Fr-En translation as example. ## Data Get data and generate fairseq binary dataset: ```bash bash ./get_data.sh ``` ## Model Training Train Tr...
COCO-LM/fairseq/examples/byte_level_bpe/README.md/0
{ "file_path": "COCO-LM/fairseq/examples/byte_level_bpe/README.md", "repo_id": "COCO-LM", "token_count": 1325 }
166
#!/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/sentence_retrieval/sentence_retrieval_tatoeba.sh/0
{ "file_path": "COCO-LM/fairseq/examples/criss/sentence_retrieval/sentence_retrieval_tatoeba.sh", "repo_id": "COCO-LM", "token_count": 729 }
167
# LASER Language-Agnostic SEntence Representations LASER is a library to calculate and use multilingual sentence embeddings. You can find more information about LASER and how to use it on the official [LASER repository](https://github.com/facebookresearch/LASER). This folder contains source code for training LASER ...
COCO-LM/fairseq/examples/laser/README.md/0
{ "file_path": "COCO-LM/fairseq/examples/laser/README.md", "repo_id": "COCO-LM", "token_count": 1998 }
168
# Reducing Transformer Depth on Demand with Structured Dropout (Fan et al., 2019) This page contains information for how to train models with LayerDrop, based on this [paper](https://arxiv.org/abs/1909.11556). ## Citation: If you found this technique useful, please cite our paper: ```bibtex @article{fan2019reducing, ...
COCO-LM/fairseq/examples/layerdrop/README.md/0
{ "file_path": "COCO-LM/fairseq/examples/layerdrop/README.md", "repo_id": "COCO-LM", "token_count": 2747 }
169
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import argparse import pandas as pd import sys WORKDIR_ROOT = os.environ.get('WORKDIR_ROOT', None) if WORKDIR_ROOT is None or n...
COCO-LM/fairseq/examples/multilingual/data_scripts/check_valid_test_overlaps.py/0
{ "file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/check_valid_test_overlaps.py", "repo_id": "COCO-LM", "token_count": 2019 }
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. #!/bin/python import fasttext from multiprocessing import Pool import contextlib import sys import argparse from functools import partial im...
COCO-LM/fairseq/examples/multilingual/data_scripts/utils/fasttext_multi_filter.py/0
{ "file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/utils/fasttext_multi_filter.py", "repo_id": "COCO-LM", "token_count": 1020 }
171
# Paraphrasing with round-trip translation and mixture of experts Machine translation models can be used to paraphrase text by translating it to an intermediate language and back (round-trip translation). This example shows how to paraphrase text by first passing it to an English-French translation model, followed by...
COCO-LM/fairseq/examples/paraphraser/README.md/0
{ "file_path": "COCO-LM/fairseq/examples/paraphraser/README.md", "repo_id": "COCO-LM", "token_count": 757 }
172
# Finetuning RoBERTa on Commonsense QA We follow a similar approach to [finetuning RACE](../README.race.md). Specifically for each question we construct five inputs, one for each of the five candidate answer choices. Each input is constructed by concatenating the question and candidate answer. We then encode each inpu...
COCO-LM/fairseq/examples/roberta/commonsense_qa/README.md/0
{ "file_path": "COCO-LM/fairseq/examples/roberta/commonsense_qa/README.md", "repo_id": "COCO-LM", "token_count": 1525 }
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 math import torch import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions import FairseqCriterion, ...
COCO-LM/fairseq/examples/rxf/rxf_src/label_smoothed_cross_entropy_r3f.py/0
{ "file_path": "COCO-LM/fairseq/examples/rxf/rxf_src/label_smoothed_cross_entropy_r3f.py", "repo_id": "COCO-LM", "token_count": 2934 }
174
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import register_scorer from .scorer import SimulScorer @register_scorer("text") class SimulTextScorer(SimulScorer): def __init__(...
COCO-LM/fairseq/examples/simultaneous_translation/eval/scorers/text_scorer.py/0
{ "file_path": "COCO-LM/fairseq/examples/simultaneous_translation/eval/scorers/text_scorer.py", "repo_id": "COCO-LM", "token_count": 644 }
175
import importlib import os # ASG loss requires flashlight bindings files_to_skip = set() try: import flashlight.lib.sequence.criterion except ImportError: files_to_skip.add("ASG_loss.py") for file in os.listdir(os.path.dirname(__file__)): if file.endswith(".py") and not file.startswith("_") and file not ...
COCO-LM/fairseq/examples/speech_recognition/criterions/__init__.py/0
{ "file_path": "COCO-LM/fairseq/examples/speech_recognition/criterions/__init__.py", "repo_id": "COCO-LM", "token_count": 197 }
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 argparse import math from collections.abc import Iterable import torch import torch.nn as nn from examples.speech_recognition.data.dat...
COCO-LM/fairseq/examples/speech_recognition/models/vggtransformer.py/0
{ "file_path": "COCO-LM/fairseq/examples/speech_recognition/models/vggtransformer.py", "repo_id": "COCO-LM", "token_count": 17782 }
177
#!/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 import os from pathlib import Path import shutil from itertools import groupby from temp...
COCO-LM/fairseq/examples/speech_to_text/prep_mustc_data.py/0
{ "file_path": "COCO-LM/fairseq/examples/speech_to_text/prep_mustc_data.py", "repo_id": "COCO-LM", "token_count": 5033 }
178
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np import torch from fairseq.data import Dictionary, FairseqDataset from fairseq.tasks import LegacyFairseqTas...
COCO-LM/fairseq/fairseq/benchmark/dummy_masked_lm.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/benchmark/dummy_masked_lm.py", "repo_id": "COCO-LM", "token_count": 1793 }
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 inspect from typing import Any, Dict, List from fairseq import metrics, utils from fairseq.dataclass import FairseqDataclass from fair...
COCO-LM/fairseq/fairseq/criterions/fairseq_criterion.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/criterions/fairseq_criterion.py", "repo_id": "COCO-LM", "token_count": 1954 }
180
from pathlib import Path from typing import BinaryIO, Optional, Tuple, Union import numpy as np import torch SF_AUDIO_FILE_EXTENSIONS = {".wav", ".flac", ".ogg"} def _convert_to_mono( waveform: torch.FloatTensor, sample_rate: int ) -> torch.FloatTensor: if waveform.shape[0] > 1: try: ...
COCO-LM/fairseq/fairseq/data/audio/audio_utils.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/data/audio/audio_utils.py", "repo_id": "COCO-LM", "token_count": 1918 }
181
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import numpy as np import torch from . import FairseqDataset, data_utils def collate( samples, pad_idx, eos_idx, ...
COCO-LM/fairseq/fairseq/data/denoising_dataset.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/data/denoising_dataset.py", "repo_id": "COCO-LM", "token_count": 7651 }
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 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/subword_nmt_bpe.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/data/encoders/subword_nmt_bpe.py", "repo_id": "COCO-LM", "token_count": 882 }
183
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import FairseqDataset, data_utils def collate(samples, pad_idx, eos_idx): if len(samples) == 0: ...
COCO-LM/fairseq/fairseq/data/monolingual_dataset.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/data/monolingual_dataset.py", "repo_id": "COCO-LM", "token_count": 4007 }
184
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import BaseWrapperDataset class PrependDataset(BaseWrapperDataset): def __init__(self, dataset, ...
COCO-LM/fairseq/fairseq/data/prepend_dataset.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/data/prepend_dataset.py", "repo_id": "COCO-LM", "token_count": 387 }
185
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from fairseq.data import FairseqDataset, plasma_utils from fairseq.data.indexed_dataset import best_fitting_in...
COCO-LM/fairseq/fairseq/data/token_block_dataset.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/data/token_block_dataset.py", "repo_id": "COCO-LM", "token_count": 3345 }
186
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import io import logging import os import pickle import random import socket import struct import subprocess import warnings from argparse imp...
COCO-LM/fairseq/fairseq/distributed/utils.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/distributed/utils.py", "repo_id": "COCO-LM", "token_count": 13032 }
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. import math from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F from fairseq import options...
COCO-LM/fairseq/fairseq/model_parallel/models/pipeline_parallel_transformer/layers.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/model_parallel/models/pipeline_parallel_transformer/layers.py", "repo_id": "COCO-LM", "token_count": 11018 }
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 logging import os import signal import threading import torch import torch.nn as nn from torch.nn.parallel import DistributedDataParal...
COCO-LM/fairseq/fairseq/models/distributed_fairseq_model.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/models/distributed_fairseq_model.py", "repo_id": "COCO-LM", "token_count": 2076 }
189
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict from fairseq import utils from fairseq.models import ( FairseqMultiModel, register_model, reg...
COCO-LM/fairseq/fairseq/models/multilingual_transformer.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/models/multilingual_transformer.py", "repo_id": "COCO-LM", "token_count": 4430 }
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. """ GottBERT: a pure German Language Model """ from fairseq.models import register_model from .hub_interface import RobertaHubInterface from ...
COCO-LM/fairseq/fairseq/models/roberta/model_gottbert.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/models/roberta/model_gottbert.py", "repo_id": "COCO-LM", "token_count": 790 }
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. from dataclasses import dataclass, field import logging import math from typing import Optional, Tuple from omegaconf import II import sys im...
COCO-LM/fairseq/fairseq/models/wav2vec/wav2vec.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/models/wav2vec/wav2vec.py", "repo_id": "COCO-LM", "token_count": 10600 }
192
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. def gen_forward(): kernels = [3, 5, 7, 15, 31, 63, 127, 255] blocks = [32, 64, 128, 256] head = """ /** * Copyright (c) Facebo...
COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/cuda_function_gen.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/modules/dynamicconv_layer/cuda_function_gen.py", "repo_id": "COCO-LM", "token_count": 3476 }
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 numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair class PQConv2...
COCO-LM/fairseq/fairseq/modules/quantization/pq/modules/qconv.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/modules/quantization/pq/modules/qconv.py", "repo_id": "COCO-LM", "token_count": 1860 }
194
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from typing import Any, Optional import torch import torch.onnx.operators from fairseq import utils from torch import Tensor, nn ...
COCO-LM/fairseq/fairseq/modules/sinusoidal_positional_embedding.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/modules/sinusoidal_positional_embedding.py", "repo_id": "COCO-LM", "token_count": 1835 }
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 logging import math from collections.abc import Collection from dataclasses import dataclass, field from typing import List import tor...
COCO-LM/fairseq/fairseq/optim/adam.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/optim/adam.py", "repo_id": "COCO-LM", "token_count": 4083 }
196
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass from fairseq.dataclass import FairseqDataclass from fairseq.optim.lr_scheduler import FairseqLRScheduler, r...
COCO-LM/fairseq/fairseq/optim/lr_scheduler/pass_through.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/optim/lr_scheduler/pass_through.py", "repo_id": "COCO-LM", "token_count": 507 }
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 dataclasses import dataclass, field from fairseq.dataclass import FairseqDataclass from fairseq.scoring import BaseScorer, register_scor...
COCO-LM/fairseq/fairseq/scoring/wer.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/scoring/wer.py", "repo_id": "COCO-LM", "token_count": 796 }
198
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import numpy as np from fairseq import utils from fairseq.data import ( ConcatSentencesDataset, Dictionary, ...
COCO-LM/fairseq/fairseq/tasks/sentence_prediction.py/0
{ "file_path": "COCO-LM/fairseq/fairseq/tasks/sentence_prediction.py", "repo_id": "COCO-LM", "token_count": 4712 }
199
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Evaluate the perplexity of a trained language model. """ import logging import math import os import sys from a...
COCO-LM/fairseq/fairseq_cli/eval_lm.py/0
{ "file_path": "COCO-LM/fairseq/fairseq_cli/eval_lm.py", "repo_id": "COCO-LM", "token_count": 5811 }
200
#include <ATen/ATen.h> #include "compat.h" // Forward/backward compatiblity hack around // https://github.com/pytorch/pytorch/commit/3aeb78079bcd68282fe9117088e138b77318e288 // pending more future-proof guidance from upstream. // struct TypeShim // { // const at::Type& payload; // TypeShim(const at::Type& type) : ...
COCO-LM/fairseq/fused_ops/csrc/type_shim.h/0
{ "file_path": "COCO-LM/fairseq/fused_ops/csrc/type_shim.h", "repo_id": "COCO-LM", "token_count": 3042 }
201
#!/usr/bin/env bash # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. # GLUE task name, from ['MNLI', 'QQP', 'QNLI', 'SST-2', 'CoLA', 'RTE', 'MRPC', 'STS-B'] TASK=$1 # Path to pretrained COCO-LM checkpoints PRETRAINED_MODEL_PATH=$2 # Path to processed GLUE dataset (containing binary files) 'p...
COCO-LM/fairseq/run_glue.sh/0
{ "file_path": "COCO-LM/fairseq/run_glue.sh", "repo_id": "COCO-LM", "token_count": 1738 }
202
#!/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. """ Split a large file into a train and valid set while respecting document boundaries. Documents should be separated by...
COCO-LM/fairseq/scripts/split_train_valid_docs.py/0
{ "file_path": "COCO-LM/fairseq/scripts/split_train_valid_docs.py", "repo_id": "COCO-LM", "token_count": 1183 }
203
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import unittest from typing import Sequence from fairseq.data import LanguagePairDataset, ListDataset, RoundRobinZipDatasets f...
COCO-LM/fairseq/tests/test_dataset.py/0
{ "file_path": "COCO-LM/fairseq/tests/test_dataset.py", "repo_id": "COCO-LM", "token_count": 1257 }
204
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import Dict, List import tests.utils as test_utils import torch from fairseq import utils from fairseq.data impor...
COCO-LM/fairseq/tests/test_noising.py/0
{ "file_path": "COCO-LM/fairseq/tests/test_noising.py", "repo_id": "COCO-LM", "token_count": 10290 }
205
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. # The script is largely adapted from the huggingface transformers library import re import os import unicodedata from transformers.tokenization_utils import PreTrainedTokenizer from cocolm.tokenization_utils import Dictionary def _is_punctuat...
COCO-LM/huggingface/cocolm/tokenization_cocolm.py/0
{ "file_path": "COCO-LM/huggingface/cocolm/tokenization_cocolm.py", "repo_id": "COCO-LM", "token_count": 4756 }
206
# ------------------------------------------ # CSWin Transformer # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # written By Xiaoyi Dong # ------------------------------------------ from torch.utils.data import Dataset import numpy as np import io from PIL import Image import os import json i...
CSWin-Transformer/labeled_memcached_dataset.py/0
{ "file_path": "CSWin-Transformer/labeled_memcached_dataset.py", "repo_id": "CSWin-Transformer", "token_count": 764 }
207
seed_everything: 42 # ---------------------------- TRAINER ------------------------------------------- trainer: default_root_dir: ${oc.env:AMLT_OUTPUT_DIR,/home/tungnd/ClimaX/exps/climate_projection_climax} precision: 16 gpus: null num_nodes: 1 accelerator: gpu strategy: ddp min_epochs: 1 max_epochs...
ClimaX/configs/climate_projection.yaml/0
{ "file_path": "ClimaX/configs/climate_projection.yaml", "repo_id": "ClimaX", "token_count": 1367 }
208
# Installation Guide ```bash title="clone the repo" git clone https://github.com/microsoft/ClimaX ``` === "`conda`" ```bash title="create and activate env" cd ClimaX conda env create --file docker/environment.yml conda activate climaX ``` ```bash title="install this package" # install s...
ClimaX/docs/install.md/0
{ "file_path": "ClimaX/docs/install.md", "repo_id": "ClimaX", "token_count": 440 }
209
datadir: /data/CMIP6/AWI-ESM name: v_component_of_wind cmip_name: va era_name: v run: r1i1p1f1 res: - 1.40625 # - 5.625
ClimaX/snakemake_configs/AWI-ESM/config_v_component_of_wind.yml/0
{ "file_path": "ClimaX/snakemake_configs/AWI-ESM/config_v_component_of_wind.yml", "repo_id": "ClimaX", "token_count": 67 }
210
datadir: /data/CMIP6/MPI-ESM server_prefix: https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/CMIP name: 10m_u_component_of_wind cmip_name: uas era_name: u10 output_type: 6hrPlevPt run: r1i1p1f1 version: v20190710 res: - 1.40625 # - 5.625
ClimaX/snakemake_configs/MPI-ESM/config_10m_u_component_of_wind.yml/0
{ "file_path": "ClimaX/snakemake_configs/MPI-ESM/config_10m_u_component_of_wind.yml", "repo_id": "ClimaX", "token_count": 128 }
211
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from functools import lru_cache import numpy as np import torch import torch.nn as nn from timm.models.vision_transformer import Block, PatchEmbed, trunc_normal_ from climax.utils.pos_embed import ( get_1d_sincos_pos_embed_from_grid, ge...
ClimaX/src/climax/arch.py/0
{ "file_path": "ClimaX/src/climax/arch.py", "repo_id": "ClimaX", "token_count": 4699 }
212
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os from pytorch_lightning.cli import LightningCLI from climax.pretrain.datamodule import MultiSourceDataModule from climax.pretrain.module import PretrainModule def main(): # Initialize Lightning with the model and data modules, an...
ClimaX/src/climax/pretrain/train.py/0
{ "file_path": "ClimaX/src/climax/pretrain/train.py", "repo_id": "ClimaX", "token_count": 349 }
213
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import importlib import torch.utils.data from data.base_dataset import BaseDataset def find_dataset_using_name(dataset_name): dataset_filename = "data." + dataset_name + "_dataset" datasetlib = importlib.import_module(dataset_filename) ...
CoCosNet-v2/data/__init__.py/0
{ "file_path": "CoCosNet-v2/data/__init__.py", "repo_id": "CoCosNet-v2", "token_count": 608 }
214
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function from models.networks.base_network import BaseNetwork from models.networks.architecture import SPADEResnetBlock class SPADEGenerator(BaseNetw...
CoCosNet-v2/models/networks/generator.py/0
{ "file_path": "CoCosNet-v2/models/networks/generator.py", "repo_id": "CoCosNet-v2", "token_count": 1128 }
215
# -*- coding: utf-8 -*- # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import numpy as np from more_itertools import chunked import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('--test_batch_size', type=int, default=1000) args = parser.p...
CodeBERT/CodeBERT/codesearch/mrr.py/0
{ "file_path": "CodeBERT/CodeBERT/codesearch/mrr.py", "repo_id": "CodeBERT", "token_count": 676 }
216
PER_NODE_GPU=8 python -m torch.distributed.launch --nproc_per_node=${PER_NODE_GPU} run.py \ --output_dir ../saved_models/pretrain_codeexecutor_stage_3 \ --data_cache_dir ../saved_models/pretrain_codeexecutor_stage_3 \ --train_data_path /drive/pretrain_codenetmut.json \ --another_train_data_path /drive/p...
CodeBERT/CodeExecutor/pretrain/run.sh/0
{ "file_path": "CodeBERT/CodeExecutor/pretrain/run.sh", "repo_id": "CodeBERT", "token_count": 398 }
217
# Natural Language Toolkit: Utility functions # # Copyright (C) 2001-2020 NLTK Project # Author: Steven Bird <stevenbird1@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT from itertools import chain def pad_sequence( sequence, n, pad_left=False, pad_right=False, left...
CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/utils.py/0
{ "file_path": "CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/utils.py", "repo_id": "CodeBERT", "token_count": 1699 }
218
# batch size 6 for 16 GB GPU mnt_dir="/home/codereview" 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} WORLD_SIZE=1 && echo WORLD_SIZE: ${WORLD_SIZE} NODES=1 && echo NODES...
CodeBERT/CodeReviewer/code/sh/infer-json.sh/0
{ "file_path": "CodeBERT/CodeReviewer/code/sh/infer-json.sh", "repo_id": "CodeBERT", "token_count": 442 }
219
# Code Generation ## Data Download ```bash mkdir dataset cd dataset wget https://github.com/microsoft/CodeXGLUE/raw/main/Text-Code/text-to-code/dataset/concode/train.json wget https://github.com/microsoft/CodeXGLUE/raw/main/Text-Code/text-to-code/dataset/concode/dev.json wget https://github.com/microsoft/CodeXGLUE/ra...
CodeBERT/UniXcoder/downstream-tasks/code-generation/README.md/0
{ "file_path": "CodeBERT/UniXcoder/downstream-tasks/code-generation/README.md", "repo_id": "CodeBERT", "token_count": 553 }
220
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import statistics import numpy as np from collections import defaultdict import logging from typing import List, Union import itertools logging.basicConfig( format="SystemLog: [%(asctime)s][%(name)s][%(levelname)s] - %(message)s", datefm...
CodeT/CodeT/src/evaluation.py/0
{ "file_path": "CodeT/CodeT/src/evaluation.py", "repo_id": "CodeT", "token_count": 2525 }
221
import os import json import random import argparse from tqdm import tqdm import re import utils_io from utils import ( GSM8KCase, TextEntailmentCase, GSM8KExample, TextEntailmentExample, compute_top1_and_recall, post_process_answer_clutrr_mapping, post_process_answer_clutrr_cutoff, ) from t...
CodeT/DIVERSE/code/src/verifier_data_prepare.py/0
{ "file_path": "CodeT/DIVERSE/code/src/verifier_data_prepare.py", "repo_id": "CodeT", "token_count": 4067 }
222
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import functools import os from utils import Tools, FilePathBuilder, CodexTokenizer, CodeGenTokenizer, CONSTANTS class PromptBuilder: def __init__(self, query_lines_with_retrieval_results, task_path, log_message, tokenizer): self.qu...
CodeT/RepoCoder/build_prompt.py/0
{ "file_path": "CodeT/RepoCoder/build_prompt.py", "repo_id": "CodeT", "token_count": 3709 }
223
#!/bin/zsh # # A shell script to clean up the setup of Codex CLI for zsh # set -e CODEX_CLI_PATH="$( cd "$( dirname "$0" )" && cd .. && pwd )" openAIConfigPath="$CODEX_CLI_PATH/src/openaiapirc" zshrcPath="$HOME/.zshrc" # 1. Remove settings in .zshrc sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end...
Codex-CLI/scripts/zsh_cleanup.sh/0
{ "file_path": "Codex-CLI/scripts/zsh_cleanup.sh", "repo_id": "Codex-CLI", "token_count": 212 }
224
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: large_person_group.py Description: Large Person Group section of the Cognitive Face API. """ from . import util def create(large_person_group_id, name=None, user_data=None): """Create a new large person group with specified `large_person_group_id`, `name...
Cognitive-Face-Python/cognitive_face/large_person_group.py/0
{ "file_path": "Cognitive-Face-Python/cognitive_face/large_person_group.py", "repo_id": "Cognitive-Face-Python", "token_count": 1613 }
225
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: config.sample.py Description: Unittest shared utilities for Python SDK of the Cognitive Face API. """ import time import uuid import cognitive_face as CF from . import config # Base URL of online images. BASE_URL_IMAGE = ('https://raw.githubusercontent.com...
Cognitive-Face-Python/cognitive_face/tests/util.py/0
{ "file_path": "Cognitive-Face-Python/cognitive_face/tests/util.py", "repo_id": "Cognitive-Face-Python", "token_count": 3869 }
226
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: setup.py Description: Setup script to build and distribute cognitive_face module. """ import io from setuptools import find_packages from setuptools import setup README = 'README.md' def readme(): """Parse README for long_description.""" return io.ope...
Cognitive-Face-Python/setup.py/0
{ "file_path": "Cognitive-Face-Python/setup.py", "repo_id": "Cognitive-Face-Python", "token_count": 406 }
227
# Does Deep Learning Learn to Abstract? This is the official repo for the paper *'Does Deep Learning Learn to Abstract? A Systematic Probing Framework'*. This work has been accepted at ICLR 2023. [OpenReview](https://openreview.net/forum?id=QB1dMPEXau5) This repo contains data and main code used in this work. We ho...
ContextualSP/abstraction_probing/README.md/0
{ "file_path": "ContextualSP/abstraction_probing/README.md", "repo_id": "ContextualSP", "token_count": 976 }
228
export CUDA_VISIBLE_DEVICES=4 python t5_run_eval.py \ --model_name_or_path ./checkpoint/Mod/MainExp_finetune_set1_seed1/checkpoint-50000 \ --subtask Mod \ --validation_file test \ --ebatch_size 16 \ --set set1
ContextualSP/abstraction_probing/code/t5_code/Mod_MainExp_test.sh/0
{ "file_path": "ContextualSP/abstraction_probing/code/t5_code/Mod_MainExp_test.sh", "repo_id": "ContextualSP", "token_count": 84 }
229
import numpy as np def update_roberta_keys(state, nlayer=24): for key in state.keys(): if "self_attn.q_proj" in key: return state new_dict = {} for key, val in state.items(): if not "self_attn.in_proj_" in key: new_dict[key] = val for i in range(nlayer): ...
ContextualSP/adaptershare/data_utils/roberta_utils.py/0
{ "file_path": "ContextualSP/adaptershare/data_utils/roberta_utils.py", "repo_id": "ContextualSP", "token_count": 1281 }
230
import os import argparse import random from sys import path path.append(os.getcwd()) from experiments.common_utils import dump_rows from data_utils.task_def import DataFormat from data_utils.log_wrapper import create_logger from experiments.superglue.superglue_utils import * logger = create_logger(__name__, to_disk=...
ContextualSP/adaptershare/experiments/superglue/superglue_prepro.py/0
{ "file_path": "ContextualSP/adaptershare/experiments/superglue/superglue_prepro.py", "repo_id": "ContextualSP", "token_count": 3093 }
231
# coding=utf-8 # Copyright (c) Microsoft. All rights reserved. import shutil import os import subprocess import filecmp import os.path def compare_files(dir1, dir2, common_files, text_mode=False): same_files = [] diff_files = [] for common_file in common_files: path0 = os.path.join(dir1, common_fi...
ContextualSP/adaptershare/tests/test_prepro.py/0
{ "file_path": "ContextualSP/adaptershare/tests/test_prepro.py", "repo_id": "ContextualSP", "token_count": 960 }
232
from .spider_align import SpiderAlignmentModel from .wtq_align import WTQAlignmentModel from baseline.wtq_s2s.seq2seq import WTQSeq2SeqModel from .model_utils import * from .optmizers import *
ContextualSP/awakening_latent_grounding/models/__init__.py/0
{ "file_path": "ContextualSP/awakening_latent_grounding/models/__init__.py", "repo_id": "ContextualSP", "token_count": 63 }
233
python train.py -model SpiderAlignmentModel -bert bert-large-uncased-whole-word-masking \ -lr 5e-5 -train_bs 6 \ -acc_steps 4 -alw linear_20-30 -num_epochs 30 \ --data_dir data/spider_grounding \ --out_dir checkpoints/model_spider \ --warmup_steps 2000
ContextualSP/awakening_latent_grounding/train_spider_ground.sh/0
{ "file_path": "ContextualSP/awakening_latent_grounding/train_spider_ground.sh", "repo_id": "ContextualSP", "token_count": 111 }
234
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. # Author: Qian Liu (SivilTaram) # Original Repo: https://github.com/microsoft/ContextualSP import torch from overrides import overrides from allennlp.modules.matrix_attention.matrix_attention import MatrixAttention @MatrixAttention.register("e...
ContextualSP/incomplete_utterance_rewriting/src/similar_functions/element_wise.py/0
{ "file_path": "ContextualSP/incomplete_utterance_rewriting/src/similar_functions/element_wise.py", "repo_id": "ContextualSP", "token_count": 355 }
235
# coding: utf-8 import re import nltk from src.utils.utils import STOP_WORD_LIST from src.utils.external import complex_rephrase class NLModifier(object): def __init__(self, mode='simple'): self.database = '' self.utterance = '' self.utterance_tokens = [] self.utterance_tokens_n...
ContextualSP/interactive_text_to_sql/src/components/nl_modiifer.py/0
{ "file_path": "ContextualSP/interactive_text_to_sql/src/components/nl_modiifer.py", "repo_id": "ContextualSP", "token_count": 2741 }
236
# coding: utf-8 import json from typing import List from src.utils.utils import lemma_token STOP_WORD_LIST = [_.strip() for _ in open('data/common/stop_words.txt', 'r', encoding='utf-8').readlines()] def align_two_sentences_in_token_level(token_list1, token_list2, stop_word_list=[]): token_list1 = [(word, idx...
ContextualSP/interactive_text_to_sql/src/utils/link_util.py/0
{ "file_path": "ContextualSP/interactive_text_to_sql/src/utils/link_util.py", "repo_id": "ContextualSP", "token_count": 3558 }
237
import json import sys import copy from itertools import combinations, permutations from random import choice, choices, shuffle import math import argparse from multiprocessing import Pool import multiprocessing from collections import Counter from functools import reduce from math import gcd from random import sample ...
ContextualSP/lemon/corpus_generation/tangrams_corpus_generation.py/0
{ "file_path": "ContextualSP/lemon/corpus_generation/tangrams_corpus_generation.py", "repo_id": "ContextualSP", "token_count": 2964 }
238
from abc import ABCMeta, abstractmethod from collections import Mapping import numpy as np from gtd.utils import EqualityMixin class Vocab(object, metaclass=ABCMeta): @abstractmethod def word2index(self, w): pass @abstractmethod def index2word(self, i): pass class SimpleVocab(Voca...
ContextualSP/lemon/executor/gtd/ml/vocab.py/0
{ "file_path": "ContextualSP/lemon/executor/gtd/ml/vocab.py", "repo_id": "ContextualSP", "token_count": 1448 }
239
import json import logging import time from abc import ABCMeta, abstractmethod from collections import Counter import pytest from gtd.persist import LazyMapping, EagerMapping, TableMapping, ORM, ORMColumn, FileSequence, FileSerializer, SimpleORM, \ ShardedSequence, CustomSerializer, LazyIterator, BatchIterator, Si...
ContextualSP/lemon/executor/gtd/tests/test_persist.py/0
{ "file_path": "ContextualSP/lemon/executor/gtd/tests/test_persist.py", "repo_id": "ContextualSP", "token_count": 7081 }
240
from abc import ABCMeta, abstractproperty from collections import Sequence import numpy as np from gtd.utils import set_once_attribute class ParseCase(object, metaclass=ABCMeta): """Necessary and sufficient information to make a prediction about the next decision. Attributes that must be assigned upon crea...
ContextualSP/lemon/executor/strongsup/parse_case.py/0
{ "file_path": "ContextualSP/lemon/executor/strongsup/parse_case.py", "repo_id": "ContextualSP", "token_count": 6805 }
241