repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/layer_norm.py
fairseq/modules/layer_norm.py
# 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 apex.normalization import FusedLayerNorm as _FusedLayerNorm...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/multihead_attention.py
fairseq/modules/multihead_attention.py
# 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 Dict, Optional, Tuple import torch import torch.nn.functional as F from torch import Tensor, nn from torch.nn ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/cross_entropy.py
fairseq/modules/cross_entropy.py
# 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.functional as F logger = logging.getLogger(__name__) def _cross_entropy_pytorch(logits, targe...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/lightweight_convolution.py
fairseq/modules/lightweight_convolution.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.modules.unfold import unfold1d from...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/fairseq_dropout.py
fairseq/modules/fairseq_dropout.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import List, Optional import torch.nn as nn import torch.nn.functional as F logger = logging.getLogger(__name__)...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/scalar_bias.py
fairseq/modules/scalar_bias.py
# 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 class ScalarBias(torch.autograd.Function): """ Adds a vector of scalars, used in self-attention mechanism to allow ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/gelu.py
fairseq/modules/gelu.py
# 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. """ See "Gaussian Error Linear Units (GELUs)" by Dan Hendrycks and Kevin Gimpel with the corresponding GitHub repo: https://github.com/hendryck...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/__init__.py
fairseq/modules/__init__.py
# 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 .adaptive_input import AdaptiveInput from .adaptive_softmax import AdaptiveSoftmax from .beamable_mm import BeamableMM from .character_to...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/adaptive_softmax.py
fairseq/modules/adaptive_softmax.py
# 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 operator import functools import torch import torch.nn.functional as F from fairseq.modules.quant_noise import quant_noise from fairse...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/layer_drop.py
fairseq/modules/layer_drop.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ LayerDrop as described in https://arxiv.org/abs/1909.11556. """ import torch import torch.nn as nn class LayerDropModuleList(nn.ModuleLi...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/adaptive_input.py
fairseq/modules/adaptive_input.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from torch import nn from fairseq.modules.quant_noise import quant_noise from typing import List class AdaptiveInput(nn.Modul...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/sinusoidal_positional_embedding.py
fairseq/modules/sinusoidal_positional_embedding.py
# 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 ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/character_token_embedder.py
fairseq/modules/character_token_embedder.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import List, Tuple import torch from torch import nn import torch.nn.functional as F from fairseq.data import Dic...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/kmeans_vector_quantizer.py
fairseq/modules/kmeans_vector_quantizer.py
# 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 from fairseq.modules import Fp32GroupNorm class KmeansVectorQuantizer(nn.Module): def __init__( ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/vggblock.py
fairseq/modules/vggblock.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals from collections.abc import Iterable from itertools import...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/transformer_sentence_encoder_layer.py
fairseq/modules/transformer_sentence_encoder_layer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Callable, Optional import torch import torch.nn as nn from fairseq import utils from fairseq.modules import ( LayerNo...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/learned_positional_embedding.py
fairseq/modules/learned_positional_embedding.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, Optional import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from torch imp...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/dynamic_crf_layer.py
fairseq/modules/dynamic_crf_layer.py
# 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...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/quantization_options.py
fairseq/modules/quantization/quantization_options.py
# 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 parse_config_yaml(yaml_data): # Initialize to default options. quantization_options = { "n_centroids": { "Lin...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/__init__.py
fairseq/modules/quantization/__init__.py
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/ops.py
fairseq/modules/quantization/scalar/ops.py
# 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 def emulate_int(w, bits, method, scale=None, zero_point=None): q = globals()[f"emulate_int{bits}_{method}"] return q(w,...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/utils.py
fairseq/modules/quantization/scalar/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from operator import attrgetter import torch.nn as nn import torch.distributed as dist from ..pq.utils import get_layers, att...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/__init__.py
fairseq/modules/quantization/scalar/__init__.py
# 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 .utils import quantize_model_ # NOQA
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/modules/qact.py
fairseq/modules/quantization/scalar/modules/qact.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from ..ops import emulate_int class ActivationQuantizer: """ Fake scalar quantization of the activations using a forwa...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/modules/qemb.py
fairseq/modules/quantization/scalar/modules/qemb.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F from ..ops import emulate_int class IntEmbedding(nn.Module): """ ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/modules/__init__.py
fairseq/modules/quantization/scalar/modules/__init__.py
# 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 .qconv import IntConv2d # NOQA from .qlinear import IntLinear # NOQA from .qemb import IntEmbedding # NOQA from .qact import Activatio...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/modules/qconv.py
fairseq/modules/quantization/scalar/modules/qconv.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn.functional as F from torch.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pair from ..ops im...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/scalar/modules/qlinear.py
fairseq/modules/quantization/scalar/modules/qlinear.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F from ..ops import emulate_int class IntLinear(nn.Module): """ Qu...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/pq.py
fairseq/modules/quantization/pq/pq.py
# 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 .em import EM, EmptyClusterResolveError class PQ(EM): """ Quantizes the layer weights W with the standard Product Quantization ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/utils.py
fairseq/modules/quantization/pq/utils.py
# 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 re from operator import attrgetter, itemgetter import numpy as np import torch.nn as nn import torch.distributed as dis...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/em.py
fairseq/modules/quantization/pq/em.py
# 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 random import logging from collections import Counter import torch class EM: """ EM algorithm used to quantize the...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/__init__.py
fairseq/modules/quantization/pq/__init__.py
# 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 .utils import SizeTracker, quantize_model_ # NOQA
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/modules/qemb.py
fairseq/modules/quantization/pq/modules/qemb.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F class PQEmbedding(nn.Module): """ Quantized counterpart of nn.Emb...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/modules/__init__.py
fairseq/modules/quantization/pq/modules/__init__.py
# 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 .qconv import PQConv2d # NOQA from .qlinear import PQLinear # NOQA from .qemb import PQEmbedding # NOQA
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/modules/qconv.py
fairseq/modules/quantization/pq/modules/qconv.py
# 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...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/quantization/pq/modules/qlinear.py
fairseq/modules/quantization/pq/modules/qlinear.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F class PQLinear(nn.Module): """ Quantized counterpart of nn.Linear...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/lightconv_layer/cuda_function_gen.py
fairseq/modules/lightconv_layer/cuda_function_gen.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. def gen_forward(): kernels = [3, 5, 7, 15, 31, 63, 127, 255] seqs = [32 * x for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/lightconv_layer/lightconv_layer.py
fairseq/modules/lightconv_layer/lightconv_layer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from torch import nn from torch.autograd import Function import torch.nn.functional as F import lightconv_cuda from fairseq impo...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/lightconv_layer/setup.py
fairseq/modules/lightconv_layer/setup.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from torch.utils.cpp_extension import CUDAExtension, BuildExtension setup( name='ligh...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/lightconv_layer/__init__.py
fairseq/modules/lightconv_layer/__init__.py
# 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 .lightconv_layer import LightconvLayer # noqa
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/dynamicconv_layer/cuda_function_gen.py
fairseq/modules/dynamicconv_layer/cuda_function_gen.py
# 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...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/dynamicconv_layer/dynamicconv_layer.py
fairseq/modules/dynamicconv_layer/dynamicconv_layer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from torch import nn from torch.autograd import Function import torch.nn.functional as F import dynamicconv_cuda from fairseq im...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/dynamicconv_layer/setup.py
fairseq/modules/dynamicconv_layer/setup.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from torch.utils.cpp_extension import CUDAExtension, BuildExtension setup( name='dyna...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/modules/dynamicconv_layer/__init__.py
fairseq/modules/dynamicconv_layer/__init__.py
# 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 .dynamicconv_layer import DynamicconvLayer # noqa
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/strip_token_dataset.py
fairseq/data/strip_token_dataset.py
# 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()...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/data_utils.py
fairseq/data/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. try: from collections.abc import Iterable except ImportError: from collections import Iterable import contextlib import itertools impo...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/concat_sentences_dataset.py
fairseq/data/concat_sentences_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class ConcatSentencesDataset(FairseqDataset): def __init__(self, *datasets): super()...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/lm_context_window_dataset.py
fairseq/data/lm_context_window_dataset.py
# 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.monolingual_dataset import MonolingualDataset from . import FairseqDataset class LMConte...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/monolingual_dataset.py
fairseq/data/monolingual_dataset.py
# 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 data_utils, FairseqDataset def collate(samples, pad_idx, eos_idx): if len(samples) == 0: ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/base_wrapper_dataset.py
fairseq/data/base_wrapper_dataset.py
# 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.utils.data.dataloader import default_collate from . import FairseqDataset class BaseWrapperDataset(FairseqDataset): def __i...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/plasma_utils.py
fairseq/data/plasma_utils.py
# 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 subprocess import tempfile class PlasmaArray(object): """ Wrapper around numpy arrays that automatically moves the data to sh...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/multi_corpus_dataset.py
fairseq/data/multi_corpus_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from collections import OrderedDict from typing import Dict, List import numpy as np from fairseq.data import data_utils from...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/numel_dataset.py
fairseq/data/numel_dataset.py
# 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 NumelDataset(BaseWrapperDataset): def __init__(self, dataset, r...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/subsample_dataset.py
fairseq/data/subsample_dataset.py
# 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 from . import BaseWrapperDataset logger = logging.getLogger(__name__) class SubsampleDataset(BaseWrapp...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/denoising_dataset.py
fairseq/data/denoising_dataset.py
# 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 math from . import data_utils, FairseqDataset def collate( samples, pad_idx, eos_idx, ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/colorize_dataset.py
fairseq/data/colorize_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import BaseWrapperDataset class ColorizeDataset(BaseWrapperDataset): """ Adds 'colors' property to net input that i...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/list_dataset.py
fairseq/data/list_dataset.py
# 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 ListDataset(BaseWrapperDataset): def __init__(self, dataset, sizes=None): super().__init...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/transform_eos_lang_pair_dataset.py
fairseq/data/transform_eos_lang_pair_dataset.py
# 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 FairseqDataset import torch from typing import Optional class TransformEosLangPairDataset(FairseqDataset): """A :class:`~...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/append_token_dataset.py
fairseq/data/append_token_dataset.py
# 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, data...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/iterators.py
fairseq/data/iterators.py
# 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 itertools import logging import math import operator import os import queue import time from threading import Thread import numpy as n...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/shorten_dataset.py
fairseq/data/shorten_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np from fairseq.data import data_utils from . import BaseWrapperDataset class TruncateDataset(BaseWrapperDataset): """T...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/token_block_dataset.py
fairseq/data/token_block_dataset.py
# 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 class TokenBlockDataset(FairseqDataset): """Break...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/raw_label_dataset.py
fairseq/data/raw_label_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class RawLabelDataset(FairseqDataset): def __init__(self, labels): super().__init__(...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/fairseq_dataset.py
fairseq/data/fairseq_dataset.py
# 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.utils.data from fairseq.data import data_utils class EpochListening: """Mixin for receiving updates whe...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/num_samples_dataset.py
fairseq/data/num_samples_dataset.py
# 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 FairseqDataset class NumSamplesDataset(FairseqDataset): def __getitem__(self, index): return 1 def __len__(s...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/transform_eos_dataset.py
fairseq/data/transform_eos_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class TransformEosDataset(FairseqDataset): """A :class:`~fairseq.data.FairseqDataset` wrapper...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/backtranslation_dataset.py
fairseq/data/backtranslation_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq import utils from . import FairseqDataset def backtranslate_samples(samples, collate_fn, generate_fn, cuda=True)...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/lru_cache_dataset.py
fairseq/data/lru_cache_dataset.py
# 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...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/language_pair_dataset.py
fairseq/data/language_pair_dataset.py
# 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 data_utils, FairseqDataset logger = logging.getLogger(__name__) ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/dictionary.py
fairseq/data/dictionary.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from collections import Counter from multiprocessing import Pool import torch from fairseq import utils from fairseq.binarizer impo...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/fasta_dataset.py
fairseq/data/fasta_dataset.py
# 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 subprocess import threading from pathlib import Path import numpy as np import torch def fasta_file_path(prefix_path): ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/mask_tokens_dataset.py
fairseq/data/mask_tokens_dataset.py
# 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 import numpy as np import torch from fairseq.data import data_utils, Dictionary from . import BaseWrapperDa...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/prepend_token_dataset.py
fairseq/data/prepend_token_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import BaseWrapperDataset class PrependTokenDataset(BaseWrapperDataset): def __init__(self, dat...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/multi_corpus_sampled_dataset.py
fairseq/data/multi_corpus_sampled_dataset.py
# 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 typing import Callable, Dict, List import numpy as np from . import FairseqDataset def uniform_sa...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/__init__.py
fairseq/data/__init__.py
# 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 .dictionary import Dictionary, TruncatedDictionary from .fairseq_dataset import FairseqDataset, FairseqIterableDataset from .base_wrapp...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/replace_dataset.py
fairseq/data/replace_dataset.py
# 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 ReplaceDataset(BaseWrapperDataset): """Replaces tokens found in the dataset by a specified replac...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/noising.py
fairseq/data/noising.py
# 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 numpy as np from fairseq.data import data_utils class WordNoising(object): """Generate a noisy version of a sentenc...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/prepend_dataset.py
fairseq/data/prepend_dataset.py
# 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, ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/add_target_dataset.py
fairseq/data/add_target_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import BaseWrapperDataset from . import data_utils class AddTargetDataset(BaseWrapperDataset): def __init__(self, d...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/id_dataset.py
fairseq/data/id_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class IdDataset(FairseqDataset): def __getitem__(self, index): return index def...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/pad_dataset.py
fairseq/data/pad_dataset.py
# 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,...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/bucket_pad_length_dataset.py
fairseq/data/bucket_pad_length_dataset.py
# 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.nn.functional as F from fairseq.data import BaseWrapperDataset class BucketPadLengthDataset(BaseWrapperData...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/sort_dataset.py
fairseq/data/sort_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np from . import BaseWrapperDataset class SortDataset(BaseWrapperDataset): def __init__(self, dataset, sort_order): ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/round_robin_zip_datasets.py
fairseq/data/round_robin_zip_datasets.py
# 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 import numpy as np from . import FairseqDataset class RoundRobinZipDatasets(FairseqDataset): """Zi...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/indexed_dataset.py
fairseq/data/indexed_dataset.py
# 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 import os import shutil import struct import numpy as np import torch from . import FairseqDataset from fair...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/roll_dataset.py
fairseq/data/roll_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import BaseWrapperDataset class RollDataset(BaseWrapperDataset): def __init__(self, dataset, shifts): supe...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/resampling_dataset.py
fairseq/data/resampling_dataset.py
# 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 from fairseq.data import BaseWrapperDataset, plasma_utils logger = logging.getLogger(__name__) class R...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/offset_tokens_dataset.py
fairseq/data/offset_tokens_dataset.py
# 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 OffsetTokensDataset(BaseWrapperDataset): def __init__(self, dataset, offset): super().__...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/nested_dictionary_dataset.py
fairseq/data/nested_dictionary_dataset.py
# 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 import torch from torch.utils.data.dataloader import default_collate from . import FairseqDataset def ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/concat_dataset.py
fairseq/data/concat_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import bisect import numpy as np from torch.utils.data.dataloader import default_collate from . import FairseqDataset class ConcatDataset(...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/multilingual/sampled_multi_epoch_dataset.py
fairseq/data/multilingual/sampled_multi_epoch_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import hashlib import math import logging import time import numpy as np import torch from fairseq import distributed_utils from fairseq.data...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/multilingual/multilingual_data_manager.py
fairseq/data/multilingual/multilingual_data_manager.py
# 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 itertools import json import logging import os from collections import OrderedDict import numpy as np from fairseq import options, uti...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
true
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/multilingual/sampled_multi_dataset.py
fairseq/data/multilingual/sampled_multi_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import List from enum import Enum from collections import OrderedDict from collections import defaultdict from bisect import bisec...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/multilingual/__init__.py
fairseq/data/multilingual/__init__.py
# 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.
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/multilingual/sampling_method.py
fairseq/data/multilingual/sampling_method.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import List import logging logger = logging.getLogger(__name__) def uniform(dataset_sizes: List[int]): return [1.0] * len(...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/subword_nmt_bpe.py
fairseq/data/encoders/subword_nmt_bpe.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq import file_utils from fairseq.data.encoders import register_bpe @register_bpe('subword_nmt') class SubwordNMTBPE(object): ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/hf_byte_bpe.py
fairseq/data/encoders/hf_byte_bpe.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq.data.encoders import register_bpe @register_bpe('hf_byte_bpe') class HuggingFaceByteLevelBPE(object): @staticmethod de...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/gpt2_bpe.py
fairseq/data/encoders/gpt2_bpe.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq import file_utils from fairseq.data.encoders import register_bpe from .gpt2_bpe_utils import get_encoder DEFAULT_ENCODER_JSON ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/gpt2_bpe_utils.py
fairseq/data/encoders/gpt2_bpe_utils.py
""" Byte pair encoding utilities from GPT-2. Original source: https://github.com/openai/gpt-2/blob/master/src/encoder.py Original license: MIT """ from functools import lru_cache import json @lru_cache() def bytes_to_unicode(): """ Returns list of utf-8 byte and a corresponding list of unicode strings. ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/hf_bert_bpe.py
fairseq/data/encoders/hf_bert_bpe.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq.data.encoders import register_bpe @register_bpe('bert') class BertBPE(object): @staticmethod def add_args(parser): ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false