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/data/encoders/moses_tokenizer.py
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 fairseq.data.encoders import register_tokenizer @register_tokenizer('moses') class MosesTokenizer(object): @staticmethod def a...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/sentencepiece_bpe.py
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 fairseq import file_utils from fairseq.data.encoders import register_bpe @register_bpe('sentencepiece') class SentencepieceBPE(object):...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/nltk_tokenizer.py
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 @register_tokenizer('nltk') class NLTKTokenizer(object): def __init__(self, source...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/fastbpe.py
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 fairseq import file_utils from fairseq.data.encoders import register_bpe @register_bpe('fastbpe') class fastBPE(object): @staticme...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/utils.py
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...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/space_tokenizer.py
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 @register_tokenizer('space') class SpaceTokenizer(object): def __init__...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/bytes.py
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 (byte_encode, smart_byte_decode, ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/__init__.py
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_registry(...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/characters.py
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(objec...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/byte_utils.py
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 PRINT...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/encoders/byte_bpe.py
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 fairseq import file_utils from fairseq.data.encoders import register_bpe from fairseq.data.encoders.byte_utils import (byte_encode, smar...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/audio/raw_audio_dataset.py
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 os import logging import numpy as np import sys import torch import torch.nn.functional as F from .. import FairseqDataset logger =...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/audio/__init__.py
fairseq/data/audio/__init__.py
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/legacy/masked_lm_dictionary.py
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...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/legacy/block_pair_dataset.py
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...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/legacy/masked_lm_dataset.py
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 import numpy as np import torch from typing import Dict, List, Tuple from fairseq.data import FairseqDataset, data_utils from ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/data/legacy/__init__.py
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 .masked_lm_dictionary import BertDictionary, MaskedLMDictionary from .block_pair_dataset import BlockPairDataset from .masked_lm_dataset ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/scoring/__init__.py
fairseq/scoring/__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_scoring, register_scoring, SCORING_REGISTRY = registry.setup_registry( ...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/scoring/wer.py
fairseq/scoring/wer.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.scoring import register_scoring @register_scoring("wer") class WerScorer(object): def __init__(self, *unused): self...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
ofirpress/shortformer
https://github.com/ofirpress/shortformer/blob/edc411ff896ae042c01d939a32c1e4a33e238083/fairseq/scoring/bleu.py
fairseq/scoring/bleu.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 ctypes import math import sys import torch from fairseq.scoring import register_scoring class BleuStat(ctypes.Structure): _fiel...
python
MIT
edc411ff896ae042c01d939a32c1e4a33e238083
2026-01-05T07:14:08.244122Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/train.py
bert/train.py
#!/usr/bin/env python3 -u # 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. """ Train...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/inference.py
bert/inference.py
#!/usr/bin/env python3 -u # 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. """ Evalu...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/setup.py
bert/setup.py
#!/usr/bin/env python3 # 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. from setupt...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/generate.py
bert/generate.py
#!/usr/bin/env python3 -u # 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. """ Trans...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/interactive.py
bert/interactive.py
#!/usr/bin/env python3 -u # 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. """ Trans...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/score.py
bert/score.py
#!/usr/bin/env python3 # 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. """ BLEU sco...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/preprocess_bert.py
bert/preprocess_bert.py
#!/usr/bin/env python3 # 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. """ Data pre...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/multiprocessing_train.py
bert/multiprocessing_train.py
#!/usr/bin/env python3 -u # 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 o...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/eval_lm.py
bert/eval_lm.py
#!/usr/bin/env python3 -u # 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. """ Evalu...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/distributed_train.py
bert/distributed_train.py
#!/usr/bin/env python3 -u # 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 o...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/preprocess.py
bert/preprocess.py
#!/usr/bin/env python3 # 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. """ Data pre...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/scripts/build_sym_alignment.py
bert/scripts/build_sym_alignment.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. # """ Use this script in order to ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/scripts/__init__.py
bert/scripts/__init__.py
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/scripts/average_checkpoints.py
bert/scripts/average_checkpoints.py
#!/usr/bin/env python3 import argparse import collections import torch import os import re def average_checkpoints(inputs): """Loads checkpoints from inputs and returns a model with averaged weights. Args: inputs: An iterable of string paths of checkpoints to load from. Returns: A dict of s...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/scripts/read_binarized.py
bert/scripts/read_binarized.py
#!/usr/bin/env python3 # 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 ar...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_sequence_scorer.py
bert/tests/test_sequence_scorer.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 argparse import unittest i...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_convtbc.py
bert/tests/test_convtbc.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 torch import unittest from ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_utils.py
bert/tests/test_utils.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 unittest import torch fro...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_reproducibility.py
bert/tests/test_reproducibility.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 contextlib from io import S...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_sequence_generator.py
bert/tests/test_sequence_generator.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 argparse import unittest i...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/utils.py
bert/tests/utils.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 argparse import torch from...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_dictionary.py
bert/tests/test_dictionary.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 tempfile import unittest i...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_label_smoothing.py
bert/tests/test_label_smoothing.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 argparse import copy import...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/__init__.py
bert/tests/__init__.py
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_binaries.py
bert/tests/test_binaries.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 contextlib from io import S...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_backtranslation_dataset.py
bert/tests/test_backtranslation_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. import argparse import unittest i...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_character_token_embedder.py
bert/tests/test_character_token_embedder.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 torch import unittest from...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_average_checkpoints.py
bert/tests/test_average_checkpoints.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 collections import os impor...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_iterators.py
bert/tests/test_iterators.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 unittest from fairseq.data...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/tests/test_train.py
bert/tests/test_train.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 contextlib from io import S...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/bert/concat_short_sentences.py
bert/macaron-scripts/bert/concat_short_sentences.py
import sys def score(line1, line2): # the smaller the more likely to be concat s = len(line1) + len(line2) if s > 250: return 9999999 if line1[-1] in ['.', '"', '!', '?']: s += 5 return s def main(): buf = [] for line in sys.stdin: words = line.strip().split() ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/bert/filter_and_cleanup_lines.py
bert/macaron-scripts/bert/filter_and_cleanup_lines.py
import re import string import sys from collections import Counter def is_valid(line): l = len(line) if l > 1000000 or l < 50: return False count = Counter(line) alpha_cnt = sum(count[ch] for ch in string.ascii_letters) if alpha_cnt < 50 or alpha_cnt / l < 0.7: return False if ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/bert/WikiExtractor.py
bert/macaron-scripts/bert/WikiExtractor.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= # Version: 2.75 (March 4, 2017) # Author: Giuseppe Attardi (attardi@di.unipi.it), University of Pisa # # Contributors: # Antonio Fuschetto (fuschett@aol.com) # Leonardo Souza (lsouza@amt...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
true
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/bert/split.py
bert/macaron-scripts/bert/split.py
import sys def main(): cnt = 0 f_cnt = 0 input_file = sys.argv[1] output_prefix = sys.argv[2] chunk_size = int(sys.argv[3]) f_ov = open(f'{output_prefix}.valid.txt', 'w', encoding='utf-8') f_ot = None with open(input_file, 'r', encoding='utf-8') as f_in: for line in f_in: ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/bert/segment_sentence.py
bert/macaron-scripts/bert/segment_sentence.py
import re import sys from multiprocessing import Pool import spacy spacy.require_gpu() nlp = None def init(): global nlp nlp = spacy.load('en', disable=['tagger', 'ner', 'textcat']) def segment(line): global nlp return ''.join([str(sent) + '\n' for sent in nlp(line).sents ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/test/generate_test_scripts.py
bert/macaron-scripts/test/generate_test_scripts.py
import os import sys import copy import itertools import inspect def task(name, n_sentences, task, criterion, symmetric, n_classes, data_path): return locals() def params(*args): keys = ["seed_list", "n_epoch_list", "batch_sz_list", "lr_list", "weight_decay_list"] assert len(args) == len(keys) values ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/common/precleanup_english.py
bert/macaron-scripts/common/precleanup_english.py
import re import sys def pre_cleanup(line): line = line.replace('\t', ' ') # replace tab with spaces line = ' '.join(line.strip().split()) # remove redundant spaces line = re.sub(r'\.{4,}', '...', line) # remove extra dots line = line.replace('<<', '«').replace('>>', '»') # group << together l...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/common/remove_non_utf8_chars.py
bert/macaron-scripts/common/remove_non_utf8_chars.py
import io import sys for line in io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore'): sys.stdout.write(line)
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/common/truncate_by_token.py
bert/macaron-scripts/common/truncate_by_token.py
import sys max_len = int(sys.argv[1]) for line in sys.stdin: lst = line.strip().split(' ') if len(lst) <= max_len: sys.stdout.write(line) else: sys.stdout.write(" ".join(lst[:max_len]) + '\n')
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/common/length_filter_by_token.py
bert/macaron-scripts/common/length_filter_by_token.py
import sys for line in sys.stdin: l = len(line.strip().split(' ')) if int(sys.argv[1]) <= l <= int(sys.argv[2]): sys.stdout.write(line) else: sys.stdout.write('\n')
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/common/length_filter_by_char.py
bert/macaron-scripts/common/length_filter_by_char.py
import sys for line in sys.stdin: l = len(line) if int(sys.argv[1]) <= l <= int(sys.argv[2]): sys.stdout.write(line) else: sys.stdout.write('\n')
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_wnli.py
bert/macaron-scripts/glue/generate_wnli.py
import argparse import csv import os import torch def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, help="path of output") args = parser.par...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_mnli.py
bert/macaron-scripts/glue/generate_mnli.py
import argparse import csv import os import torch _label_to_id = { 'neutral': 0, 'entailment': 1, 'contradiction': 2 } def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, r...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_diagnostic.py
bert/macaron-scripts/glue/generate_diagnostic.py
import argparse import csv import os _label_to_id = { 'neutral': 0, 'entailment': 1, 'contradiction': 2 } def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_sts.py
bert/macaron-scripts/glue/generate_sts.py
import argparse import csv import os import torch def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, help="path of output") args = parser.pars...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/process_predictions.py
bert/macaron-scripts/glue/process_predictions.py
import argparse import os rte_labels = ['not_entailment', 'entailment'] mnli_labels = ['neutral', 'entailment', 'contradiction'] qnli_labels = ['not_entailment', 'entailment'] def main(): parser = argparse.ArgumentParser() parser.add_argument('input', type=str, help='input path of pre...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/align_text.py
bert/macaron-scripts/glue/align_text.py
import sys import re for line in sys.stdin: re.sub(r" n't\b", "n't", line) re.sub(r" 's\b", "'s", line) sys.stdout.write(line)
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_cola.py
bert/macaron-scripts/glue/generate_cola.py
import argparse import csv import os import torch def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, help="path of output") args = parser.par...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/single_sentence.py
bert/macaron-scripts/glue/single_sentence.py
import argparse import csv import os import torch def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, help="path of output") args = parser.par...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_mrpc.py
bert/macaron-scripts/glue/generate_mrpc.py
import argparse import csv import os import torch def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, help="path of output") args = parser.par...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_rte.py
bert/macaron-scripts/glue/generate_rte.py
import argparse import csv import os import torch _label_to_id = { 'not_entailment': 0, 'entailment': 1 } def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_mnli_mm.py
bert/macaron-scripts/glue/generate_mnli_mm.py
import argparse import csv import os import torch _label_to_id = { 'neutral': 0, 'entailment': 1, 'contradiction': 2 } def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, r...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_qqp.py
bert/macaron-scripts/glue/generate_qqp.py
import argparse import csv import os import torch def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, help="path of output") args = parser.pars...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/generate_qnli.py
bert/macaron-scripts/glue/generate_qnli.py
import argparse import csv import os import torch _label_to_id = { 'not_entailment': 0, 'entailment': 1 } def main(): parser = argparse.ArgumentParser() parser.add_argument("data", type=str, help="path of data") parser.add_argument("--output", type=str, required=True, ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/macaron-scripts/glue/download_glue_data.py
bert/macaron-scripts/glue/download_glue_data.py
''' Script for downloading all GLUE data. Note: for legal reasons, we are unable to host MRPC. You can either use the version hosted by the SentEval team, which is already tokenized, or you can download the original data from (https://download.microsoft.com/download/D/4/6/D46FF87A-F6B9-4252-AA8B-3604ED519838/MSRParaph...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/search.py
bert/fairseq/search.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 torch class Search(object...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/distributed_utils.py
bert/fairseq/distributed_utils.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. from collections import namedtuple...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/utils.py
bert/fairseq/utils.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. from collections import defaultdic...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/multiprocessing_pdb.py
bert/fairseq/multiprocessing_pdb.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 multiprocessing import os i...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/trainer.py
bert/fairseq/trainer.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. """ Train a network across multipl...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/__init__.py
bert/fairseq/__init__.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. from .multiprocessing_pdb import p...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/tokenizer.py
bert/fairseq/tokenizer.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. from collections import Counter im...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/sequence_generator.py
bert/fairseq/sequence_generator.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 math import torch from fa...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/meters.py
bert/fairseq/meters.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 time class AverageMeter(o...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/progress_bar.py
bert/fairseq/progress_bar.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. """ Wrapper around various loggers...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/bleu.py
bert/fairseq/bleu.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 ctypes import math import t...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/sequence_scorer.py
bert/fairseq/sequence_scorer.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 torch from fairseq import ...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/options.py
bert/fairseq/options.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 argparse import torch fro...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/tasks/bert.py
bert/fairseq/tasks/bert.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 itertools import os import...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/tasks/fairseq_task.py
bert/fairseq/tasks/fairseq_task.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. from fairseq.data import data_util...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/tasks/translation.py
bert/fairseq/tasks/translation.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 itertools import numpy as n...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/tasks/glue.py
bert/fairseq/tasks/glue.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 itertools import os import...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/tasks/__init__.py
bert/fairseq/tasks/__init__.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 argparse import importlib i...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/tasks/language_modeling.py
bert/fairseq/tasks/language_modeling.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 itertools import numpy as n...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/models/distributed_fairseq_model.py
bert/fairseq/models/distributed_fairseq_model.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. from torch.nn import parallel fro...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/models/fconv.py
bert/fairseq/models/fconv.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 math import torch import to...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/models/fconv_self_att.py
bert/fairseq/models/fconv_self_att.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 math import torch import...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/models/fairseq_encoder.py
bert/fairseq/models/fairseq_encoder.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 torch.nn as nn class Fair...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/models/fairseq_incremental_decoder.py
bert/fairseq/models/fairseq_incremental_decoder.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. from . import FairseqDecoder cla...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false
zhuohan123/macaron-net
https://github.com/zhuohan123/macaron-net/blob/3a84e7a3323bd1a3a9a303194ba336d670a1fb2c/bert/fairseq/models/lstm.py
bert/fairseq/models/lstm.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 torch import torch.nn as nn...
python
BSD-3-Clause
3a84e7a3323bd1a3a9a303194ba336d670a1fb2c
2026-01-05T07:14:10.995304Z
false