repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
sign-topic | sign-topic-main/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 logging
import numpy as np
import torch.utils.data
from fairseq.data import data_utils
logger = logging.getLogger(__name__)
class Ep... | 7,123 | 33.582524 | 91 | py |
sign-topic | sign-topic-main/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... | 4,575 | 36.818182 | 88 | py |
sign-topic | sign-topic-main/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_... | 729 | 21.121212 | 65 | py |
sign-topic | sign-topic-main/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__(se... | 404 | 21.5 | 65 | py |
sign-topic | sign-topic-main/fairseq/data/sign_language/sign_features_dataset.py | # This code is inspired by the raw_audio_dataset implementation (commit: 1575f30)
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import logging
from enum import Enum
from pathl... | 11,111 | 37.317241 | 146 | py |
sign-topic | sign-topic-main/fairseq/data/sign_language/utils.py | import torch
import torch.nn.functional as F
from typing import List, Tuple, Optional
from fairseq.data.sign_language import SignFeatsType
def get_num_feats(
feats_type: SignFeatsType,
bodyparts: Optional[List[str]] = None,
feat_dims: Optional[List[int]] = None
) -> int:
num_feats = {
SignFea... | 4,214 | 38.764151 | 179 | py |
sign-topic | sign-topic-main/fairseq/data/sign_language/SL_topic_detection_dataset.py | import os
import sys
import logging
from enum import Enum
from pathlib import Path
from typing import List, Union, Optional
import h5py
import numpy as np
import pandas as pd
import torchvision
import torch
import torch.nn.functional as F
from fairseq.data import FairseqDataset
from fairseq.data.text_compressor imp... | 8,658 | 38.903226 | 123 | py |
sign-topic | sign-topic-main/fairseq/data/sign_language/__init__.py | from .sign_features_dataset import (
SignFeatsType,
SignFeatsDataset,
MaskSignFeatsDataset,
RandomCropSignFeatsDataset,
)
from .SL_topic_detection_dataset import (
SignFeatsType,
SLTopicDetectionDataset,
) | 230 | 20 | 41 | py |
sign-topic | sign-topic-main/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.
import datetime
import hashlib
import logging
import time
from bisect import bisect_right
from collections import OrderedDict, defaultdict
fro... | 18,342 | 38.194444 | 119 | py |
sign-topic | sign-topic-main/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.
import logging
from typing import List
logger = logging.getLogger(__name__)
def uniform(dataset_sizes: List[int]):
return [1.0] * len(... | 2,068 | 25.189873 | 78 | py |
sign-topic | sign-topic-main/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 math
import os
from collections import OrderedDict, defaultdict
from argparse import Argume... | 44,985 | 37.88159 | 120 | py |
sign-topic | sign-topic-main/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.
| 177 | 34.6 | 65 | py |
sign-topic | sign-topic-main/fairseq/data/multilingual/multilingual_utils.py | from enum import Enum
from typing import Dict, List, Optional, Sequence
import torch
from fairseq.data import Dictionary
class EncoderLangtok(Enum):
"""
Prepend to the beginning of source sentence either the
source or target language token. (src/tgt).
"""
src = "src"
tgt = "tgt"
class Lang... | 1,623 | 24.375 | 85 | py |
sign-topic | sign-topic-main/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 logging
import math
import numpy as np
from fairseq.data import SampledMultiDataset
from .sampled_multi_dataset import... | 7,827 | 38.14 | 119 | py |
sign-topic | sign-topic-main/fairseq/data/audio/data_cfg.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 argparse import Namespace
from pathlib import Path
from typing import Dict, Optional
from fairseq.data import Dictionary
def get_config... | 9,709 | 32.951049 | 88 | py |
sign-topic | sign-topic-main/fairseq/data/audio/hubert_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 itertools
import logging
import os
import sys
from typing import Any, List, Optional, Union
import numpy as np
import torch
import to... | 12,325 | 34.727536 | 86 | py |
sign-topic | sign-topic-main/fairseq/data/audio/multi_modality_dataset.py | # Copyright (c) 2021-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import logging
import math
from ty... | 9,288 | 34.05283 | 93 | py |
sign-topic | sign-topic-main/fairseq/data/audio/speech_to_speech_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 dataclasses import dataclass
import logging
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
from fa... | 13,961 | 33.304668 | 99 | py |
sign-topic | sign-topic-main/fairseq/data/audio/text_to_speech_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.abs
from pathlib import Path
from t... | 8,583 | 33.473896 | 87 | py |
sign-topic | sign-topic-main/fairseq/data/audio/frm_text_to_speech_dataset.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.abs
import csv
import logging
impor... | 6,923 | 32.61165 | 86 | py |
sign-topic | sign-topic-main/fairseq/data/audio/__init__.py | 0 | 0 | 0 | py | |
sign-topic | sign-topic-main/fairseq/data/audio/raw_audio_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 os
import sys
import io
import numpy as np
import torch
import torch.nn.functional as F
from .. import FairseqDataset... | 13,679 | 33.720812 | 111 | py |
sign-topic | sign-topic-main/fairseq/data/audio/audio_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.
from pathlib import Path
from typing import BinaryIO, Optional, Tuple, Union, List
import mmap
import numpy as np
import torch
import torch.... | 10,253 | 33.759322 | 84 | py |
sign-topic | sign-topic-main/fairseq/data/audio/speech_to_text_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 csv
import io
import logging
import re
from collections import defaultdict
from pathlib import Path
from typing import Dict, List, Opti... | 19,100 | 33.478339 | 87 | py |
sign-topic | sign-topic-main/fairseq/data/audio/speech_to_text_joint_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 pathlib import Path
from typing import Dict, List, Optional, NamedTuple
import torch
from fairseq.data import (
Conca... | 12,544 | 33.847222 | 86 | py |
sign-topic | sign-topic-main/fairseq/data/audio/feature_transforms/delta_deltas.py | import numpy as np
import torch
from fairseq.data.audio.feature_transforms import (
AudioFeatureTransform,
register_audio_feature_transform,
)
@register_audio_feature_transform("delta_deltas")
class DeltaDeltas(AudioFeatureTransform):
"""Expand delta-deltas features from spectrum."""
@classmethod
... | 1,192 | 30.394737 | 79 | py |
sign-topic | sign-topic-main/fairseq/data/audio/feature_transforms/utterance_cmvn.py | import numpy as np
from fairseq.data.audio.feature_transforms import (
AudioFeatureTransform,
register_audio_feature_transform,
)
@register_audio_feature_transform("utterance_cmvn")
class UtteranceCMVN(AudioFeatureTransform):
"""Utterance-level CMVN (cepstral mean and variance normalization)"""
@clas... | 1,189 | 28.02439 | 75 | py |
sign-topic | sign-topic-main/fairseq/data/audio/feature_transforms/specaugment.py | import math
import numbers
from typing import Optional
import numpy as np
from fairseq.data.audio.feature_transforms import (
AudioFeatureTransform,
register_audio_feature_transform,
)
@register_audio_feature_transform("specaugment")
class SpecAugmentTransform(AudioFeatureTransform):
"""SpecAugment (http... | 4,492 | 33.037879 | 87 | py |
sign-topic | sign-topic-main/fairseq/data/audio/feature_transforms/__init__.py | import importlib
import os
from abc import ABC, abstractmethod
from typing import Dict, Optional
class AudioFeatureTransform(ABC):
@classmethod
@abstractmethod
def from_config_dict(cls, config: Optional[Dict] = None):
pass
AUDIO_FEATURE_TRANSFORM_REGISTRY = {}
AUDIO_FEATURE_TRANSFORM_CLASS_NAMES... | 2,611 | 30.46988 | 80 | py |
sign-topic | sign-topic-main/fairseq/data/audio/feature_transforms/global_cmvn.py | import numpy as np
from fairseq.data.audio.feature_transforms import (
AudioFeatureTransform,
register_audio_feature_transform,
)
@register_audio_feature_transform("global_cmvn")
class GlobalCMVN(AudioFeatureTransform):
"""Global CMVN (cepstral mean and variance normalization). The global mean
and var... | 970 | 31.366667 | 84 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/bytes.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
from fairseq.data.encoders.byte_utils import (
SPACE,
SPACE_ESCAPE,
byte_encode,
... | 837 | 22.942857 | 69 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/byte_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 re
WHITESPACE_NORMALIZER = re.compile(r"\s+")
SPACE = chr(32)
SPACE_ESCAPE = chr(9601)
# excluding non-breaking space (160) here
PRIN... | 1,643 | 30.615385 | 84 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/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 dataclasses import dataclass, field
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
from fairseq.data.enc... | 1,404 | 27.673469 | 78 | py |
sign-topic | sign-topic-main/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 dataclasses import dataclass, field
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
from fairseq.dataclass... | 1,488 | 31.369565 | 86 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/nltk_tokenizer.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_tokenizer
from fairseq.dataclass import FairseqDataclass
@register_tokenizer("nltk", dataclass=Fa... | 755 | 29.24 | 75 | py |
sign-topic | sign-topic-main/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 dataclasses import dataclass, field
from fairseq.data.encoders import register_bpe
from fairseq.dataclass import FairseqDataclass
from f... | 1,710 | 32.54902 | 87 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/fastbpe.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 dataclasses import dataclass, field
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
from fairseq.dataclass... | 1,157 | 30.297297 | 83 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/sentencepiece_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 dataclasses import dataclass, field
from typing import Optional
from fairseq import file_utils
from fairseq.data.encoders import registe... | 2,334 | 34.378788 | 87 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/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
from fairseq.data import encoders
def get_whole_word_mask(args, dictionary):
bpe = encoders.build_bpe(args)
if bpe is n... | 909 | 28.354839 | 67 | py |
sign-topic | sign-topic-main/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
"""
import json
from functools import lru_cache
@lru_cache()
def bytes_to_unicode():
"""
Returns list of utf-8 byte and a corresponding list of unicode strings.
... | 4,594 | 31.588652 | 108 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/space_tokenizer.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 re
from fairseq.data.encoders import register_tokenizer
from fairseq.dataclass import FairseqDataclass
@register_tokenizer("space", ... | 590 | 25.863636 | 65 | py |
sign-topic | sign-topic-main/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 dataclasses import dataclass, field
from typing import Optional
from fairseq.data.encoders import register_bpe
from fairseq.dataclass im... | 1,642 | 31.215686 | 82 | py |
sign-topic | sign-topic-main/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 dataclasses import dataclass, field
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
from fairseq.dataclass... | 1,791 | 31.581818 | 87 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/__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.
import importlib
import os
from fairseq import registry
build_tokenizer, register_tokenizer, TOKENIZER_REGISTRY, _ = registry.setup_regist... | 761 | 24.4 | 85 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/moses_tokenizer.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 dataclasses import dataclass, field
from fairseq.data.encoders import register_tokenizer
from fairseq.dataclass import FairseqDataclass
... | 1,660 | 32.22 | 85 | py |
sign-topic | sign-topic-main/fairseq/data/encoders/characters.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
SPACE = chr(32)
SPACE_ESCAPE = chr(9601)
@register_bpe("characters")
class Characters(obje... | 684 | 21.096774 | 65 | py |
sign-topic | sign-topic-main/fairseq/data/huffman/huffman_coder.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 re
import typing as tp
from collections import Counter, deque
from dataclasses import dataclass
from bitarray import bitarray, util
fr... | 8,627 | 31.19403 | 111 | py |
sign-topic | sign-topic-main/fairseq/data/huffman/huffman_mmap_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.
import mmap
import os
import shutil
import struct
import typing as tp
from functools import lru_cache
import numpy as np
import torch
from fa... | 8,809 | 29.590278 | 108 | py |
sign-topic | sign-topic-main/fairseq/data/huffman/__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 .huffman_coder import HuffmanCodeBuilder, HuffmanCoder
from .huffman_mmap_indexed_dataset import (
HuffmanMMapIndex,
HuffmanMMapI... | 577 | 25.272727 | 65 | py |
sign-topic | sign-topic-main/fairseq/data/legacy/block_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 math
import numpy as np
import torch
from fairseq.data import FairseqDataset
class BlockPairDataset(FairseqDataset):
"""Break a ... | 12,877 | 40.275641 | 99 | py |
sign-topic | sign-topic-main/fairseq/data/legacy/masked_lm_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 math
from typing import Dict, List, Tuple
import numpy as np
import torch
from fairseq.data import Dictionary, FairseqDataset, data_ut... | 12,168 | 39.029605 | 88 | py |
sign-topic | sign-topic-main/fairseq/data/legacy/masked_lm_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.
from fairseq.data import Dictionary
class MaskedLMDictionary(Dictionary):
"""
Dictionary for Masked Language Modelling tasks. This e... | 1,560 | 24.590164 | 79 | py |
sign-topic | sign-topic-main/fairseq/data/legacy/__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 .block_pair_dataset import BlockPairDataset
from .masked_lm_dataset import MaskedLMDataset
from .masked_lm_dictionary import BertDictiona... | 454 | 25.764706 | 68 | py |
sign-topic | sign-topic-main/fairseq/tasks/text_to_speech.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 os.path as op
import torch
import torch.nn.functional as F
import numpy as np
from fairseq.data.audio.text_t... | 17,216 | 33.296813 | 88 | py |
sign-topic | sign-topic-main/fairseq/tasks/signs_to_text.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 pathlib import Path
from argparse import Namespace
import json
import pandas as pd
import numpy as np
from fairseq.data ... | 13,444 | 38.660767 | 136 | py |
sign-topic | sign-topic-main/fairseq/tasks/multilingual_denoising.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 numpy as np
from fairseq.data import (
AppendTokenDataset,
ConcatDataset,
DenoisingDataset,
D... | 8,758 | 33.34902 | 91 | py |
sign-topic | sign-topic-main/fairseq/tasks/translation_from_pretrained_bart.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 fairseq.data import LanguagePairDataset
from . import register_task
from .translation import Tran... | 5,243 | 38.428571 | 108 | py |
sign-topic | sign-topic-main/fairseq/tasks/legacy_masked_lm.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 os
import numpy as np
from fairseq import tokenizer, utils
from fairseq.data import ConcatDataset, Dic... | 5,010 | 31.751634 | 88 | py |
sign-topic | sign-topic-main/fairseq/tasks/language_modeling.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
from dataclasses import dataclass, field
from typing import Optional
import numpy as np
import torch
from fairseq im... | 13,912 | 35.231771 | 91 | py |
sign-topic | sign-topic-main/fairseq/tasks/masked_lm.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 dataclasses import dataclass, field
import logging
import os
from omegaconf import MISSING, II, OmegaConf
import numpy as np
from fairs... | 8,643 | 32.765625 | 87 | py |
sign-topic | sign-topic-main/fairseq/tasks/translation.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 dataclasses import dataclass, field
import itertools
import json
import logging
import os
from typing import Optional
from argparse impor... | 17,888 | 34.921687 | 108 | py |
sign-topic | sign-topic-main/fairseq/tasks/translation_from_pretrained_xlm.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 dataclasses import dataclass
from fairseq.data.legacy.masked_lm_dictionary import MaskedLMDictionary
from fairseq.tasks.translation impor... | 1,294 | 31.375 | 83 | py |
sign-topic | sign-topic-main/fairseq/tasks/audio_pretraining.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import logging
import os
import sy... | 7,741 | 36.582524 | 97 | py |
sign-topic | sign-topic-main/fairseq/tasks/semisupervised_translation.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
from collections import OrderedDict
from fairseq import utils
from fairseq.data import (
BacktranslationDataset,... | 20,375 | 40.925926 | 119 | py |
sign-topic | sign-topic-main/fairseq/tasks/cross_lingual_lm.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 os
from collections import OrderedDict
import numpy as np
from fairseq import tokenizer, utils
from fa... | 6,454 | 32.619792 | 88 | py |
sign-topic | sign-topic-main/fairseq/tasks/hubert_pretraining.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import logging
import os
import sy... | 6,219 | 31.395833 | 88 | py |
sign-topic | sign-topic-main/fairseq/tasks/multilingual_masked_lm.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 numpy as np
import torch
from fairseq import utils
from fairseq.data import (
ConcatDataset,
Dictiona... | 12,146 | 34.831858 | 87 | py |
sign-topic | sign-topic-main/fairseq/tasks/multilingual_language_modeling.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
from dataclasses import dataclass, field
from typing import Optional
import numpy as np
import torch
from omegaconf ... | 22,922 | 35.501592 | 102 | py |
sign-topic | sign-topic-main/fairseq/tasks/online_backtranslation.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 contextlib
import json
import logging
import math
import os
from argparse import Namespace
from collections import OrderedDict, default... | 28,578 | 40.843338 | 118 | py |
sign-topic | sign-topic-main/fairseq/tasks/denoising.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
from fairseq import utils
from fairseq.data import (
AppendTokenDataset,
DenoisingDataset,
Dictionary,
... | 8,960 | 31.350181 | 88 | py |
sign-topic | sign-topic-main/fairseq/tasks/multilingual_translation.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 contextlib
import logging
import os
from collections import OrderedDict
from argparse import ArgumentError
import torch
from fairseq i... | 18,125 | 38.149028 | 118 | py |
sign-topic | sign-topic-main/fairseq/tasks/translation_lev.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 dataclasses import dataclass, field
import torch
from fairseq import utils
from fairseq.data import LanguagePairDataset
from fairseq.data... | 7,416 | 36.841837 | 103 | py |
sign-topic | sign-topic-main/fairseq/tasks/SL_topic_detection.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 logging
from pathlib import Path
from argparse import Namespace
import pandas as pd
import numpy as np
import torch
import to... | 15,194 | 39.092348 | 159 | py |
sign-topic | sign-topic-main/fairseq/tasks/simultaneous_translation.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 fairseq.tasks import register_task
from fairseq.tasks.speech_to_text import SpeechToTextTask
from fairseq.tasks.translatio... | 1,226 | 28.214286 | 77 | py |
sign-topic | sign-topic-main/fairseq/tasks/__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.
"""isort:skip_file"""
import argparse
import importlib
import os
from fairseq.dataclass import FairseqDataclass
from fairseq.dataclass.utils ... | 4,365 | 30.868613 | 153 | py |
sign-topic | sign-topic-main/fairseq/tasks/frm_text_to_speech.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 fairseq.data.audio.frm_text_to_speech_dataset import FrmTextToSpeechDatasetCreator
from fairseq.tasks import register_tas... | 2,093 | 36.392857 | 87 | py |
sign-topic | sign-topic-main/fairseq/tasks/sentence_prediction.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 contextlib
from dataclasses import dataclass, field
from typing import Optional
from omegaconf import MISSING... | 9,161 | 30.923345 | 123 | py |
sign-topic | sign-topic-main/fairseq/tasks/fairseq_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 logging
import os
import warnings
from argparse import Namespace
from typing import Any, Callable, Dict, List
import torch
from fairse... | 26,329 | 37.214804 | 110 | py |
sign-topic | sign-topic-main/fairseq/tasks/speech_to_speech.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 argparse import Namespace
import json
import logging
import math
from pathlib import Path
import torch
import torch.nn as nn
from fairse... | 17,278 | 35.530655 | 116 | py |
sign-topic | sign-topic-main/fairseq/tasks/speech_to_text.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 pathlib import Path
from argparse import Namespace
from fairseq.data import Dictionary, encoders
from fairseq.data.audio.... | 5,826 | 34.315152 | 85 | py |
sign-topic | sign-topic-main/fairseq/tasks/audio_finetuning.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import logging
import os
import to... | 13,463 | 38.139535 | 95 | py |
sign-topic | sign-topic-main/fairseq/tasks/translation_multi_simple_epoch.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 datetime
import logging
import time
import torch
from fairseq.data import (
FairseqDataset,
LanguagePairDataset,
ListDatas... | 17,886 | 39.468326 | 113 | py |
sign-topic | sign-topic-main/fairseq/tasks/sentence_ranking.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 numpy as np
from fairseq import utils
from fairseq.data import (
ConcatSentencesDataset,
Dictionary,
... | 6,997 | 30.809091 | 86 | py |
sign-topic | sign-topic-main/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# fairseq documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 17 21:45:30 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | 4,270 | 30.637037 | 80 | py |
sign-topic | sign-topic-main/fairseq_cli/score.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.
"""
BLEU scoring of generated translations against reference translations.
"""
import argparse
import os
import sys
fr... | 3,287 | 30.92233 | 88 | py |
sign-topic | sign-topic-main/fairseq_cli/generate.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 ast
import logging
import math
import os
import sy... | 15,805 | 36.813397 | 180 | py |
sign-topic | sign-topic-main/fairseq_cli/validate.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.
import logging
import os
import sys
from argparse import Namespace
from itertools import chain
import torch
from om... | 5,228 | 32.954545 | 88 | py |
sign-topic | sign-topic-main/fairseq_cli/hydra_train.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.
import logging
import os
import hydra
import torch
from hydra.core.hydra_config import HydraConfig
from omegaconf i... | 2,714 | 28.51087 | 116 | py |
sign-topic | sign-topic-main/fairseq_cli/eval_lm.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.
"""
Evaluate the perplexity of a trained language model.
"""
import logging
import math
import os
import sys
from a... | 11,961 | 33.373563 | 108 | py |
sign-topic | sign-topic-main/fairseq_cli/interactive.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 raw text with a trained model. Batches data on-the-fly.
"""
import ast
import fileinput
import logging... | 11,465 | 35.056604 | 88 | py |
sign-topic | sign-topic-main/fairseq_cli/__init__.py | 0 | 0 | 0 | py | |
sign-topic | sign-topic-main/fairseq_cli/train.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.
"""
Train a new model on one or across multiple GPUs.
"""
import argparse
import logging
import math
import os
impor... | 20,021 | 34.25 | 130 | py |
sign-topic | sign-topic-main/fairseq_cli/preprocess.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.
"""
Data pre-processing: build vocabularies and binarize training data.
"""
import logging
import os
import shutil
impo... | 12,218 | 30.01269 | 87 | py |
OpenRBC | OpenRBC-master/util/rbc_mesh.py | # Generate RBC triangular mesh by optimizing a randomly initialized one
from numpy import *
from scipy import *
from scipy.spatial import *
from time import time
import sys
from getopt import getopt
opts, args = getopt( sys.argv[1:], 's:v:a:e:' )
opts = dict( opts )
n_step = int(opts['-s']) if '-s' in opts ... | 3,262 | 34.086022 | 102 | py |
PuncturedFEM | PuncturedFEM-main/test/test_poly.py | """
Run tests with
python3 -m unittest
"""
import unittest
import sys
import os
sys.path.append(os.path.abspath('../puncturedfem'))
import numpy as np
from puncturedfem import polynomial
class TestTemplate(unittest.TestCase):
def setUp(self):
"""
z[x,y] = 0
"""
self.z = polynomial()
"""
p[x_, y_] :=
... | 5,003 | 18.099237 | 64 | py |
PuncturedFEM | PuncturedFEM-main/test/test_fft_deriv.py | """
Run tests with
python3 -m unittest
"""
import unittest
import sys
import os
sys.path.append(os.path.abspath('../puncturedfem'))
import numpy as np
from puncturedfem.locfun.d2n.fft_deriv import fft_antiderivative, fft_derivative
class TestFFTDerivative(unittest.TestCase):
def setUp(self):
self.n = 16
self.... | 2,062 | 28.471429 | 80 | py |
PuncturedFEM | PuncturedFEM-main/test/test_harmconj.py | """
Run tests with
python3 -m unittest
"""
import unittest
import sys
import os
sys.path.append(os.path.abspath('../puncturedfem'))
import numpy as np
from puncturedfem import quad
from puncturedfem.mesh import edge, cell
from puncturedfem.locfun.d2n.harmconj import get_harmonic_conjugate
class TestHarmonicConjugat... | 4,926 | 25.207447 | 69 | py |
PuncturedFEM | PuncturedFEM-main/test/__init__.py | 0 | 0 | 0 | py | |
PuncturedFEM | PuncturedFEM-main/test/test_locfun.py | """
Run tests with
python3 -m unittest
"""
import unittest
import sys
import os
sys.path.append(os.path.abspath('../puncturedfem'))
import puncturedfem as pf
import numpy as np
class TestLocalFunction(unittest.TestCase):
def setUp(self) -> None:
self.n = 32
self.tol = 1e-6
def tearDown(self) -> None:
self... | 2,706 | 21.747899 | 72 | py |
PuncturedFEM | PuncturedFEM-main/puncturedfem/__init__.py | """
PuncturedFEM
"""
# from . import antilap
# from . import d2n
# from . import locfun
# from . import mesh
# from . import nystrom
# from . import poly
# from . import plot
# from . import quad
from .mesh.quad.quad import quad
from .mesh.edge import edge
from .mesh.cell import cell
from .plot.edges import plot_edg... | 643 | 22.851852 | 56 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.