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
robust-transformers
robust-transformers-main/tests/bort/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/bort/test_modeling_tf_bort.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
1,842
34.442308
99
py
robust-transformers
robust-transformers-main/tests/convnext/test_modeling_tf_convnext.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
11,023
38.092199
137
py
robust-transformers
robust-transformers-main/tests/convnext/test_modeling_convnext.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
13,511
38.741176
315
py
robust-transformers
robust-transformers-main/tests/convnext/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/convnext/test_feature_extraction_convnext.py
# coding=utf-8 # Copyright 2022s HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
6,844
33.923469
111
py
robust-transformers
robust-transformers-main/tests/layoutlmv2/test_feature_extraction_layoutlmv2.py
# coding=utf-8 # Copyright 2021 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
12,929
57.243243
3,793
py
robust-transformers
robust-transformers-main/tests/layoutlmv2/test_processor_layoutlmv2.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
22,549
51.44186
1,451
py
robust-transformers
robust-transformers-main/tests/layoutlmv2/test_modeling_layoutlmv2.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
22,608
41.259813
917
py
robust-transformers
robust-transformers-main/tests/layoutlmv2/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/layoutlmv2/test_tokenization_layoutlmv2.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
126,856
51.312165
1,398
py
robust-transformers
robust-transformers-main/tests/layoutlm/test_modeling_tf_layoutlm.py
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors, The Hugging Face Team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
14,179
43.451411
925
py
robust-transformers
robust-transformers-main/tests/layoutlm/test_modeling_layoutlm.py
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors, The Hugging Face Team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
14,920
43.014749
937
py
robust-transformers
robust-transformers-main/tests/layoutlm/test_tokenization_layoutlm.py
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors, The Hugging Face Team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
2,603
33.72
132
py
robust-transformers
robust-transformers-main/tests/layoutlm/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/deberta_v2/test_tokenization_deberta_v2.py
# coding=utf-8 # Copyright 2019 Hugging Face inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
7,796
53.908451
2,664
py
robust-transformers
robust-transformers-main/tests/deberta_v2/test_modeling_deberta_v2.py
# coding=utf-8 # Copyright 2018 Microsoft Authors and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
11,432
39.257042
119
py
robust-transformers
robust-transformers-main/tests/deberta_v2/test_modeling_tf_deberta_v2.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
10,552
36.824373
117
py
robust-transformers
robust-transformers-main/tests/deberta_v2/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/wavlm/test_modeling_wavlm.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
23,759
39.477002
116
py
robust-transformers
robust-transformers-main/tests/wavlm/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/marian/test_modeling_marian.py
# coding=utf-8 # Copyright 2021, The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
29,030
36.604922
123
py
robust-transformers
robust-transformers-main/tests/marian/test_modeling_flax_marian.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
18,340
36.430612
118
py
robust-transformers
robust-transformers-main/tests/marian/test_tokenization_marian.py
# coding=utf-8 # Copyright 2020 Huggingface # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
7,926
56.861314
2,878
py
robust-transformers
robust-transformers-main/tests/marian/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/marian/test_modeling_tf_marian.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
17,741
39.506849
117
py
robust-transformers
robust-transformers-main/tests/flaubert/test_modeling_flaubert.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
16,077
34.888393
117
py
robust-transformers
robust-transformers-main/tests/flaubert/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/flaubert/test_modeling_tf_flaubert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
12,471
33.263736
117
py
robust-transformers
robust-transformers-main/tests/mbart/test_modeling_flax_mbart.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
18,947
39.748387
118
py
robust-transformers
robust-transformers-main/tests/mbart/test_tokenization_mbart.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
13,969
41.852761
300
py
robust-transformers
robust-transformers-main/tests/mbart/test_modeling_tf_mbart.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
14,316
40.378613
112
py
robust-transformers
robust-transformers-main/tests/mbart/test_modeling_mbart.py
# coding=utf-8 # Copyright 2021, The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
26,441
39.18541
298
py
robust-transformers
robust-transformers-main/tests/mbart/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/tests/bigbird_pegasus/test_modeling_bigbird_pegasus.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
109,884
141.153946
43,043
py
robust-transformers
robust-transformers-main/tests/bigbird_pegasus/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/docs/source/_config.py
# docstyle-ignore INSTALL_CONTENT = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ notebook_first_cells = [{"type...
359
39
112
py
robust-transformers
robust-transformers-main/utils/custom_init_isort.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
9,925
40.016529
116
py
robust-transformers
robust-transformers-main/utils/tests_fetcher.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
22,177
40.68797
117
py
robust-transformers
robust-transformers-main/utils/get_modified_files.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
1,484
41.428571
122
py
robust-transformers
robust-transformers-main/utils/check_copies.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
17,421
39.800937
163
py
robust-transformers
robust-transformers-main/utils/check_tf_ops.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
3,574
34.04902
119
py
robust-transformers
robust-transformers-main/utils/prepare_for_doc_test.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
4,701
31.205479
128
py
robust-transformers
robust-transformers-main/utils/check_inits.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
11,088
40.68797
115
py
robust-transformers
robust-transformers-main/utils/release.py
# coding=utf-8 # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
6,066
37.643312
115
py
robust-transformers
robust-transformers-main/utils/download_glue_data.py
""" Script for downloading all GLUE data. Original source: https://gist.github.com/W4ngatang/60c2bdb54d156a41194446737ce03e2e 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://...
8,285
51.443038
615
py
robust-transformers
robust-transformers-main/utils/notification_service.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
27,052
36.730823
126
py
robust-transformers
robust-transformers-main/utils/check_repo.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
30,085
39.656757
141
py
robust-transformers
robust-transformers-main/utils/update_metadata.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
10,573
42.875519
117
py
robust-transformers
robust-transformers-main/utils/check_dummies.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
6,086
35.449102
118
py
robust-transformers
robust-transformers-main/utils/print_env_pt.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
1,006
33.724138
74
py
robust-transformers
robust-transformers-main/utils/check_table.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
9,799
41.060086
118
py
robust-transformers
robust-transformers-main/utils/notification_service_deprecated.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
8,174
36.5
127
py
robust-transformers
robust-transformers-main/utils/style_doc.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
20,676
35.791815
118
py
robust-transformers
robust-transformers-main/utils/test_module/custom_tokenization_fast.py
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class CustomTokenizerFast(BertTokenizerFast): slow_tokenizer_class = CustomTokenizer pass
193
20.555556
48
py
robust-transformers
robust-transformers-main/utils/test_module/custom_tokenization.py
from transformers import BertTokenizer class CustomTokenizer(BertTokenizer): pass
88
13.833333
38
py
robust-transformers
robust-transformers-main/utils/test_module/__init__.py
0
0
0
py
robust-transformers
robust-transformers-main/utils/test_module/custom_processing.py
from transformers import ProcessorMixin class CustomProcessor(ProcessorMixin): feature_extractor_class = "AutoFeatureExtractor" tokenizer_class = "AutoTokenizer"
172
23.714286
52
py
robust-transformers
robust-transformers-main/utils/test_module/custom_feature_extraction.py
from transformers import Wav2Vec2FeatureExtractor class CustomFeatureExtractor(Wav2Vec2FeatureExtractor): pass
117
18.666667
55
py
robust-transformers
robust-transformers-main/utils/test_module/custom_modeling.py
import torch from transformers import PreTrainedModel from .custom_configuration import CustomConfig, NoSuperInitConfig class CustomModel(PreTrainedModel): config_class = CustomConfig def __init__(self, config): super().__init__(config) self.linear = torch.nn.Linear(config.hidden_size, conf...
772
21.735294
77
py
robust-transformers
robust-transformers-main/utils/test_module/custom_configuration.py
from transformers import PretrainedConfig class CustomConfig(PretrainedConfig): model_type = "custom" def __init__(self, attribute=1, **kwargs): self.attribute = attribute super().__init__(**kwargs) class NoSuperInitConfig(PretrainedConfig): model_type = "custom" def __init__(self,...
380
21.411765
46
py
TileTrans
TileTrans-main/reconstructor.py
from typing import Union, List, Dict, Any import torch import torchvision import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as datasets import torchvision.models as models import torch.utils.data as Data import common from metrics import Metrics, MetricsL1, MetricsGradient f...
7,797
47.7375
153
py
TileTrans
TileTrans-main/pruner.py
import os from typing import List, Any from itertools import zip_longest import torch from torch.nn import modules from torch.utils.data.dataloader import DataLoader import torchvision import torch.nn as nn import torch.utils.data as Data import torchvision.transforms as transforms import torchvision.models as models ...
9,324
42.574766
153
py
TileTrans
TileTrans-main/common.py
import torch import torchvision import torch.nn as nn import torchvision.models as models import torch.utils.data as Data import numpy as np import matplotlib.pyplot as plt import sys import torchvision.transforms as transforms import torchvision.datasets as datasets def print_model_weight(net): for layer in net.c...
3,712
37.278351
155
py
TileTrans
TileTrans-main/metrics.py
import os from typing import List, Any import torch import torch.nn as nn from common import get_layers class Metrics(): pass class MetricsL1(Metrics): @staticmethod def eval(layer: nn.Module, *agrs: Any, **kargs: Any): return torch.abs(layer.weight) @staticmethod def hook_func(*args...
1,626
26.576271
82
py
TileTrans
TileTrans-main/train.py
import torch import torchvision import torch.nn as nn import torch.utils.data as Data import torch.distributed as dist import numpy as np import matplotlib.pyplot as plt import torchvision.models as models import torchvision.transforms as transforms GPU_NUM=2 def check_correct_rate(net, test_loader): correct_num ...
3,058
30.214286
136
py
speechbrain
speechbrain-main/conftest.py
def pytest_addoption(parser): parser.addoption("--device", action="store", default="cpu") def pytest_generate_tests(metafunc): # This is called for every test. Only get/set command line arguments # if the argument is specified in the list of test "fixturenames". option_value = metafunc.config.option.d...
1,213
34.705882
76
py
speechbrain
speechbrain-main/setup.py
#!/usr/bin/env python3 import os import sys import site import setuptools from distutils.core import setup # Editable install in user site directory can be allowed with this hack: # https://github.com/pypa/pip/issues/7953. site.ENABLE_USER_SITE = "--user" in sys.argv[1:] with open("README.md") as f: long_descrip...
1,280
25.6875
72
py
speechbrain
speechbrain-main/tools/compute_wer.py
#!/usr/bin/env python3 """This script computes Word Error Rate and other related information. Just given a reference and a hypothesis, the script closely matches Kaldi's compute_wer binary. Additionally, the script can produce human-readable edit distance alignments, and find the top WER utterances and speakers. Usag...
5,817
34.47561
135
py
speechbrain
speechbrain-main/tools/g2p.py
"""A convenience script to transcribe text into phonemes using a pretrained Grapheme-to-Phoneme (G2P) model The scripts to train G2P models are located in recipes/LibriSpeech/G2P Usage ----- Command-line Grapheme-to-Phoneme conversion tool optional arguments: -h, --help show this help message and exit ...
12,964
27.939732
93
py
speechbrain
speechbrain-main/tools/profiling/profile.py
"""Example recipe to benchmark SpeechBrain using PyTorch profiling. A pretrained interference is benchmarked for real-time factors and memory peaks across audio durations and batch sizes. Profiling is carried out either on random data (pure noise) or on an example file that is truncated and repeated to be representati...
13,246
32.45202
119
py
speechbrain
speechbrain-main/speechbrain/core.py
"""Core SpeechBrain code for running experiments. Authors * Peter Plantinga 2020 * Abdel Heba 2020 * Mirco Ravanelli 2020 * Aku Rouhe 2021 * Andreas Nautsch 2022 """ import os import sys import yaml import time import torch import shutil import logging import inspect import pathlib import argparse import tempfil...
54,493
36.608006
102
py
speechbrain
speechbrain-main/speechbrain/__init__.py
""" Comprehensive speech processing toolkit """ import os from .core import Stage, Brain, create_experiment_directory, parse_arguments from . import alignment # noqa from . import dataio # noqa from . import decoders # noqa from . import lobes # noqa from . import lm # noqa from . import nnet # noqa from . import...
627
23.153846
76
py
speechbrain
speechbrain-main/speechbrain/tokenizers/SentencePiece.py
"""Library for Byte-pair-encoding (BPE) tokenization. Authors * Abdelwahab Heba 2020 * Loren Lugosch 2020 """ import os.path import torch import logging import csv import json import sentencepiece as spm from speechbrain.dataio.dataio import merge_char from speechbrain.utils import edit_distance from speechbrain.uti...
19,212
40.229614
119
py
speechbrain
speechbrain-main/speechbrain/tokenizers/__init__.py
""" Package defining the SentencePiece tokenizer """
53
17
48
py
speechbrain
speechbrain-main/speechbrain/decoders/seq2seq.py
"""Decoding methods for seq2seq autoregressive model. Authors * Adel Moumen 2022 * Ju-Chieh Chou 2020 * Peter Plantinga 2020 * Mirco Ravanelli 2020 * Sung-Lin Yeh 2020 """ import torch import speechbrain as sb from speechbrain.decoders.ctc import CTCPrefixScorer class S2SBaseSearcher(torch.nn.Module): """S...
56,679
33.560976
121
py
speechbrain
speechbrain-main/speechbrain/decoders/ctc.py
"""Decoders and output normalization for CTC. Authors * Mirco Ravanelli 2020 * Aku Rouhe 2020 * Sung-Lin Yeh 2020 """ import torch from itertools import groupby from speechbrain.dataio.dataio import length_to_mask class CTCPrefixScorer: """This class implements the CTC prefix scorer of Algorithm 2 in refe...
13,350
34.413793
119
py
speechbrain
speechbrain-main/speechbrain/decoders/__init__.py
""" Package containing the different decoders (ctc, beamsearch ...) """ from .seq2seq import * # noqa from .ctc import * # noqa
130
25.2
67
py
speechbrain
speechbrain-main/speechbrain/decoders/transducer.py
"""Decoders and output normalization for Transducer sequence. Author: Abdelwahab HEBA 2020 Sung-Lin Yeh 2020 """ import torch from functools import partial class TransducerBeamSearcher(torch.nn.Module): """ This class implements the beam-search algorithm for the transducer model. Parameters ...
19,715
35.309392
111
py
speechbrain
speechbrain-main/speechbrain/wordemb/transformer.py
""" A convenience wrapper for word embeddings retrieved out of HuggingFace transformers (e.g. BERT) Authors * Artem Ploujnikov 2021 """ import torch import numpy as np from torch import nn def _last_n_layers(count): return range(-count, 0) class TransformerWordEmbeddings(nn.Module): """A wrapper to retri...
9,176
30.003378
92
py
speechbrain
speechbrain-main/speechbrain/wordemb/util.py
""" Utilities for word embeddings Authors * Artem Ploujnikov 2021 """ import torch def expand_to_chars(emb, seq, seq_len, word_separator): """Expands word embeddings to a sequence of character embeddings, assigning each character the word embedding of the word to which it belongs Arguments -----...
2,076
25.974026
76
py
speechbrain
speechbrain-main/speechbrain/wordemb/__init__.py
0
0
0
py
speechbrain
speechbrain-main/speechbrain/nnet/embedding.py
"""Library implementing embedding. Authors * Abdelwahab Heba 2020 """ import torch import logging import torch.nn as nn logger = logging.getLogger(__name__) class Embedding(nn.Module): """Computes an embedding x = wx. Arguments --------- num_embeddings : int Size of the dictionary of embe...
3,928
33.165217
120
py
speechbrain
speechbrain-main/speechbrain/nnet/pooling.py
"""Library implementing pooling. Authors * Titouan Parcollet 2020 * Mirco Ravanelli 2020 * Nauman Dawalatabad 2020 * Jianyuan Zhong 2020 * Sarthak Yadav 2022 """ import torch import logging import torch.nn as nn import torch.nn.functional as F logger = logging.getLogger(__name__) class Pooling1d(nn.Module): ...
16,006
29.316288
114
py
speechbrain
speechbrain-main/speechbrain/nnet/losses.py
""" Losses for training neural networks. Authors * Mirco Ravanelli 2020 * Samuele Cornell 2020 * Hwidong Na 2020 * Yan Gao 2020 * Titouan Parcollet 2020 """ import math import torch import logging import functools import numpy as np import torch.nn as nn import torch.nn.functional as F from itertools import perm...
40,423
31.28754
117
py
speechbrain
speechbrain-main/speechbrain/nnet/CNN.py
"""Library implementing convolutional neural networks. Authors * Mirco Ravanelli 2020 * Jianyuan Zhong 2020 * Cem Subakan 2021 * Davide Borra 2021 * Andreas Nautsch 2022 * Sarthak Yadav 2022 """ import math import torch import logging import numpy as np import torch.nn as nn import torch.nn.functional as F impo...
47,329
30.261559
117
py
speechbrain
speechbrain-main/speechbrain/nnet/schedulers.py
""" Schedulers for updating hyperparameters (such as learning rate). Authors * Mirco Ravanelli 2020 * Peter Plantinga 2020 * Loren Lugosch 2020 """ import math import torch import logging from speechbrain.utils import checkpoints logger = logging.getLogger(__name__) def update_learning_rate(optimizer, new_lr, ...
35,940
31.379279
119
py
speechbrain
speechbrain-main/speechbrain/nnet/quantisers.py
""" Gumbel Softmax implementation with multiple groups possible. Authors * Rudolf A. Braun 2022 """ import torch import torch.nn as nn import torch.nn.functional as F class GumbelVectorQuantizer(nn.Module): """Vector quantization using gumbel softmax. Copied from fairseq implementation. Arguments -----...
3,699
28.83871
104
py
speechbrain
speechbrain-main/speechbrain/nnet/RNN.py
"""Library implementing recurrent neural networks. Authors * Mirco Ravanelli 2020 * Ju-Chieh Chou 2020 * Jianyuan Zhong 2020 * Loren Lugosch 2020 """ import torch import logging import torch.nn as nn from speechbrain.nnet.attention import ( ContentBasedAttention, LocationAwareAttention, KeyValueAttent...
49,939
29.999379
82
py
speechbrain
speechbrain-main/speechbrain/nnet/linear.py
"""Library implementing linear transformation. Authors * Mirco Ravanelli 2020 * Davide Borra 2021 """ import torch import logging import torch.nn as nn logger = logging.getLogger(__name__) class Linear(torch.nn.Module): """Computes a linear transformation y = wx + b. Arguments --------- n_neuron...
3,506
27.056
107
py
speechbrain
speechbrain-main/speechbrain/nnet/dropout.py
"""Library implementing dropout. Authors * Mirco Ravanelli 2020 """ import torch # noqa: F401 import logging import torch.nn as nn logger = logging.getLogger(__name__) class Dropout2d(nn.Module): """This function implements dropout 2d. It randomly put zeros on entire channels. Arguments --------...
1,320
22.175439
72
py
speechbrain
speechbrain-main/speechbrain/nnet/activations.py
"""Library implementing activation functions. Authors * Mirco Ravanelli 2020 * Jianyuan Zhong 2020 """ import torch import logging import torch.nn.functional as F logger = logging.getLogger(__name__) class Softmax(torch.nn.Module): """Computes the softmax of a 2d, 3d, or 4d input tensor. Arguments -...
3,474
23.300699
144
py
speechbrain
speechbrain-main/speechbrain/nnet/__init__.py
""" Package containing the different neural networks layers """ import os __all__ = [] for filename in os.listdir(os.path.dirname(__file__)): filename = os.path.basename(filename) if filename.endswith(".py") and not filename.startswith("__"): __all__.append(filename[:-3]) from . import * # noqa from ...
351
26.076923
66
py
speechbrain
speechbrain-main/speechbrain/nnet/normalization.py
"""Library implementing normalization. Authors * Mirco Ravanelli 2020 * Guillermo Cámbara 2021 * Sarthak Yadav 2022 """ import torch import torch.nn as nn class BatchNorm1d(nn.Module): """Applies 1d batch normalization to the input tensor. Arguments --------- input_shape : tuple The expec...
18,623
28.942122
118
py
speechbrain
speechbrain-main/speechbrain/nnet/attention.py
"""Library implementing attention modules. Authors * Ju-Chieh Chou 2020 * Jianyuan Zhong 2020 * Loren Lugosch 2020 * Samuele Cornell 2020 """ import torch import logging import torch.nn as nn import numpy as np from typing import Optional from speechbrain.dataio.dataio import length_to_mask import torch.nn.functi...
28,426
32.841667
149
py
speechbrain
speechbrain-main/speechbrain/nnet/containers.py
"""Library for implementing cascade (sequences) of different neural modules. Authors * Peter Plantinga 2020 """ import torch import inspect import logging import operator import functools from speechbrain.nnet.linear import Linear from speechbrain.utils.callchains import lengths_arg_exists logger = logging.getLogge...
13,475
33.911917
80
py
speechbrain
speechbrain-main/speechbrain/nnet/complex_networks/c_CNN.py
"""Library implementing complex-valued convolutional neural networks. Authors * Titouan Parcollet 2020 """ import torch import torch.nn as nn import logging import torch.nn.functional as F from speechbrain.nnet.CNN import get_padding_elem from speechbrain.nnet.complex_networks.c_ops import ( unitary_init, com...
14,753
29.995798
95
py
speechbrain
speechbrain-main/speechbrain/nnet/complex_networks/c_normalization.py
"""Library implementing complex-valued normalization. Authors * Titouan Parcollet 2020 """ import torch from torch.nn import Parameter import numpy as np from speechbrain.nnet.complex_networks.c_ops import multi_mean class CBatchNorm(torch.nn.Module): """This class is implements the complex-valued batch-normal...
26,368
34.730352
80
py
speechbrain
speechbrain-main/speechbrain/nnet/complex_networks/c_ops.py
"""This library implements different operations needed by complex- valued architectures. This work is inspired by: "Deep Complex Networks" from Trabelsi C. et al. Authors * Titouan Parcollet 2020 """ import torch import torch.nn.functional as F import numpy as np def check_complex_input(input_shape): """Che...
9,840
29.28
80
py
speechbrain
speechbrain-main/speechbrain/nnet/complex_networks/__init__.py
"""Package containing complex neural networks """
50
16
45
py