repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/legacy_distributed_data_parallel.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. """ A modified version of the legacy DistributedDataParallel module that uses c10d communication primitives. This version is simpler than the ...
6,265
35.430233
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/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. import argparse from typing import Callable, List, Optional import torch from fairseq import utils from fairseq.data.indexed_dataset import g...
19,595
43.334842
120
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/token_generation_constraints.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. """Implements tracking of constraints for a beam item. A list of constraints is given as a list of one or more token sequences, each of lengt...
16,555
31.654832
96
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/file_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. """ Utilities for working with the local dataset cache. This file is adapted from `AllenNLP <https://github.com/allenai/allennlp>`_. and `hugg...
11,237
30.745763
92
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/incremental_decoding_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 uuid from typing import Dict, Optional from torch import Tensor class FairseqIncrementalState(object): def __init__(self, *args,...
1,773
33.115385
76
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/search.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 List, Optional import torch import torch.nn as nn from fairseq.token_generation_constraints import ( Const...
31,337
37.451534
100
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/nan_detector.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 logger = logging.getLogger(__name__) class NanDetector: """ Detects the first NaN or Inf in forward a...
3,755
33.458716
119
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/iterative_refinement_generator.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 namedtuple import numpy as np import torch from fairseq import utils DecoderOut = namedtuple( "IterativeRefinem...
13,238
35.775
93
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/trainer.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. """ Train a network across multiple GPUs. """ import contextlib import logging import sys import time from itertools import chain from typing...
43,187
36.851008
94
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 LayerNorm, Mul...
4,145
29.711111
84
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
2,259
35.451613
94
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/sparse_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 import torch from .multihead_attention import MultiheadAttention class SparseMultiheadAttention(MultiheadAttention): """Sp...
4,931
33.978723
86
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 fairseq import utils from fairseq.incr...
19,274
38.417178
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/transpose_last.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. """ transpose last 2 dimensions of the input """ import torch.nn as nn class TransposeLast(nn.Module): def __init__(self, deconstruct_id...
550
25.238095
65
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/same_pad.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 import nn class SamePad(nn.Module): def __init__(self, kernel_size): super().__init__() self.remove = kernel...
432
21.789474
65
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/linearized_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.functional as F from fairseq import utils from fairseq.incremental_decoding_utils import with_incremental_state ...
4,314
40.095238
83
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/downsampled_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 import torch import torch.nn as nn import torch.nn.functional as F from fairseq.modules.fairseq_dropout import FairseqDropout f...
10,673
32.671924
106
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/quant_noise.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 def quant_noise(module, p, block_size): """ Wraps modules and applies quantization noise to the w...
4,005
36.092593
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
706
26.192308
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/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 torch.nn as nn from .learned_positional_embedding import LearnedPositionalEmbedding from .sinusoidal_positional_embedding import Sinus...
1,295
35
83
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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__)...
1,686
31.442308
83
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
1,737
27.966667
82
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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. from typing import List import torch from fairseq.modules.quant_noise import quant_noise from torch import nn class AdaptiveInput(nn.Modul...
2,566
30.691358
82
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/gumbel_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 import torch.nn.functional as F class GumbelVectorQuantizer(nn.Module): def __init__( self, ...
6,781
32.91
117
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
4,057
33.683761
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 import torch.nn.functional as F from fairseq.data import Dictionary from torch imp...
6,974
31.44186
97
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/unfold.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.nn.functional as F def unfold1d(x, kernel_size, padding_l, pad_value=0): """unfold T x B x C to T x B x C x K""" if ker...
596
28.85
84
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/fp32_group_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. """ Layer norm done in fp32 (for fp16 training) """ import torch.nn as nn import torch.nn.functional as F class Fp32GroupNorm(nn.GroupNorm):...
727
27
69
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 functools import operator import torch import torch.nn.functional as F from fairseq.modules.fairseq_dropout import FairseqDropout from...
8,789
31.67658
85
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/conv_tbc.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.nn.modules.utils import _single class ConvTBC(torch.nn.Module): """1D convolution over an input of shape (time x...
1,409
31.790698
80
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/transformer_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 Dict, List, Optional import torch import torch.nn as nn from fairseq import utils from fairseq.modules import LayerNorm, M...
16,954
38.988208
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/beamable_mm.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 class BeamableMM(nn.Module): """This module provides an optimized MM for beam decoding with attention...
1,763
34.28
80
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
1,500
28.431373
81
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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__( ...
4,170
31.585938
83
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
1,409
30.333333
71
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
7,717
39.621053
99
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 ...
888
26.78125
74
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/transformer_sentence_encoder.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 Optional, Tuple import torch import torch.nn as nn from fairseq.modules import ( FairseqDropout, LayerDropModuleLi...
9,983
33.787456
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/grad_multiply.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 GradMultiply(torch.autograd.Function): @staticmethod def forward(ctx, x, scale): ctx.scale = scale ...
442
22.315789
65
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/sparse_transformer_sentence_encoder.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.nn as nn from fairseq.modules import TransformerSentenceEncoder from fairseq.modules.sparse_transformer_sentence_encoder_layer im...
3,155
31.536082
71
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 ...
3,880
35.613208
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.incremental_decoding_utils import wi...
10,919
34.11254
103
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/modules/dynamic_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.incremental_decoding_utils import wi...
11,579
36.967213
132
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 BuildExtension, CUDAExtension setup( name="dyn...
602
24.125
67
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 dynamicconv_cuda import torch import torch.nn.functional as F from fairseq import utils from fairseq.incremental_decoding_utils import ...
8,921
38.131579
116
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 logging import os import random from collections import Counter import torch class EM: """ EM algorithm used to quantize the...
7,333
33.59434
92
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.distributed as dist import torch.nn as n...
11,619
33.378698
100
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
2,547
34.388889
86
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
4,245
35.603448
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
3,719
33.444444
86
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.distributed as dist import torch.nn as nn from ..pq.utils import attrsetter, get...
2,446
30.371795
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,...
1,683
32.68
77
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
3,631
30.859649
101
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
4,450
28.673333
90
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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): """ ...
4,986
32.695946
93
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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...
3,079
33.606742
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 BuildExtension, CUDAExtension setup( name="lig...
581
23.25
67
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 lightconv_cuda import torch import torch.nn.functional as F from fairseq import utils from fairseq.incremental_decoding_utils import wi...
4,799
33.782609
86
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/dataclass/data_class.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 sys from argparse import Namespace from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Tuple, Type ...
28,804
36.215762
150
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/linformer/linformer_src/modules/multihead_linear_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 fairseq import utils from fairseq.incr...
19,243
38.596708
98
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/linformer/linformer_src/modules/linformer_sentence_encoder.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 import torch.nn as nn from fairseq.modules import TransformerSentenceEncoder from .linformer_sentence_encoder_layer import Linfo...
6,319
36.176471
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/wav2vec/vq-wav2vec_featurize.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. """ Helper script to pre-compute embeddings for a wav2letter++ dataset """ import argparse import glob import os impor...
7,751
29.519685
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/wav2vec/wav2vec_featurize.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. """ Helper script to pre-compute embeddings for a wav2letter++ dataset """ import argparse import glob import os from ...
7,110
27.218254
135
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/criss/save_encoder.py
#!/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...
7,420
33.67757
90
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/translation_moe/translation_moe_src/mean_pool_gating_network.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 class MeanPoolGatingNetwork(torch.nn.Module): """A simple mean-pooling gating network for s...
2,005
38.333333
84
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/translation_moe/translation_moe_src/logsumexp_moe.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 LogSumExpMoE(torch.autograd.Function): """Standard LogSumExp forward pass, but use *posterior* for the backward. ...
837
30.037037
78
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/translation_moe/translation_moe_src/translation_moe.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 metrics, utils from fairseq.tasks import register_task from fairseq.tasks.translation import TranslationTask ...
9,385
38.108333
95
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/latent_depth/latent_depth_src/modules/latent_layers.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 class LayerSelect(nn.Module): """Compute samples (from a Gumbel-Sigmoid distribution) which is used a...
2,956
32.988506
86
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/latent_depth/latent_depth_src/models/latent_transformer.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 Any, Dict, Optional import torch.nn as nn from fairseq.models.fairseq_encoder import EncoderOut from fairseq.models.transf...
5,240
34.653061
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/latent_depth/latent_depth_src/loss/latent_depth.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 import torch from torch.nn.modules.loss import _Loss class LatentLayersKLLoss(_Loss): def __init__(self, args): sup...
3,802
37.03
86
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_to_text/prep_covost_data.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. import argparse import csv import logging import os import os.path as op import shutil from tempfile import NamedTempor...
9,618
31.60678
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_to_text/prep_librispeech_data.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. import argparse import logging import os import os.path as op import shutil from tempfile import NamedTemporaryFile im...
3,758
30.325
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_to_text/data_utils.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. import csv import os import os.path as op import zipfile from functools import reduce from glob import glob from multip...
8,037
29.562738
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_to_text/prep_mustc_data.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. import argparse import logging import os import os.path as op import shutil from itertools import groupby from tempfile...
7,506
36.348259
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/roberta/commonsense_qa/commonsense_qa_task.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 json import os import numpy as np import torch from fairseq.data import ( Dictionary, IdDataset, ListDataset, NestedDi...
6,124
31.068063
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/roberta/wsc/wsc_task.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 json import os import tempfile import numpy as np import torch import torch.nn.functional as F from fairseq import utils from fairseq....
13,524
32.644279
90
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/roberta/wsc/wsc_criterion.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 import torch import torch.nn.functional as F from fairseq import utils from fairseq.criterions import LegacyFairseqCriterion, reg...
6,023
34.857143
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/infer.py
#!/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 logging import math import os import sys ...
15,443
32.212903
111
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/w2l_decoder.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. """ Wav2letter decoders. """ import gc import itertools as it import os.path as osp import warnings from collections ...
14,874
33.116972
164
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/criterions/cross_entropy_acc.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 import logging import math import torch import torch.nn.f...
5,372
40.015267
85
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/criterions/ASG_loss.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. import torch from examples.speech_recognition.data.replabels import pack_replabels from fairseq import utils from fair...
5,857
33.25731
85
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/models/vggtransformer.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 argparse import math from collections.abc import Iterable import torch import torch.nn as nn from examples.speech_recognition.data.dat...
37,226
35.497059
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/models/w2l_conv_glu_enc.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. import math import torch import torch.nn as nn import torch.nn.functional as F from fairseq.models import ( Fairs...
6,078
33.151685
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/datasets/asr_prep_json.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 __future__ import absolute_import, division, print_function, unicode_literals import argparse import concurrent.f...
3,775
28.968254
84
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/data/collaters.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 module contains collection of classes which implement collate functionalities for various tasks. Collaters should know wh...
4,796
35.340909
84
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/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. import torch def calc_mean_invstddev(feature): if len(feature.size()) != 2: raise ValueError("We expect the input feature to be ...
3,429
32.960396
84
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/data/asr_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 numpy as np from fairseq.data import FairseqDataset from . import data_utils from .collaters import Seq2SeqCollater class...
3,955
31.162602
82
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/speech_recognition/tasks/speech_recognition.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 json import os import re import sys import torch from examples.speech_recognition.data import AsrDataset from examples.speech_recognit...
5,397
33.164557
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/byte_level_bpe/gru_transformer.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. # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the r...
5,027
45.555556
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/simultaneous_translation/modules/monotonic_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 import torch import torch.nn as nn import torch.nn.functional as F from examples.simultaneous_translation.utils.functions import ...
21,794
33.983949
105
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/simultaneous_translation/eval/eval_latency.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 argparse import json import torch from examples.simultaneous_translation.utils.latency import LatencyInference LATENCY_METRICS = [ ...
2,385
29.202532
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/simultaneous_translation/models/transformer_monotonic_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 torch import torch.nn as nn import torch.nn.functional as F from examples.simultaneous_translation.modules.monotonic_transformer_layer ...
10,868
32.650155
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/simultaneous_translation/utils/functions.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 exclusive_cumprod(tensor, dim: int, eps: float = 1e-10): """ Implementing exclusive cumprod. There is cumprod i...
3,950
25.34
87
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/simultaneous_translation/utils/latency.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 LatencyMetric(object): @staticmethod def length_from_padding_mask(padding_mask, batch_first: bool = False): ...
14,758
31.652655
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/pointer_generator/pointer_generator_src/transformer_pg.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 Any, Dict, Optional import torch import torch.nn as nn from fairseq import metrics, utils from fairseq.mode...
21,402
44.635394
102
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/rxf/rxf_src/label_smoothed_cross_entropy_r3f.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 import torch import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions import FairseqCriterion, ...
6,109
37.670886
91
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/examples/rxf/rxf_src/sentence_prediction_r3f.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 import torch import torch.nn.functional as F from fairseq import utils from fairseq.criterions import FairseqCriterion, register_...
6,515
37.105263
96
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/logging/progress_bar.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. """ Wrapper around various loggers and progress bars (e.g., tqdm). """ import atexit import json import logging import os import sys from col...
10,993
29.882022
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/logging/metrics.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. """ A standalone module for aggregating metrics. Metrics can be logged from anywhere using the `log_*` functions defined in this module. The l...
9,304
31.197232
88
py
DDRS-NAT
DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/logging/meters.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 time from collections import OrderedDict from typing import Dict, Optional try: import torch def type_as(a, b)...
7,927
26.150685
79
py