text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
# Quick Start
BitBLAS provides two Python APIs to perform mixed-precision matrix multiplication:
- ```bitblas.Matmul``` implements the $W_{wdtype}A_{adtype}$ mixed-precision matrix multiplication of $C_{cdtype}[M, N] = A_{adtype}[M, K] \times W_{wdtype}[N, K]$ where $W_{wdtype}$ indicates the weight of $wtype$, A_{a... | BitBLAS/docs/QuickStart.md/0 | {
"file_path": "BitBLAS/docs/QuickStart.md",
"repo_id": "BitBLAS",
"token_count": 3231
} | 138 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# pylint: disable=missing-docstring, invalid-name
"""This is modified from https://huggingface.co/1bitLLM/bitnet_b1_58-3B/blob/main/utils_quant.py."""
import math
import argparse
import torch
import random
from eval_utils import get_test_datase... | BitBLAS/integration/BitNet/eval_ppl.py/0 | {
"file_path": "BitBLAS/integration/BitNet/eval_ppl.py",
"repo_id": "BitBLAS",
"token_count": 986
} | 139 |
[tool.yapf]
based_on_style = "yapf"
column_limit = 100
indent_width = 4
[tool.codespell]
ignore-words-list = "nd, te"
[tool.ruff.lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
# "UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
# "I",
]
ignor... | BitBLAS/pyproject.toml/0 | {
"file_path": "BitBLAS/pyproject.toml",
"repo_id": "BitBLAS",
"token_count": 299
} | 140 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Policy for tensorcore schedule"""
import tvm
from typing import Dict, List, Tuple, Optional
import numpy as np
from ..arch import TileDevice
from ..hint import Hint, Stride, TileDict, IntrinInfo
from ..node import PrimFuncNode
from .common imp... | BitBLAS/python/bitblas/base/roller/policy/tensorcore.py/0 | {
"file_path": "BitBLAS/python/bitblas/base/roller/policy/tensorcore.py",
"repo_id": "BitBLAS",
"token_count": 7099
} | 141 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""A rule for GEMV and DecodeGEMV."""
from functools import reduce
from typing import List, Dict
from tvm.target import Target
from tvm.tir.function import PrimFunc
from tvm import DataType, tir
import logging
from ..base import (
normalize_pr... | BitBLAS/python/bitblas/gpu/gemv_dequantize.py/0 | {
"file_path": "BitBLAS/python/bitblas/gpu/gemv_dequantize.py",
"repo_id": "BitBLAS",
"token_count": 7391
} | 142 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from .lop3_permutate_impl import tir_interleave_weight
| BitBLAS/python/bitblas/ops/impl/__init__.py/0 | {
"file_path": "BitBLAS/python/bitblas/ops/impl/__init__.py",
"repo_id": "BitBLAS",
"token_count": 36
} | 143 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from tvm.relax.block_builder import BlockBuilder
from tvm.relax.expr import Call, Expr
from tvm.relax.transform.legalize_ops.common import register_legalize
from bitblas.ops.impl import tir_interleave_weight
@register_legalize("bitblas.interlea... | BitBLAS/python/bitblas/relax/op/interleave_weight.py/0 | {
"file_path": "BitBLAS/python/bitblas/relax/op/interleave_weight.py",
"repo_id": "BitBLAS",
"token_count": 264
} | 144 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import tvm
import torch
import numpy as np
import tvm.testing
from tvm.script import tir as T
import os
from tvm import te
import numpy as np
def general_compress_to_int8(lowprecision_weight, source_bits=4):
elems_per_byte = 8 // source_bits... | BitBLAS/testing/python/type_conversion/int4b_fp16_convert.py/0 | {
"file_path": "BitBLAS/testing/python/type_conversion/int4b_fp16_convert.py",
"repo_id": "BitBLAS",
"token_count": 5629
} | 145 |
date ; hostname ; pwd
EXP_NODES=1
EXP_IS=384
EXP_PGB=4
EXP_PGEB=16
EXP_LR=1.1e-5
EXP_BS=2048
EXP_ME=20
EXP_WS=0.1
EXP_WD=0.01
EXP_LMH=5
EXP_LMC=5
EXP_LP=BridgeTower_pt_base.ckpt
EXP_RGM=blip_randaug_wc
EXP_PGEBT=256
EXP_PGEBI=128
EXP_PGEBFT=500
export MASTER_ADDR=$HOSTNAME
export MASTER_PORT=19800
export NODE_RANK=0
... | BridgeTower/scripts/ftfpt_base_irtr_flickr.sh/0 | {
"file_path": "BridgeTower/scripts/ftfpt_base_irtr_flickr.sh",
"repo_id": "BridgeTower",
"token_count": 625
} | 146 |
from glob import glob
from .base_dataset import BaseDataset
import io
from PIL import Image
class ConceptualCaptionDataset(BaseDataset):
def __init__(self, *args, split="", **kwargs):
assert split in ["train", "val", "test"]
if split == "test":
split = "val"
if split == "train... | BridgeTower/src/datasets/conceptual_caption_dataset.py/0 | {
"file_path": "BridgeTower/src/datasets/conceptual_caption_dataset.py",
"repo_id": "BridgeTower",
"token_count": 291
} | 147 |
import torch
import random
from transformers.optimization import AdamW
from transformers import (
get_polynomial_decay_schedule_with_warmup,
get_cosine_schedule_with_warmup,
)
from .objectives import compute_irtr_recall, compute_irtr_itm_itc_recall, compute_irtr_itm_itc_recall_meter, compute_irtr_itc_recall
fr... | BridgeTower/src/modules/meter_utils.py/0 | {
"file_path": "BridgeTower/src/modules/meter_utils.py",
"repo_id": "BridgeTower",
"token_count": 9817
} | 148 |
import json
import pandas as pd
import pyarrow as pa
import os
from tqdm import tqdm
from collections import defaultdict
def process(root, iden, row):
texts = [r["sentence"] for r in row]
labels = [r["label"] for r in row]
split = iden.split("-")[0]
if iden.startswith("train"):
directory = ... | BridgeTower/src/utils/write_nlvr2.py/0 | {
"file_path": "BridgeTower/src/utils/write_nlvr2.py",
"repo_id": "BridgeTower",
"token_count": 1462
} | 149 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import io
import os
import struct
from PIL import Image
class BigFileMemoryLoader(object):
def __load_bigfile(self):
print('start load bigfile (%0.02f GB) into memory' % (os.path.getsize(self.file_path)/1024/1024/1024))
with ... | Bringing-Old-Photos-Back-to-Life/Global/data/Load_Bigfile.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/data/Load_Bigfile.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 762
} | 150 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import functools
from torch.autograd import Variable
from util.image_pool import ImagePool
from .base_model import BaseModel
from . import networks
im... | Bringing-Old-Photos-Back-to-Life/Global/models/mapping_model.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/models/mapping_model.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 7186
} | 151 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import numpy as np
import os
import ntpath
import time
from . import util
#from . import html
import scipy.misc
try:
from StringIO import StringIO # Python 2.7
except ImportError:
from io import BytesIO # Python 3.x
class Visual... | Bringing-Old-Photos-Back-to-Life/Global/util/visualizer.py/0 | {
"file_path": "Bringing-Old-Photos-Back-to-Life/Global/util/visualizer.py",
"repo_id": "Bringing-Old-Photos-Back-to-Life",
"token_count": 3002
} | 152 |
# Ke Chen
# knutchen@ucsd.edu
# HTS-AT: A HIERARCHICAL TOKEN-SEMANTIC AUDIO TRANSFORMER FOR SOUND CLASSIFICATION AND DETECTION
# The configuration for training the model
exp_name = "exp_htsat_pretrain" # the saved ckpt prefix name of the model
workspace = "/home/kechen/Research/HTSAT" # the folder of your code
datase... | CLAP/msclap/models/config.py/0 | {
"file_path": "CLAP/msclap/models/config.py",
"repo_id": "CLAP",
"token_count": 1874
} | 153 |
# Adaptive Span
Adaptive Span is a novel self-attention mechanism that can learn its optimal
attention span. This allows us to extend significantly the maximum context size
used in Transformer, while maintaining control over their memory footprint
and computational time. It uses the Truncated BPTT technique for traini... | COCO-LM/fairseq/examples/adaptive_span/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/adaptive_span/README.md",
"repo_id": "COCO-LM",
"token_count": 1496
} | 154 |
# Fine-tuning BART on CNN-Dailymail summarization task
### 1) Download the CNN and Daily Mail data and preprocess it into data files with non-tokenized cased samples.
Follow the instructions [here](https://github.com/abisee/cnn-dailymail) to download the original CNN and Daily Mail datasets. To preprocess the data, r... | COCO-LM/fairseq/examples/bart/README.summarization.md/0 | {
"file_path": "COCO-LM/fairseq/examples/bart/README.summarization.md",
"repo_id": "COCO-LM",
"token_count": 1444
} | 155 |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Translate pre-processed data with a trained model.
"""
import numpy as np
import torch
from fairseq import check... | COCO-LM/fairseq/examples/criss/save_encoder.py/0 | {
"file_path": "COCO-LM/fairseq/examples/criss/save_encoder.py",
"repo_id": "COCO-LM",
"token_count": 3651
} | 156 |
# Neural Language Modeling
## Pre-trained models
Model | Description | Dataset | Download
---|---|---|---
`transformer_lm.gbw.adaptive_huge` | Adaptive Inputs <br> ([Baevski and Auli, 2018](https://arxiv.org/abs/1809.10853)) <br> 1026M params | [Google Billion Words](https://github.com/ciprian-chelba/1-billion-word-l... | COCO-LM/fairseq/examples/language_model/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/language_model/README.md",
"repo_id": "COCO-LM",
"token_count": 1923
} | 157 |
# 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
class LayerSelect(nn.Module):
"""Compute samples (from a Gumbel-Sigmoid distribution) which is used a... | COCO-LM/fairseq/examples/latent_depth/latent_depth_src/modules/latent_layers.py/0 | {
"file_path": "COCO-LM/fairseq/examples/latent_depth/latent_depth_src/modules/latent_layers.py",
"repo_id": "COCO-LM",
"token_count": 1234
} | 158 |
#!/usr/bin/env bash
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
set -e
TOKENIZERS_SCRIPTS=tokenizers
INSTALL_PATH=$TOKENIZERS_SCRIPTS/thirdparty
N_THREADS=8
lg=$1
MOSE... | COCO-LM/fairseq/examples/m2m_100/tok.sh/0 | {
"file_path": "COCO-LM/fairseq/examples/m2m_100/tok.sh",
"repo_id": "COCO-LM",
"token_count": 1073
} | 159 |
# 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, sys
import subprocess
import re
from subprocess import check_call, check_output
WORKDIR_ROOT = os.environ.get('WORKDIR_ROOT', Non... | COCO-LM/fairseq/examples/multilingual/data_scripts/check_iswlt_test_data.py/0 | {
"file_path": "COCO-LM/fairseq/examples/multilingual/data_scripts/check_iswlt_test_data.py",
"repo_id": "COCO-LM",
"token_count": 1389
} | 160 |
# Non-autoregressive Neural Machine Translation (NAT)
This page mainly includes instructions for reproducing results from the following papers
* [Levenshtein Transformer (Gu et al., 2019)](https://arxiv.org/abs/1905.11006).
* [Understanding Knowledge Distillation in Non-autoregressive Machine Translation (Zhou et al.,... | COCO-LM/fairseq/examples/nonautoregressive_translation/README.md/0 | {
"file_path": "COCO-LM/fairseq/examples/nonautoregressive_translation/README.md",
"repo_id": "COCO-LM",
"token_count": 2373
} | 161 |
# Pretraining RoBERTa using your own data
This tutorial will walk you through pretraining RoBERTa over your own data.
### 1) Preprocess the data
Data should be preprocessed following the [language modeling format](/examples/language_model), i.e. each document should be separated by an empty line (only useful with `-... | COCO-LM/fairseq/examples/roberta/README.pretraining.md/0 | {
"file_path": "COCO-LM/fairseq/examples/roberta/README.pretraining.md",
"repo_id": "COCO-LM",
"token_count": 1550
} | 162 |
from . import criterions, models, tasks # noqa
| COCO-LM/fairseq/examples/speech_recognition/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/__init__.py",
"repo_id": "COCO-LM",
"token_count": 15
} | 163 |
#!/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.
"""
Run inference for pre-processed data with a trained model.
"""
import ast
import logging
import math
import os
... | COCO-LM/fairseq/examples/speech_recognition/infer.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_recognition/infer.py",
"repo_id": "COCO-LM",
"token_count": 6964
} | 164 |
#!/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
import p... | COCO-LM/fairseq/examples/speech_to_text/prep_librispeech_data.py/0 | {
"file_path": "COCO-LM/fairseq/examples/speech_to_text/prep_librispeech_data.py",
"repo_id": "COCO-LM",
"token_count": 1661
} | 165 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
import torch
from omegaconf import II
from fairseq import metrics, utils
from fairseq.dataclass impo... | COCO-LM/fairseq/examples/translation_moe/translation_moe_src/translation_moe.py/0 | {
"file_path": "COCO-LM/fairseq/examples/translation_moe/translation_moe_src/translation_moe.py",
"repo_id": "COCO-LM",
"token_count": 4609
} | 166 |
# @package _group_
hydra:
run:
dir: .
defaults:
- task: null
- model: null
- criterion: cross_entropy
- optimizer: null
- lr_scheduler: fixed
- bpe: null
- tokenizer: null
- scoring: null
- generation: null
- common_eval: null
- eval_lm: null
| COCO-LM/fairseq/fairseq/config/config.yaml/0 | {
"file_path": "COCO-LM/fairseq/fairseq/config/config.yaml",
"repo_id": "COCO-LM",
"token_count": 132
} | 167 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions impo... | COCO-LM/fairseq/fairseq/criterions/cross_entropy.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/criterions/cross_entropy.py",
"repo_id": "COCO-LM",
"token_count": 1420
} | 168 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from . import BaseWrapperDataset
class AppendTokenDataset(BaseWrapperDataset):
def __init__(self, datas... | COCO-LM/fairseq/fairseq/data/append_token_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/append_token_dataset.py",
"repo_id": "COCO-LM",
"token_count": 474
} | 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.
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/sentencepiece_bpe.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/encoders/sentencepiece_bpe.py",
"repo_id": "COCO-LM",
"token_count": 3325
} | 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.
from functools import lru_cache
from . import BaseWrapperDataset
class LRUCacheDataset(BaseWrapperDataset):
def __init__(self, dataset,... | COCO-LM/fairseq/fairseq/data/lru_cache_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/lru_cache_dataset.py",
"repo_id": "COCO-LM",
"token_count": 212
} | 171 |
# 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 import data_utils
from . import BaseWrapperDataset
class PadDataset(BaseWrapperDataset):
def __init__(self, dataset, ... | COCO-LM/fairseq/fairseq/data/pad_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/pad_dataset.py",
"repo_id": "COCO-LM",
"token_count": 339
} | 172 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from . import BaseWrapperDataset
class StripTokenDataset(BaseWrapperDataset):
def __init__(self, dataset, id_to_strip):
super().... | COCO-LM/fairseq/fairseq/data/strip_token_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/data/strip_token_dataset.py",
"repo_id": "COCO-LM",
"token_count": 267
} | 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.
from torch import nn
class ModuleProxyWrapper(nn.Module):
"""
Wrap a DistributedDataParallel module and forward requests for missing... | COCO-LM/fairseq/fairseq/distributed/module_proxy_wrapper.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/distributed/module_proxy_wrapper.py",
"repo_id": "COCO-LM",
"token_count": 765
} | 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.
import importlib
import os
# automatically import any Python files in the models/ directory
models_dir = os.path.dirname(__file__)
for file ... | COCO-LM/fairseq/fairseq/model_parallel/models/__init__.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/model_parallel/models/__init__.py",
"repo_id": "COCO-LM",
"token_count": 253
} | 175 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
COCO-LM: Correcting and Contrasting Text Sequences for Language Model Pretraining
"""
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.models import (
FairseqEncod... | COCO-LM/fairseq/fairseq/models/cocolm/model.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/cocolm/model.py",
"repo_id": "COCO-LM",
"token_count": 14169
} | 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 logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.models import (
... | COCO-LM/fairseq/fairseq/models/masked_lm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/masked_lm.py",
"repo_id": "COCO-LM",
"token_count": 6742
} | 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.
"""
RoBERTa: A Robustly Optimized BERT Pretraining Approach.
"""
import logging
import torch
import torch.nn as nn
import torch.nn.functional... | COCO-LM/fairseq/fairseq/models/roberta/model.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/roberta/model.py",
"repo_id": "COCO-LM",
"token_count": 10143
} | 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.
from dataclasses import dataclass, field
from typing import Optional
from fairseq import options, utils
from fairseq.dataclass import Choice... | COCO-LM/fairseq/fairseq/models/transformer_lm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/models/transformer_lm.py",
"repo_id": "COCO-LM",
"token_count": 9716
} | 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.
"""
This file is to re-implemented the low-rank and beam approximation of CRF layer
Proposed by:
Sun, Zhiqing, et al.
Fast Structured Decodin... | COCO-LM/fairseq/fairseq/modules/dynamic_crf_layer.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/dynamic_crf_layer.py",
"repo_id": "COCO-LM",
"token_count": 3388
} | 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
import torch.nn as nn
import torch.nn.functional as F
try:
from fused_ops.layernorm import FusedLayerNorm as _FusedLayerNor... | COCO-LM/fairseq/fairseq/modules/layer_norm.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/layer_norm.py",
"repo_id": "COCO-LM",
"token_count": 636
} | 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 logging
import os
import random
from collections import Counter
import torch
class EM:
"""
EM algorithm used to quantize the... | COCO-LM/fairseq/fairseq/modules/quantization/pq/em.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/quantization/pq/em.py",
"repo_id": "COCO-LM",
"token_count": 3381
} | 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 torch import nn
class SamePad(nn.Module):
def __init__(self, kernel_size, causal=False):
super().__init__()
if cau... | COCO-LM/fairseq/fairseq/modules/same_pad.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/modules/same_pad.py",
"repo_id": "COCO-LM",
"token_count": 224
} | 183 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adafactor")
clas... | COCO-LM/fairseq/fairseq/optim/adafactor.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/adafactor.py",
"repo_id": "COCO-LM",
"token_count": 5432
} | 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.
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
from fairse... | COCO-LM/fairseq/fairseq/optim/lr_scheduler/inverse_square_root_schedule.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/optim/lr_scheduler/inverse_square_root_schedule.py",
"repo_id": "COCO-LM",
"token_count": 1273
} | 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.
from fairseq.scoring import BaseScorer, register_scorer
@register_scorer("chrf")
class ChrFScorer(BaseScorer):
def __init__(self, args):... | COCO-LM/fairseq/fairseq/scoring/chrf.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/scoring/chrf.py",
"repo_id": "COCO-LM",
"token_count": 309
} | 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 contextlib
import logging
import os
from collections import OrderedDict
import torch
from fairseq import metrics, options, utils
from ... | COCO-LM/fairseq/fairseq/tasks/multilingual_translation.py/0 | {
"file_path": "COCO-LM/fairseq/fairseq/tasks/multilingual_translation.py",
"repo_id": "COCO-LM",
"token_count": 8926
} | 187 |
#pragma once
#include <assert.h>
#include <cfloat>
#include <limits>
#include <stdint.h>
#include <cuda_fp16.h>
#include <cuda_bf16.h>
#include <cmath>
namespace {
template <typename Datatype, int ELEMENTS_PER_LDG>
__device__ __inline__ void copy_vector(Datatype *dst, const Datatype *src);
template <>... | COCO-LM/fairseq/fused_ops/csrc/softmax_dropout/softmax.h/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/csrc/softmax_dropout/softmax.h",
"repo_id": "COCO-LM",
"token_count": 18693
} | 188 |
# 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/preprocess/squad/squad_process.py/0 | {
"file_path": "COCO-LM/fairseq/preprocess/squad/squad_process.py",
"repo_id": "COCO-LM",
"token_count": 635
} | 189 |
#!/bin/bash
if [ $# -ne 4 ]; then
echo "usage: $0 TESTSET SRCLANG TGTLANG GEN"
exit 1
fi
TESTSET=$1
SRCLANG=$2
TGTLANG=$3
GEN=$4
if ! command -v sacremoses &> /dev/null
then
echo "sacremoses could not be found, please install with: pip install sacremoses"
exit
fi
grep ^H $GEN \
| sed 's/^H\-//' \
|... | COCO-LM/fairseq/scripts/sacrebleu.sh/0 | {
"file_path": "COCO-LM/fairseq/scripts/sacrebleu.sh",
"repo_id": "COCO-LM",
"token_count": 217
} | 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 contextlib
import logging
import os
import tempfile
import unittest
from io import StringIO
import torch
from fairseq import options
f... | COCO-LM/fairseq/tests/gpu/test_binaries_gpu.py/0 | {
"file_path": "COCO-LM/fairseq/tests/gpu/test_binaries_gpu.py",
"repo_id": "COCO-LM",
"token_count": 6032
} | 191 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
import torch.nn as nn
from fairseq.modules import ConvTBC
class TestConvTBC(unittest.TestCase):
def test_c... | COCO-LM/fairseq/tests/test_convtbc.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_convtbc.py",
"repo_id": "COCO-LM",
"token_count": 820
} | 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 unittest
from collections import OrderedDict
import numpy as np
import torch
from fairseq.data import LanguagePairDataset, TokenBlockD... | COCO-LM/fairseq/tests/test_multi_corpus_sampled_dataset.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_multi_corpus_sampled_dataset.py",
"repo_id": "COCO-LM",
"token_count": 1624
} | 193 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# The script is largely adapted from the huggingface transformers library
import torch
import logging
from transformers.modeling_utils import cached_path, WEIGHTS_NAME, TF2_WEIGHTS_NAME, TF_WEIGHTS_NAME
logger = logging.getLogger(__name__)
d... | COCO-LM/huggingface/cocolm/convert_state_dict.py/0 | {
"file_path": "COCO-LM/huggingface/cocolm/convert_state_dict.py",
"repo_id": "COCO-LM",
"token_count": 713
} | 194 |
datadir: /data/CMIP6/AWI-ESM
name: temperature
cmip_name: ta
era_name: t
run: r1i1p1f1
res:
- 1.40625
# - 5.625 | ClimaX/snakemake_configs/AWI-ESM/config_temperature.yml/0 | {
"file_path": "ClimaX/snakemake_configs/AWI-ESM/config_temperature.yml",
"repo_id": "ClimaX",
"token_count": 61
} | 195 |
datadir: /data/CMIP6/HAMMOZ
name: v_component_of_wind
cmip_name: va
era_name: v
run: r1i1p1f1
version: v20190628
res:
- 1.40625
# - 5.625
| ClimaX/snakemake_configs/HAMMOZ/config_v_component_of_wind.yml/0 | {
"file_path": "ClimaX/snakemake_configs/HAMMOZ/config_v_component_of_wind.yml",
"repo_id": "ClimaX",
"token_count": 73
} | 196 |
datadir: /data/CMIP6/TaiESM1
server_prefix: https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/CMIP
name: v_component_of_wind
cmip_name: va
era_name: v
run: r1i1p1f1
res:
- 1.40625
# - 5.625
| ClimaX/snakemake_configs/TaiESM1/config_v_component_of_wind.yml/0 | {
"file_path": "ClimaX/snakemake_configs/TaiESM1/config_v_component_of_wind.yml",
"repo_id": "ClimaX",
"token_count": 105
} | 197 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import math
import os
import random
import numpy as np
import torch
from torch.utils.data import IterableDataset
class NpyReader(IterableDataset):
def __init__(
self,
file_list,
start_idx,
end_idx,
v... | ClimaX/src/climax/pretrain/dataset.py/0 | {
"file_path": "ClimaX/src/climax/pretrain/dataset.py",
"repo_id": "ClimaX",
"token_count": 2475
} | 198 |
import torch
from climax.arch import ClimaX
def test_parallel_patch_embed():
vars = tuple(["a", "b", "c"])
x = torch.rand(4, len(vars), 32, 64)
serial_model = ClimaX(vars, img_size=[32, 64], patch_size=4, embed_dim=128, parallel_patch_embed=False)
parallel_model = ClimaX(vars, img_size=[32, 64], patc... | ClimaX/tests/test_parallel_patch_embed.py/0 | {
"file_path": "ClimaX/tests/test_parallel_patch_embed.py",
"repo_id": "ClimaX",
"token_count": 726
} | 199 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
import util.util as util
from models.networks.base_network import BaseNetwork
from models.networks.architecture import ResidualBlock
from models.networks.normalization import get... | CoCosNet-v2/models/networks/correspondence.py/0 | {
"file_path": "CoCosNet-v2/models/networks/correspondence.py",
"repo_id": "CoCosNet-v2",
"token_count": 6521
} | 200 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import copy
import sys
import torch
from models.pix2pix_model import Pix2PixModel
try:
from torch.cuda.amp import GradScaler
except:
# dummy GradScaler for PyTorch < 1.6
class GradScaler:
def __init__(self, enabled):... | CoCosNet-v2/trainers/pix2pix_trainer.py/0 | {
"file_path": "CoCosNet-v2/trainers/pix2pix_trainer.py",
"repo_id": "CoCosNet-v2",
"token_count": 2322
} | 201 |
"""
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).
"""
from .base_options import BaseOptions
class TrainOptions(BaseOptions):
def initialize(self, parser):
BaseOptions.initialize(self, ... | CoCosNet/options/train_options.py/0 | {
"file_path": "CoCosNet/options/train_options.py",
"repo_id": "CoCosNet",
"token_count": 1501
} | 202 |
# 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/CodeBERT/code2nl/run.py/0 | {
"file_path": "CodeBERT/CodeBERT/code2nl/run.py",
"repo_id": "CodeBERT",
"token_count": 12905
} | 203 |
import torch
import torch.nn as nn
import torch
from torch.autograd import Variable
import copy
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss, MSELoss
import random
class Model(nn.Module):
def __init__(self, encoder,config,tokenizer,args):
super(Model, self).__init__()
... | CodeBERT/CodeExecutor/pretrain/model.py/0 | {
"file_path": "CodeBERT/CodeExecutor/pretrain/model.py",
"repo_id": "CodeBERT",
"token_count": 973
} | 204 |
# Code Refinement
## Task Definition
Code refinement aims to automatically fix bugs in the code, which can contribute to reducing the cost of bug-fixes for developers.
In CodeXGLUE, given a piece of Java code with bugs, the task is to remove the bugs to output the refined code.
Models are evaluated by BLEU scores an... | CodeBERT/GraphCodeBERT/refinement/README.md/0 | {
"file_path": "CodeBERT/GraphCodeBERT/refinement/README.md",
"repo_id": "CodeBERT",
"token_count": 1434
} | 205 |
# 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/LongCoder/run.py/0 | {
"file_path": "CodeBERT/LongCoder/run.py",
"repo_id": "CodeBERT",
"token_count": 7765
} | 206 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torch
from torch.autograd import Variable
import copy
class Seq2Seq(nn.Module):
"""
Build Seqence-to-Sequence.
Parameters:
* `encoder`- encoder of seq2seq model. e.g... | CodeBERT/UniXcoder/downstream-tasks/code-completion/model.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-completion/model.py",
"repo_id": "CodeBERT",
"token_count": 4662
} | 207 |
import json
for lang,suffix in [("Java",".java"),("Ruby",".rb"),("Python",".py")]:
with open("{}.jsonl".format(lang.lower())) as f, open("{}_with_func.jsonl".format(lang.lower()),"w") as f1:
for line in f:
js = json.loads(line.strip())
problem_id = str(js["label"])
probl... | CodeBERT/UniXcoder/downstream-tasks/zero-shot-search/dataset/preprocess.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/zero-shot-search/dataset/preprocess.py",
"repo_id": "CodeBERT",
"token_count": 305
} | 208 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional, Dict
import contextlib
import faulthandler
import io
import os
import multiprocessing
import platform
import signal
import tempfile
def _pack_test_cases(test_cases, timeout):
blank_4 = ' ' * 4
blank_8 = ' ' *... | CodeT/CodeT/src/_execution.py/0 | {
"file_path": "CodeT/CodeT/src/_execution.py",
"repo_id": "CodeT",
"token_count": 3491
} | 209 |
import os
def get_file(path):
if os.path.isdir(path):
return os.path.join(path, os.listdir(path)[0])
else:
return path | CodeT/DIVERSE/code/src/utils_io.py/0 | {
"file_path": "CodeT/DIVERSE/code/src/utils_io.py",
"repo_id": "CodeT",
"token_count": 67
} | 210 |
### Codex CLI setup - start
$nl_cli_script = "{{codex_query_path}}"
# this function takes the input from the buffer and passes it to codex_query.py
function create_completion() {
param (
[Parameter (Mandatory = $true)] [string] $buffer
)
if ($nl_cli_script -eq "" -or !(Test-Path($nl_cli_script... | Codex-CLI/scripts/powershell_plugin.ps1/0 | {
"file_path": "Codex-CLI/scripts/powershell_plugin.ps1",
"repo_id": "Codex-CLI",
"token_count": 587
} | 211 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: large_face_list.py
Description: Large Face List section of the Cognitive Face API.
"""
from . import util
def create(large_face_list_id, name=None, user_data=None):
"""Create an empty large face list with user-specified
`large_face_list_id`, `name` and a... | Cognitive-Face-Python/cognitive_face/large_face_list.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/large_face_list.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1598
} | 212 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: test_person.py
Description: Unittests for Person section of the Cognitive Face API.
"""
import unittest
import cognitive_face as CF
from . import util
class TestPerson(unittest.TestCase):
"""Unittests for Person section."""
def test_face(self):
... | Cognitive-Face-Python/cognitive_face/tests/test_person.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/tests/test_person.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1375
} | 213 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: panel_verification.py
Description: Verification Panel for Python SDK sample.
"""
import os
import uuid
import wx
import wx.lib.scrolledpanel as scrolled
import util
import model
from view import base
class VerificationPanel(base.MyPanel):
"""Verification ... | Cognitive-Face-Python/sample/view/panel_verification.py/0 | {
"file_path": "Cognitive-Face-Python/sample/view/panel_verification.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 7171
} | 214 |
# :mailbox: Paper Code Collection (MSRA DKI Group) <img src="https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1Mu3b?ver=5c31" height="25" align=center>
[](https://opensource.org/licenses/MIT)
This repo hosts multiple op... | ContextualSP/README.md/0 | {
"file_path": "ContextualSP/README.md",
"repo_id": "ContextualSP",
"token_count": 2215
} | 215 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
"""Extract feature vectors.
"""
import os
import argparse
import torch
import json
from transformers import AutoTokenizer
from torch.utils.data import DataLoader
from data_utils.log_wrapper import create_logger
from data_utils.utils import set_environment
f... | ContextualSP/adaptershare/experiments/dump_embedding/extractor.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/dump_embedding/extractor.py",
"repo_id": "ContextualSP",
"token_count": 5126
} | 216 |
squad:
data_format: CLUE_SPAN
dropout_p: 0.1
enable_san: false
metric_meta:
- EmF12
task_type: Span
loss: SpanCeCriterion
kd_loss: MseCriterion
adv_loss: SymKlCriterion
n_class: 2
split_names:
- train
- dev
squad-v2:
data_format: CLUE_SPAN
dropout_p: 0.1
enable_san: false
metric_meta... | ContextualSP/adaptershare/experiments/squad/squad_task_def.yml/0 | {
"file_path": "ContextualSP/adaptershare/experiments/squad/squad_task_def.yml",
"repo_id": "ContextualSP",
"token_count": 317
} | 217 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy
from torch.nn.utils import weight_norm
from torch.nn.parameter import Parameter
from .common import activation, init_wrapper
from .dropout_wrapper import DropoutWrapper
class ... | ContextualSP/adaptershare/module/similarity.py/0 | {
"file_path": "ContextualSP/adaptershare/module/similarity.py",
"repo_id": "ContextualSP",
"token_count": 13168
} | 218 |
#!/usr/bin/env bash
###############################
# Training a mt-dnn model
# Note that this is a toy setting and please refer our paper for detailed hyper-parameters.
###############################
# cook GLUE data
bash experiments/glue/prepro.sh
# FT on rte
export CUDA_VISIBLE_DEVICES=0,; bash experiments/glu... | ContextualSP/adaptershare/run_toy.sh/0 | {
"file_path": "ContextualSP/adaptershare/run_toy.sh",
"repo_id": "ContextualSP",
"token_count": 120
} | 219 |
python eval.py \
--checkpoint checkpoints/spider_grounding_model/model.pt \
--data_path data/spider_grounding/dev \
--threshold 0.4 | ContextualSP/awakening_latent_grounding/eval_spider_ground.sh/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/eval_spider_ground.sh",
"repo_id": "ContextualSP",
"token_count": 54
} | 220 |
#%%
import sys
sys.path.append("..")
from typing import List
from utils.data_types import *
@dataclass
class AlignmentExample:
question: str
schema: List[str]
sql: str
identify_results: List[str]
gold_align_lables: List[AlignmentLabel]
pred_align_labels: List[AlignmentLabel]
def get_wrong_... | ContextualSP/awakening_latent_grounding/scripts/results_post_process.slsql.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/scripts/results_post_process.slsql.py",
"repo_id": "ContextualSP",
"token_count": 2099
} | 221 |
#!/usr/bin/env bash
wget https://github.com/terryqj0107/GECOR/raw/master/CamRest676_for_coreference_and_ellipsis_resolution/CamRest676_annotated.json
python ../../preprocess.py --dataset Task | ContextualSP/incomplete_utterance_rewriting/dataset/Task/download.sh/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/dataset/Task/download.sh",
"repo_id": "ContextualSP",
"token_count": 72
} | 222 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Author: Qian Liu (SivilTaram)
# Original Repo: https://github.com/microsoft/ContextualSP
from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import Instance
from allennlp.predictors.predictor import Pre... | ContextualSP/incomplete_utterance_rewriting/src/predictor.py/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/src/predictor.py",
"repo_id": "ContextualSP",
"token_count": 284
} | 223 |
# coding: utf-8
import json
import logging
import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from transformers import BertModel
from src.data import SpiderAlignDataset, BertUtil, SpiderSemQLConverter
from src.loss import HingeLoss
from src.utils.schema_linker import SchemaLi... | ContextualSP/interactive_text_to_sql/src/aligner_model.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/aligner_model.py",
"repo_id": "ContextualSP",
"token_count": 4832
} | 224 |
import json
import requests
def complex_rephrase(query, span, target_span):
url = 'http://172.16.13.25:9009'
headers = {'apikey': '9212c3f48ad1766bcf63535710686d07'}
params = {'query': query,
'span': span,
'target': target_span}
r = requests.get(url, params=params, headers=... | ContextualSP/interactive_text_to_sql/src/utils/external.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/utils/external.py",
"repo_id": "ContextualSP",
"token_count": 164
} | 225 |
import sys
import hashlib
import random
# random.seed(0)
def gen_md5(data):
"""
生成md5
:param data: 字符串数据
:return:
"""
md5 = hashlib.md5()
md5.update(data.encode('utf-8'))
return md5.hexdigest()
def big_file_remove_same(input_file, output_file):
"""
针对大文件文件去重(将文件文件写在一... | ContextualSP/lemon/corpus_generation/remove_same.py/0 | {
"file_path": "ContextualSP/lemon/corpus_generation/remove_same.py",
"repo_id": "ContextualSP",
"token_count": 617
} | 226 |
import numpy as np
import tensorflow as tf
from gtd.ml.framework import Feedable
from gtd.ml.utils import expand_dims_for_broadcast, broadcast
class SequenceBatch(object):
"""Represent a batch of sequences as a Tensor."""
def __init__(self, values, mask, name='SequenceBatch'):
with tf.name_scope(nam... | ContextualSP/lemon/executor/gtd/ml/seq_batch.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/ml/seq_batch.py",
"repo_id": "ContextualSP",
"token_count": 3873
} | 227 |
from collections import Counter
from numpy.testing import assert_approx_equal
from gtd.lm import last_k, CountLM, LMSampler, normalize_counts
import pytest
@pytest.fixture
def lm():
return CountLM(3)
@pytest.fixture
def lm_sampler(lm):
return LMSampler(lm)
def test_last_k():
tokens = [1, 2, 3, 4]
... | ContextualSP/lemon/executor/gtd/tests/test_lm.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/tests/test_lm.py",
"repo_id": "ContextualSP",
"token_count": 777
} | 228 |
import os
import random
import numpy as np
import tensorflow as tf
import gtd.ml.experiment
from dependency.data_directory import DataDirectory
from gtd.chrono import verboserate
from gtd.ml.model import TokenEmbedder
from gtd.ml.utils import guarantee_initialized_variables
from gtd.utils import cached_property, as_... | ContextualSP/lemon/executor/strongsup/experiment.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/experiment.py",
"repo_id": "ContextualSP",
"token_count": 8236
} | 229 |
from codecs import open
from strongsup.example import Context, Example
from strongsup.example_factory import ExampleFactory
from strongsup.rlong.state import RLongAlchemyState, RLongSceneState, RLongTangramsState, RLongUndogramsState
from strongsup.rlong.value import RLongStateValue
from strongsup.rlong.world import R... | ContextualSP/lemon/executor/strongsup/rlong/example_factory.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/rlong/example_factory.py",
"repo_id": "ContextualSP",
"token_count": 1757
} | 230 |
from strongsup.predicate import Predicate
from strongsup.tables.executor import is_unary, is_binary, ALL_BUILT_INS
from strongsup.tables.graph import ALL_GRAPH_BUILT_INS
from strongsup.utils import EOU
class WikiTablePredicate(Predicate):
def __init__(self, name, original_string=None):
types = self._compu... | ContextualSP/lemon/executor/strongsup/tables/predicate.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tables/predicate.py",
"repo_id": "ContextualSP",
"token_count": 1415
} | 231 |
from gtd.utils import Bunch
from strongsup.example import Utterance
class TestUtterance(object):
def test_eq(self):
ctx1 = Bunch()
ctx2 = Bunch()
utt1 = Utterance(('a', 'b', 'c'), ctx1, 0)
utt2 = Utterance(('AA', 'B', 'CCC'), ctx1, 0)
utt3 = Utterance(('a', 'b', 'c'), ctx2... | ContextualSP/lemon/executor/strongsup/tests/test_example.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tests/test_example.py",
"repo_id": "ContextualSP",
"token_count": 195
} | 232 |
DATASET_PATH=path_to_dataset
MODEL_PATH=path_to_bart_large
python -m bpe_encoder \
--encoder-json $MODEL_PATH/encoder.json \
--vocab-bpe $MODEL_PATH/vocab.bpe \
--inputs $DATASET_PATH/train.src \
--outputs $DATASET_PATH/train.bpe.src \
--workers 20 \
... | ContextualSP/lemon/lemon/preprocess_pretrain.bat/0 | {
"file_path": "ContextualSP/lemon/lemon/preprocess_pretrain.bat",
"repo_id": "ContextualSP",
"token_count": 786
} | 233 |
#!/bin/bash
set -euo pipefail
if [[ ! -f OpenBookQA-V1-Sep2018.zip ]]; then
echo Missing file OpenBookQA-V1-Sep2018.zip
echo
echo Download it first: https://s3-us-west-2.amazonaws.com/ai2-website/data/OpenBookQA-V1-Sep2018.zip
exit 1
fi
unzip -p OpenBookQA-V1-Sep2018.zip OpenBookQA-V1-Sep2018/Data/Main/test... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/openbookqa/data/build-dummy-predictions.sh/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/openbookqa/data/build-dummy-predictions.sh",
"repo_id": "ContextualSP",
"token_count": 181
} | 234 |
import sys
def corrupted_action_file(filename: str, details: str, line_num: int = None):
if line_num is None:
print(f"Corrupted or empty action file {filename} ({details})")
else:
print(f"Corrupted action file {filename} on line {line_num} ({details})")
sys.exit(2)
def corrupted_sentence... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/errors/errors.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/errors/errors.py",
"repo_id": "ContextualSP",
"token_count": 159
} | 235 |
import unittest
from process import ProcessSummary, Conversion, Move, Input, Output
from scoring import question, QuestionScores
class TestScoring(unittest.TestCase):
def test_compare_locations(self):
self.assertEquals(question._compare_locations('', ''), 1.0)
self.assertEquals(question._compare... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/scoring/test_scoring.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/scoring/test_scoring.py",
"repo_id": "ContextualSP",
"token_count": 3528
} | 236 |
#!/bin/bash
set -euo pipefail
if [[ ! -f qasc_dataset.tar.gz ]]; then
echo Missing file qasc_dataset.tar.gz
echo
echo Download it first: http://data.allenai.org/downloads/qasc/qasc_dataset.tar.gz
exit 1
fi
# Questions with correct answers for train and dev (test set is hidden)
tar -zxvOf qasc_dataset.tar.gz... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/qasc/data/build-files.sh/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/qasc/data/build-files.sh",
"repo_id": "ContextualSP",
"token_count": 340
} | 237 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.