id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
200
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/chat.py
transformers.commands.chat.ChatArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ChatArguments: """ Arguments for the chat CLI. See the metadata arg for each argument's description -- the medatata will be printed with `transformers chat --help` """ model_name_or_path: Optional[str] = fiel...
@dataclass class ChatArguments: ''' Arguments for the chat CLI. See the metadata arg for each argument's description -- the medatata will be printed with `transformers chat --help` ''' def __post_init__(self): '''Only used for BC `torch_dtype` argument.''' pass
3
2
0
0
0
0
0
1.02
0
0
0
0
0
0
0
0
113
4
54
24
53
55
24
24
23
0
0
0
0
201
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/chat.py
transformers.commands.chat.ChatCommand
import asyncio import copy from transformers import AutoTokenizer, GenerationConfig, PreTrainedTokenizer import platform import os import yaml from argparse import ArgumentParser, Namespace from transformers.commands import BaseTransformersCLICommand from transformers.utils import is_rich_available, is_torch_available ...
class ChatCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): ''' Register this command to argparse so it's available for the transformer-cli Args: parser: Root parser to register command-specific arguments ''' ...
21
8
39
6
31
2
6
0.05
1
7
2
0
2
1
3
25
121
20
96
28
91
5
74
26
70
15
5
4
17
202
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/chat.py
transformers.commands.chat.RichInterface
import re from transformers import AutoTokenizer, GenerationConfig, PreTrainedTokenizer from typing import Optional from huggingface_hub import AsyncInferenceClient, ChatCompletionStreamOutput from collections.abc import AsyncIterator class RichInterface: def __init__(self, model_name: Optional[str]=None, user_na...
class RichInterface: def __init__(self, model_name: Optional[str]=None, user_name: Optional[str]=None): pass async def stream_output(self, stream: AsyncIterator[ChatCompletionStreamOutput]) -> tuple[str, int]: pass def input(self) -> str: '''Gets user input from the console.''' ...
9
6
8
0
6
2
2
0.38
0
1
0
0
8
3
8
8
73
7
48
18
39
18
45
17
36
5
0
4
14
203
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/download.py
transformers.commands.download.DownloadCommand
from . import BaseTransformersCLICommand from argparse import ArgumentParser class DownloadCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): download_parser = parser.add_parser('download') download_parser.add_argument('--cache-dir', type=str, d...
class DownloadCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): pass def __init__(self, model: str, cache: str, force: bool, trust_remote_code: bool): pass def run(self): pass
5
0
10
0
9
0
1
0
1
5
2
0
2
4
3
25
33
3
30
11
24
0
17
10
12
1
5
0
3
204
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/env.py
transformers.commands.env.EnvironmentCommand
from .. import __version__ as version from argparse import ArgumentParser from . import BaseTransformersCLICommand import platform import io import importlib.util import os from ..integrations.deepspeed import is_deepspeed_available import huggingface_hub from ..utils import is_accelerate_available, is_safetensors_avai...
class EnvironmentCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): pass def __init__(self, accelerate_config_file, *args) -> None: pass def run(self): pass @staticmethod def format_dict(d): pass
7
0
26
4
22
1
4
0.03
1
4
0
0
2
1
4
26
111
17
91
31
75
3
65
29
51
13
5
2
16
205
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/run.py
transformers.commands.run.RunCommand
from argparse import ArgumentParser from . import BaseTransformersCLICommand from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline class RunCommand(BaseTransformersCLICommand): def __init__(self, nlp: Pipeline, reader: PipelineDataFormat): self._nlp = nlp self._reader...
class RunCommand(BaseTransformersCLICommand): def __init__(self, nlp: Pipeline, reader: PipelineDataFormat): pass @staticmethod def register_subcommand(parser: ArgumentParser): pass def run(self): pass
5
0
16
1
15
0
2
0.02
1
6
2
0
2
2
3
25
53
4
48
12
43
1
28
11
24
5
5
2
7
206
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/serving.py
transformers.commands.serving.ServeCommand
import functools import uuid from transformers.models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES, MODEL_FOR_IMAGE_TEXT_TO_TEXT_MAPPING_NAMES import base64 from threading import Thread from io import BytesIO import asyncio from tokenizers.decoders import DecodeStream from typing import Optional, Union i...
class ServeCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): ''' Register this command to argparse so it's available for the transformer-cli Args: parser: Root parser to register command-specific arguments ''' ...
50
16
18
1
15
3
2
0.19
1
11
5
0
6
5
7
29
137
13
104
27
90
20
48
18
40
3
5
2
13
207
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/configuration_utils.py
transformers.configuration_utils.PretrainedConfig
import os from .utils.generic import is_timm_config_dict from .dynamic_module_utils import custom_object_save import copy import warnings from .modeling_gguf_pytorch_utils import load_gguf_checkpoint import json from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union from . import __version__ from .utils import...
class PretrainedConfig(PushToHubMixin): ''' Base class for all configuration classes. Handles a few parameters common to all models' configurations as well as methods for loading/downloading/saving configurations. <Tip> A configuration file can be loaded and saved to disk. Loading the configuration...
63
24
28
4
16
8
4
0.67
1
19
0
38
23
33
32
32
1,084
169
551
179
487
370
383
147
348
16
1
3
143
208
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.AlbertConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class AlbertConverter(SpmConverter): def vocab(self, proto): return [(piece.piece, piece.score) if check_number_comma(piece.piece) else (piece.piece, piece.score - 100) for piece in proto.pieces] de...
class AlbertConverter(SpmConverter): def vocab(self, proto): pass def normalizer(self, proto): pass def post_processor(self): pass
4
0
11
1
10
0
2
0
1
0
0
0
3
0
3
14
35
5
30
6
26
0
17
6
13
4
2
1
7
209
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.BarthezConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class BarthezConverter(SpmConverter): def unk_id(self, proto): unk_id = 3 return unk_id def post_processor(self): return processors.TemplateProcessing(single='<s> $A </s>', pair='<s>...
class BarthezConverter(SpmConverter): def unk_id(self, proto): pass def post_processor(self): pass
3
0
6
0
6
0
1
0
1
0
0
0
2
0
2
13
14
1
13
4
10
0
6
4
3
1
2
0
2
210
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.BertConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class BertConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.vocab tokenizer = Tokenizer(WordPiece(vocab...
class BertConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
36
5
31
1
2
0.03
1
1
0
0
1
0
1
3
37
5
32
11
30
1
20
11
18
2
1
1
2
211
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.BertGenerationConverter
class BertGenerationConverter(SpmConverter): pass
class BertGenerationConverter(SpmConverter): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
11
2
0
2
1
1
0
2
1
1
0
2
0
0
212
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.BigBirdConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class BigBirdConverter(SpmConverter): def post_processor(self): return processors.TemplateProcessing(single='[CLS]:0 $A:0 [SEP]:0', pair='[CLS]:0 $A:0 [SEP]:0 $B:1 [SEP]:1', special_tokens=[('[CLS]', sel...
class BigBirdConverter(SpmConverter): def post_processor(self): pass
2
0
9
0
9
0
1
0
1
0
0
0
1
0
1
12
10
0
10
2
8
0
3
2
1
1
2
0
1
213
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.BlenderbotConverter
from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class BlenderbotConverter(Converter): def converted(self) -> Tokenizer: ot = self.original_tokenizer vocab = ot.encoder merges = list...
class BlenderbotConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
26
3
23
0
1
0
1
1
0
0
1
0
1
3
27
3
24
6
22
0
10
6
8
1
1
0
1
214
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.CLIPConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class CLIPConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.encoder merges = list(self.original_tokeniz...
class CLIPConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
40
3
36
1
1
0.03
1
2
0
0
1
0
1
3
41
3
37
6
35
1
11
6
9
1
1
0
1
215
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.CamembertConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class CamembertConverter(SpmConverter): def vocab(self, proto): vocab = [('<s>NOTUSED', 0.0), ('<pad>', 0.0), ('</s>NOTUSED', 0.0), ('<unk>', 0.0), ('<unk>NOTUSED', -100)] vocab += [(piece.piece,...
class CamembertConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def post_processor(self): pass
4
0
8
0
7
1
1
0.09
1
0
0
0
3
0
3
14
27
2
23
5
19
2
10
5
6
1
2
0
3
216
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.Converter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class Converter: def __init__(self, original_tokenizer): self.original_tokenizer = original_tokenizer def converted(self) -> Tokenizer: raise NotImplementedError()
class Converter: def __init__(self, original_tokenizer): pass def converted(self) -> Tokenizer: pass
3
0
2
0
2
0
1
0
0
1
0
17
2
1
2
2
6
1
5
4
2
0
5
4
2
1
0
0
2
217
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.DebertaConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class DebertaConverter(Converter): def converted(self) -> Tokenizer: ot = self.original_tokenizer vocab = ot.encoder merges = list(ot...
class DebertaConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
28
3
25
0
1
0
1
1
0
0
1
0
1
3
29
3
26
6
24
0
10
6
8
1
1
0
1
218
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.DebertaV2Converter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class DebertaV2Converter(SpmConverter): def pre_tokenizer(self, replacement, add_prefix_space): list_pretokenizers = [] if self.original_tokenizer.split_by_punct: list_pretokenizers.a...
class DebertaV2Converter(SpmConverter): def pre_tokenizer(self, replacement, add_prefix_space): pass def normalizer(self, proto): pass def post_processor(self): pass
4
0
9
1
9
0
2
0
1
0
0
0
3
0
3
14
31
4
27
8
23
0
20
8
16
3
2
1
6
219
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.FunnelConverter
from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class FunnelConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.vocab tokenizer = Tokenizer(WordPiece(voc...
class FunnelConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
36
5
31
2
2
0.06
1
1
0
0
1
0
1
3
37
5
32
11
30
2
20
11
18
2
1
1
2
220
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.GPT2Converter
from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from typing import Optional class GPT2Converter(Converter): def converted(self, vocab: Optional[dict[str, int]]=None, merges: Optional[list[tuple[str, str]]]...
class GPT2Converter(Converter): def converted(self, vocab: Optional[dict[str, int]]=None, merges: Optional[list[tuple[str, str]]]=None) -> Tokenizer: pass
2
0
35
2
31
2
4
0.06
1
3
0
1
1
0
1
3
36
2
32
6
30
2
16
6
14
4
1
1
4
221
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.GemmaConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class GemmaConverter(SpmConverter): handle_byte_fallback = True SpmExtractor = GemmaSentencePieceExtractor special_tokens = {'<start_of_turn>', '<end_of_turn>'} '"\n split_by_unicode_script: true\n...
class GemmaConverter(SpmConverter): def normalizer(self, proto): pass def vocab(self, proto): pass def pre_tokenizer(self, replacement, add_prefix_space): pass def unk_id(self, proto): pass def decoder(self, replacement, add_prefix_space): pass
6
0
6
0
5
0
1
0.35
1
0
0
1
5
0
5
16
48
6
31
12
25
11
20
12
14
3
2
2
7
222
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.GemmaSentencePieceExtractor
class GemmaSentencePieceExtractor(SentencePieceExtractor): def extract(self, vocab_scores=None) -> tuple[dict[str, int], list[tuple]]: """ By default will return vocab and merges with respect to their order, by sending `vocab_scores` we're going to order the merges with respect to the piece...
class GemmaSentencePieceExtractor(SentencePieceExtractor): def extract(self, vocab_scores=None) -> tuple[dict[str, int], list[tuple]]: ''' By default will return vocab and merges with respect to their order, by sending `vocab_scores` we're going to order the merges with respect to the piece...
2
1
14
2
6
6
1
0.86
1
3
0
0
1
0
1
3
15
2
7
5
5
6
7
5
5
1
1
0
1
223
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.HeliumConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece from .utils import is_protobuf_available, is_sentencepiece_available, logging, requires_backends class HeliumConverter(SpmConverter): handle_byte_fallback = T...
class HeliumConverter(SpmConverter): def __init__(self, vocab_file=None, *args): pass def tokenizer(self, proto): pass def vocab(self, proto): pass def unk_id(self, proto): pass def decoder(self, replacement, add_prefix_space): pass def normalizer(s...
9
0
10
0
9
1
1
0.06
1
1
0
0
8
1
8
19
87
11
72
22
63
4
38
20
29
3
2
2
10
224
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.HerbertConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class HerbertConverter(Converter): def converted(self) -> Tokenizer: tokenizer_info_str = '#version:' token_suffix = '</w>' vocab = s...
class HerbertConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
28
4
24
1
2
0.04
1
1
0
0
1
0
1
3
29
4
25
7
23
1
14
7
12
2
1
1
2
225
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.LayoutLMv2Converter
from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class LayoutLMv2Converter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.vocab tokenizer = Tokenizer(WordPiece...
class LayoutLMv2Converter(Converter): def converted(self) -> Tokenizer: pass
2
0
36
5
31
1
2
0.03
1
1
0
0
1
0
1
3
37
5
32
11
30
1
20
11
18
2
1
1
2
226
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.LlamaConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class LlamaConverter(SpmConverter): handle_byte_fallback = True def vocab(self, proto): vocab = [(self.original_tokenizer.convert_ids_to_tokens(0), 0.0), (self.original_tokenizer.convert_ids_to_token...
class LlamaConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def decoder(self, replacement, add_prefix_space): pass def normalizer(self, proto): pass def pre_tokenizer(self, replacement, add_prefix_space): pass def ...
7
0
6
0
6
1
2
0.08
1
0
0
2
6
0
6
17
44
6
37
13
30
3
29
13
22
3
2
2
10
227
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.MBart50Converter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class MBart50Converter(SpmConverter): def vocab(self, proto): vocab = [('<s>', 0.0), ('<pad>', 0.0), ('</s>', 0.0), ('<unk>', 0.0)] vocab += [(piece.piece, piece.score) for piece in proto.pieces[...
class MBart50Converter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def post_processor(self): pass
4
0
7
0
7
0
1
0.04
1
0
0
0
3
0
3
14
25
2
23
5
19
1
11
5
7
1
2
0
3
228
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.MBartConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class MBartConverter(SpmConverter): def vocab(self, proto): vocab = [('<s>', 0.0), ('<pad>', 0.0), ('</s>', 0.0), ('<unk>', 0.0)] vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:...
class MBartConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def post_processor(self): pass
4
0
16
0
16
0
1
0
1
0
0
0
3
0
3
14
51
2
49
5
45
0
11
5
7
1
2
0
3
229
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.MPNetConverter
from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class MPNetConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.vocab tokenizer = Tokenizer(WordPiece(voca...
class MPNetConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
36
5
31
2
2
0.06
1
1
0
0
1
0
1
3
37
5
32
11
30
2
20
11
18
2
1
1
2
230
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.MarkupLMConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class MarkupLMConverter(Converter): def converted(self) -> Tokenizer: ot = self.original_tokenizer vocab = ot.encoder merges = list(o...
class MarkupLMConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
35
5
30
0
1
0
1
2
0
0
1
0
1
3
36
5
31
10
29
0
14
10
12
1
1
0
1
231
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.MoshiConverter
from .utils import is_protobuf_available, is_sentencepiece_available, logging, requires_backends from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class MoshiConverter(SpmConverter): handle_byte_fallback = True def __init__(self, vocab_file, model_max_lengt...
class MoshiConverter(SpmConverter): def __init__(self, vocab_file, model_max_length=None, **kwargs): pass def normalizer(self, proto): pass def decoder(self, replacement, add_prefix_space): pass def pre_tokenizer(self, replacement, add_prefix_space): pass
5
0
8
1
7
0
2
0.03
1
0
0
0
4
1
4
15
39
7
31
14
26
1
24
13
19
2
2
1
6
232
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.NllbConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class NllbConverter(SpmConverter): def vocab(self, proto): vocab = [('<s>', 0.0), ('<pad>', 0.0), ('</s>', 0.0), ('<unk>', 0.0)] vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]...
class NllbConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def post_processor(self): pass
4
0
7
0
7
0
1
0
1
0
0
0
3
0
3
14
23
2
21
5
17
0
9
5
5
1
2
0
3
233
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.OpenAIGPTConverter
from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class OpenAIGPTConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.encoder merges = list(self.original_to...
class OpenAIGPTConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
24
4
20
0
2
0
1
2
0
0
1
0
1
3
25
4
21
6
19
0
12
6
10
2
1
1
2
234
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.PegasusConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class PegasusConverter(SpmConverter): def vocab(self, proto): vocab = [(self.original_tokenizer.pad_token, 0.0), (self.original_tokenizer.eos_token, 0.0)] if self.original_tokenizer.mask_token_se...
class PegasusConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def pre_tokenizer(self, replacement, add_prefix_space): pass def post_processor(self): pass
5
0
9
1
8
0
2
0
1
1
0
0
4
0
4
15
38
6
32
9
27
0
19
9
14
3
2
1
6
235
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.Qwen2Converter
from typing import Optional from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class Qwen2Converter(Converter): def converted(self, vocab: Optional[dict[str, int]]=None, merges: Optional[list[tuple[str, str]]...
class Qwen2Converter(Converter): def converted(self, vocab: Optional[dict[str, int]]=None, merges: Optional[list[tuple[str, str]]]=None) -> Tokenizer: pass
2
0
41
5
36
0
3
0
1
3
0
1
1
1
1
3
42
5
37
4
35
0
12
3
10
3
1
1
3
236
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.ReformerConverter
class ReformerConverter(SpmConverter): pass
class ReformerConverter(SpmConverter): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
11
2
0
2
1
1
0
2
1
1
0
2
0
0
237
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.RemBertConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class RemBertConverter(SpmConverter): def normalizer(self, proto): list_normalizers = [normalizers.Replace('``', '"'), normalizers.Replace("''", '"'), normalizers.Replace(Regex(' {2,}'), ' ')] if...
class RemBertConverter(SpmConverter): def normalizer(self, proto): pass def post_processor(self): pass
3
0
14
2
12
0
3
0.04
1
0
0
0
2
0
2
13
30
4
25
5
22
1
14
5
11
4
2
1
5
238
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.RoFormerConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class RoFormerConverter(Converter): def converted(self) -> Tokenizer: from .models.roformer.tokenization_utils import JiebaPreTokenizer vocab...
class RoFormerConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
36
6
30
1
2
0.03
1
2
1
0
1
0
1
3
37
6
31
11
28
1
19
11
16
2
1
1
2
239
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.RobertaConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class RobertaConverter(Converter): def converted(self) -> Tokenizer: ot = self.original_tokenizer vocab = ot.encoder merges = list(ot...
class RobertaConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
26
3
23
1
1
0.04
1
1
0
0
1
0
1
3
27
3
24
6
22
1
10
6
8
1
1
0
1
240
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.SeamlessM4TConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class SeamlessM4TConverter(SpmConverter): def vocab(self, proto): vocab = [('<pad>', 0.0), ('<unk>', 0.0), ('<s>', 0.0), ('</s>', 0.0)] vocab += [(piece.piece, piece.score) for piece in proto.pie...
class SeamlessM4TConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def post_processor(self): pass
4
0
7
0
7
0
1
0
1
0
0
0
3
0
3
14
23
2
21
5
17
0
9
5
5
1
2
0
3
241
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.SentencePieceExtractor
from .utils import is_protobuf_available, is_sentencepiece_available, logging, requires_backends class SentencePieceExtractor: """ Extractor implementation for SentencePiece trained models. https://github.com/google/sentencepiece """ def __init__(self, model: str): requires_backends(self, 'sen...
class SentencePieceExtractor: ''' Extractor implementation for SentencePiece trained models. https://github.com/google/sentencepiece ''' def __init__(self, model: str): pass def extract(self, vocab_scores=None) -> tuple[dict[str, int], list[tuple]]: ''' By default will ret...
3
2
9
2
5
2
1
0.64
0
3
0
1
2
1
2
2
23
5
11
8
7
7
11
8
7
1
0
0
2
242
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.SplinterConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class SplinterConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.vocab tokenizer = Tokenizer(WordPiece(v...
class SplinterConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
47
6
41
1
3
0.02
1
1
0
0
1
0
1
3
48
6
42
16
40
1
27
16
25
3
1
1
3
243
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.SpmConverter
from .utils import is_protobuf_available, is_sentencepiece_available, logging, requires_backends import warnings from tokenizers.models import BPE, Unigram, WordPiece from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class SpmConverter(Converter): handle_byte_fa...
class SpmConverter(Converter): def __init__(self, *args): pass def vocab(self, proto): pass def unk_id(self, proto): pass def tokenizer(self, proto): pass def normalizer(self, proto): pass def pre_tokenizer(self, replacement, add_prefix_space): ...
10
0
13
2
10
1
2
0.07
1
3
0
22
9
1
9
11
127
23
98
34
88
7
61
32
51
5
1
1
17
244
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.T5Converter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class T5Converter(SpmConverter): def vocab(self, proto): num_extra_ids = self.original_tokenizer._extra_ids vocab = [(piece.piece, piece.score) for piece in proto.pieces] vocab += [(f'<ex...
class T5Converter(SpmConverter): def vocab(self, proto): pass def post_processor(self): pass
3
0
7
0
7
0
1
0
1
1
0
1
2
0
2
13
15
1
14
5
11
0
8
5
5
1
2
0
2
245
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.TikTokenConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class TikTokenConverter: """ A general tiktoken converter. """ def __init__(self, vocab_file=None, pattern="(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n...
class TikTokenConverter: ''' A general tiktoken converter. ''' def __init__(self, vocab_file=None, pattern="(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+", add_prefix_space=False, additional_special_tokens=None, *ar...
6
1
13
1
12
0
2
0.05
0
5
0
0
4
4
4
4
72
9
60
30
45
3
45
22
38
6
0
3
11
246
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.UdopConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class UdopConverter(SpmConverter): def post_processor(self): return processors.TemplateProcessing(single=['$A', '</s>'], pair=['$A', '</s>', '$B', '</s>'], special_tokens=[('</s>', self.original_tokenize...
class UdopConverter(SpmConverter): def post_processor(self): pass
2
0
8
0
8
0
1
0
1
0
0
0
1
0
1
12
9
0
9
2
7
0
3
2
1
1
2
0
1
247
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.WhisperConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors from tokenizers.models import BPE, Unigram, WordPiece class WhisperConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.encoder merges = list(self.original_toke...
class WhisperConverter(Converter): def converted(self) -> Tokenizer: pass
2
0
33
4
29
0
1
0
1
2
0
0
1
0
1
3
34
4
30
10
28
0
14
10
12
1
1
0
1
248
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.XGLMConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class XGLMConverter(SpmConverter): def vocab(self, proto): vocab = [('<s>', 0.0), ('<pad>', 0.0), ('</s>', 0.0), ('<unk>', 0.0)] vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]...
class XGLMConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def post_processor(self): pass
4
0
7
0
7
0
1
0.04
1
0
0
0
3
0
3
14
25
2
23
6
19
1
11
6
7
1
2
0
3
249
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.XLMRobertaConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class XLMRobertaConverter(SpmConverter): def vocab(self, proto): vocab = [('<s>', 0.0), ('<pad>', 0.0), ('</s>', 0.0), ('<unk>', 0.0)] vocab += [(piece.piece, piece.score) for piece in proto.piec...
class XLMRobertaConverter(SpmConverter): def vocab(self, proto): pass def unk_id(self, proto): pass def post_processor(self): pass
4
0
7
0
7
0
1
0
1
0
0
0
3
0
3
14
25
2
23
6
19
0
11
6
7
1
2
0
3
250
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/convert_slow_tokenizer.py
transformers.convert_slow_tokenizer.XLNetConverter
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors class XLNetConverter(SpmConverter): def vocab(self, proto): return [(piece.piece, piece.score) if check_number_comma(piece.piece) else (piece.piece, piece.score - 100) for piece in proto.pieces] def...
class XLNetConverter(SpmConverter): def vocab(self, proto): pass def normalizer(self, proto): pass def post_processor(self): pass
4
0
11
1
10
0
2
0
1
0
0
0
3
0
3
14
35
5
30
6
26
0
17
6
13
4
2
1
7
251
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorForLanguageModeling
from typing import Any, Callable, NewType, Optional, Union import multiprocessing as mp import numpy as np from dataclasses import dataclass from collections.abc import Mapping from ..tokenization_utils_base import PreTrainedTokenizerBase @dataclass class DataCollatorForLanguageModeling(DataCollatorMixin): """ ...
@dataclass class DataCollatorForLanguageModeling(DataCollatorMixin): ''' Data collator used for language modeling. Inputs are dynamically padded to the maximum length of a batch if they are not all of the same length. Args: tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]): ...
9
3
30
3
22
5
4
0.49
1
6
0
2
7
0
8
9
317
46
184
58
167
90
126
55
112
7
1
2
29
252
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorForPermutationLanguageModeling
from collections.abc import Mapping from ..tokenization_utils_base import PreTrainedTokenizerBase from typing import Any, Callable, NewType, Optional, Union from random import randint import numpy as np from dataclasses import dataclass @dataclass class DataCollatorForPermutationLanguageModeling(DataCollatorMixin): ...
@dataclass class DataCollatorForPermutationLanguageModeling(DataCollatorMixin): ''' Data collator used for permutation language modeling. - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for permutation language modeling with procedures specific to XLNet '''...
6
3
53
7
28
19
5
0.71
1
7
0
0
6
0
6
7
336
48
171
61
162
122
135
61
126
7
1
2
27
253
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorForSOP
import warnings from dataclasses import dataclass from typing import Any, Callable, NewType, Optional, Union @dataclass class DataCollatorForSOP(DataCollatorForLanguageModeling): """ Data collator used for sentence order prediction task. - collates batches of tensors, honoring their tokenizer's pad_token ...
@dataclass class DataCollatorForSOP(DataCollatorForLanguageModeling): ''' Data collator used for sentence order prediction task. - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for both masked language modeling and sentence order prediction ''' def __i...
5
2
23
3
17
4
2
0.31
1
5
0
0
3
1
3
12
80
13
52
22
45
16
37
22
30
4
2
1
6
254
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorForSeq2Seq
from typing import Any, Callable, NewType, Optional, Union from ..tokenization_utils_base import PreTrainedTokenizerBase from dataclasses import dataclass import numpy as np from ..utils import PaddingStrategy @dataclass class DataCollatorForSeq2Seq: """ Data collator that will dynamically pad the inputs recei...
@dataclass class DataCollatorForSeq2Seq: ''' Data collator that will dynamically pad the inputs received, as well as the labels. Args: tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]): The tokenizer used for encoding the data. model ([`PreTrainedModel`], *option...
3
1
91
9
76
6
17
0.4
0
1
0
0
1
0
1
1
133
15
84
19
80
34
43
19
39
17
0
3
17
255
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorForTokenClassification
from dataclasses import dataclass import numpy as np from typing import Any, Callable, NewType, Optional, Union from ..tokenization_utils_base import PreTrainedTokenizerBase from ..utils import PaddingStrategy @dataclass class DataCollatorForTokenClassification(DataCollatorMixin): """ Data collator that will d...
@dataclass class DataCollatorForTokenClassification(DataCollatorMixin): ''' Data collator that will dynamically pad the inputs received, as well as the labels. Args: tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]): The tokenizer used for encoding the data. padd...
5
1
26
4
22
1
5
0.29
1
2
0
0
3
0
3
4
137
22
89
28
82
26
53
28
46
6
1
1
19
256
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorForWholeWordMask
from collections.abc import Mapping import warnings import random from typing import Any, Callable, NewType, Optional, Union from ..models.bert import BertTokenizer, BertTokenizerFast import numpy as np from dataclasses import dataclass @dataclass class DataCollatorForWholeWordMask(DataCollatorForLanguageModeling): ...
@dataclass class DataCollatorForWholeWordMask(DataCollatorForLanguageModeling): ''' Data collator used for language modeling that masks entire words. - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling <Tip> This collator relies...
8
4
35
5
26
6
6
0.27
1
11
2
0
7
1
7
16
269
46
180
76
169
49
156
76
145
14
2
4
44
257
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorMixin
class DataCollatorMixin: def __call__(self, features, return_tensors=None): if return_tensors is None: return_tensors = self.return_tensors if return_tensors == 'pt': return self.torch_call(features) elif return_tensors == 'np': return self.numpy_call(fea...
class DataCollatorMixin: def __call__(self, features, return_tensors=None): pass
2
0
11
0
11
0
5
0
0
1
0
4
1
0
1
1
12
0
12
2
10
0
9
2
7
5
0
1
5
258
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorWithFlattening
import numpy as np from dataclasses import dataclass @dataclass class DataCollatorWithFlattening(DefaultDataCollator): """ Data collator used for padding free approach. Does the following: - concatenates the entire mini batch into single long sequence of shape [1, total_tokens] - uses `separator_id` t...
@dataclass class DataCollatorWithFlattening(DefaultDataCollator): ''' Data collator used for padding free approach. Does the following: - concatenates the entire mini batch into single long sequence of shape [1, total_tokens] - uses `separator_id` to separate sequences within the concatenated `labels`, ...
4
1
13
0
13
0
4
0.22
1
3
0
0
2
2
2
4
36
3
27
8
24
6
23
8
20
7
2
2
8
259
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DataCollatorWithPadding
from ..tokenization_utils_base import PreTrainedTokenizerBase from ..utils import PaddingStrategy from dataclasses import dataclass from typing import Any, Callable, NewType, Optional, Union @dataclass class DataCollatorWithPadding: """ Data collator that will dynamically pad the inputs received. Args: ...
@dataclass class DataCollatorWithPadding: ''' Data collator that will dynamically pad the inputs received. Args: tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]): The tokenizer used for encoding the data. padding (`bool`, `str` or [`~utils.PaddingStrategy`], *op...
3
1
16
0
16
0
3
1
0
2
0
0
1
0
1
1
49
5
22
7
20
22
15
7
13
3
0
1
3
260
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/data_collator.py
transformers.data.data_collator.DefaultDataCollator
from typing import Any, Callable, NewType, Optional, Union from dataclasses import dataclass @dataclass class DefaultDataCollator(DataCollatorMixin): """ Very simple data collator that simply collates batches of dict-like objects and performs special handling for potential keys named: - `label`: h...
@dataclass class DefaultDataCollator(DataCollatorMixin): ''' Very simple data collator that simply collates batches of dict-like objects and performs special handling for potential keys named: - `label`: handles a single value (int or float) per object - `label_ids`: handles a list of values...
3
1
4
0
4
0
2
2.17
1
2
0
1
1
0
1
2
25
6
6
3
4
13
6
3
4
2
1
1
2
261
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/glue.py
transformers.data.datasets.glue.GlueDataTrainingArguments
from ..processors.glue import glue_convert_examples_to_features, glue_output_modes, glue_processors from dataclasses import dataclass, field @dataclass class GlueDataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. Using `HfArgumentParser` we ...
@dataclass class GlueDataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. Using `HfArgumentParser` we can turn this class into argparse arguments to be able to specify them on the command line. ''' def __post_init__(self): p...
3
1
2
0
2
0
1
0.26
0
0
0
0
1
0
1
1
27
3
19
6
17
5
7
6
5
1
0
0
1
262
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/glue.py
transformers.data.datasets.glue.GlueDataset
from filelock import FileLock from torch.utils.data import Dataset import warnings import torch from ...utils import check_torch_load_is_safe, logging from ..processors.glue import glue_convert_examples_to_features, glue_output_modes, glue_processors from typing import Optional, Union from ...tokenization_utils_base im...
class GlueDataset(Dataset): def __init__(self, args: GlueDataTrainingArguments, tokenizer: PreTrainedTokenizerBase, limit_length: Optional[int]=None, mode: Union[str, Split]=Split.train, cache_dir: Optional[str]=None): pass def __len__(self): pass def __getitem__(self, i) -> InputFeature...
5
0
20
1
18
1
3
0.11
1
8
4
0
4
2
4
4
91
7
76
19
64
8
42
12
37
9
1
3
12
263
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/language_modeling.py
transformers.data.datasets.language_modeling.LineByLineTextDataset
import os import warnings import torch from ...tokenization_utils import PreTrainedTokenizer from torch.utils.data import Dataset class LineByLineTextDataset(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path: str, block_size: int): warnings.warn(DEPRECATION_WARNING.format('https://git...
class LineByLineTextDataset(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path: str, block_size: int): pass def __len__(self): pass def __getitem__(self, i) -> dict[str, torch.tensor]: pass
4
0
8
1
6
1
1
0.3
1
5
1
0
3
1
3
3
31
5
20
8
16
6
15
7
11
2
1
1
4
264
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/language_modeling.py
transformers.data.datasets.language_modeling.LineByLineWithRefDataset
from torch.utils.data import Dataset import os from ...tokenization_utils import PreTrainedTokenizer import json import torch import warnings class LineByLineWithRefDataset(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path: str, block_size: int, ref_path: str): warnings.warn(DEPRECATI...
class LineByLineWithRefDataset(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path: str, block_size: int, ref_path: str): pass def __len__(self): pass def __getitem__(self, i) -> dict[str, torch.tensor]: pass
4
0
13
1
11
2
2
0.24
1
6
1
0
3
1
3
3
46
5
34
11
30
8
26
10
22
5
1
1
7
265
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/language_modeling.py
transformers.data.datasets.language_modeling.LineByLineWithSOPTextDataset
import random from ...tokenization_utils import PreTrainedTokenizer from torch.utils.data import Dataset import os import torch import warnings class LineByLineWithSOPTextDataset(Dataset): """ Dataset for sentence order prediction task, prepare sentence pairs for SOP task """ def __init__(self, tokeni...
class LineByLineWithSOPTextDataset(Dataset): ''' Dataset for sentence order prediction task, prepare sentence pairs for SOP task ''' def __init__(self, tokenizer: PreTrainedTokenizer, file_dir: str, block_size: int): pass def create_examples_from_document(self, document, block_size, token...
6
3
31
2
23
7
6
0.36
1
6
1
0
4
1
4
4
150
16
104
33
98
37
87
32
81
14
1
5
30
266
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/language_modeling.py
transformers.data.datasets.language_modeling.TextDataset
import torch import warnings from filelock import FileLock import os from torch.utils.data import Dataset import time import pickle from typing import Optional from ...tokenization_utils import PreTrainedTokenizer class TextDataset(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path: str, block...
class TextDataset(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path: str, block_size: int, overwrite_cache=False, cache_dir: Optional[str]=None): pass def __len__(self): pass def __getitem__(self, i) -> torch.Tensor: pass
4
0
21
3
17
2
2
0.17
1
7
1
0
3
1
3
3
71
11
52
21
41
9
30
12
26
5
1
3
7
267
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/language_modeling.py
transformers.data.datasets.language_modeling.TextDatasetForNextSentencePrediction
from ...tokenization_utils import PreTrainedTokenizer import pickle import os from filelock import FileLock import warnings import torch import time from torch.utils.data import Dataset import random class TextDatasetForNextSentencePrediction(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path:...
class TextDatasetForNextSentencePrediction(Dataset): def __init__(self, tokenizer: PreTrainedTokenizer, file_path: str, block_size: int, overwrite_cache=False, short_seq_probability=0.1, nsp_probability=0.5): pass def create_examples_from_document(self, document: list[list[int]], doc_index: int, bloc...
5
1
44
6
30
9
7
0.32
1
7
1
0
4
5
4
4
185
29
119
47
106
38
93
37
88
16
1
6
26
268
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/squad.py
transformers.data.datasets.squad.Split
from enum import Enum class Split(Enum): train = 'train' dev = 'dev'
class Split(Enum): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
49
3
0
3
3
2
0
3
3
2
0
4
0
0
269
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/squad.py
transformers.data.datasets.squad.SquadDataTrainingArguments
from dataclasses import dataclass, field @dataclass class SquadDataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ model_type: str = field(default=None, metadata={'help': 'Model type selected in the list: ' + ', '.join(MODEL_TYPES)}) ...
@dataclass class SquadDataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' pass
2
1
0
0
0
0
0
0.05
0
0
0
0
0
0
0
0
64
1
60
13
59
3
13
13
12
0
0
0
0
270
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/datasets/squad.py
transformers.data.datasets.squad.SquadDataset
from ...utils import check_torch_load_is_safe, logging from filelock import FileLock import time from ..processors.squad import SquadFeatures, SquadV1Processor, SquadV2Processor, squad_convert_examples_to_features import os import torch from ...tokenization_utils import PreTrainedTokenizer from typing import Optional, ...
class SquadDataset(Dataset): def __init__(self, args: SquadDataTrainingArguments, tokenizer: PreTrainedTokenizer, limit_length: Optional[int]=None, mode: Union[str, Split]=Split.train, is_language_sensitive: Optional[bool]=False, cache_dir: Optional[str]=None, dataset_format: Optional[str]='pt'): pass ...
4
0
36
4
30
2
5
0.1
1
11
5
0
3
4
3
3
121
15
96
31
83
10
59
22
55
9
1
3
16
271
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.ColaProcessor
import warnings from .utils import DataProcessor, InputExample, InputFeatures import os class ColaProcessor(DataProcessor): """Processor for the CoLA data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('pro...
class ColaProcessor(DataProcessor): '''Processor for the CoLA data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base clas...
8
7
5
0
4
1
2
0.23
1
5
1
0
7
0
7
14
45
7
31
15
23
7
26
15
18
5
1
1
11
272
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.MnliMismatchedProcessor
import os import warnings class MnliMismatchedProcessor(MnliProcessor): """Processor for the MultiNLI Mismatched data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('processor'), FutureWarning) def get...
class MnliMismatchedProcessor(MnliProcessor): '''Processor for the MultiNLI Mismatched data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_dev_examples(self, data_dir): '''See base class.''' pass def get_test_examples(self, data_dir): '''See ...
4
3
3
0
2
1
1
0.38
1
2
0
0
3
0
3
17
14
3
8
4
4
3
8
4
4
1
2
0
3
273
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.MnliProcessor
import warnings from .utils import DataProcessor, InputExample, InputFeatures import os class MnliProcessor(DataProcessor): """Processor for the MultiNLI data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format(...
class MnliProcessor(DataProcessor): '''Processor for the MultiNLI data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base ...
8
7
5
0
4
1
1
0.23
1
5
1
1
7
0
7
14
44
7
30
14
22
7
25
14
17
4
1
2
10
274
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.MrpcProcessor
import os import warnings from .utils import DataProcessor, InputExample, InputFeatures class MrpcProcessor(DataProcessor): """Processor for the MRPC data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('pro...
class MrpcProcessor(DataProcessor): '''Processor for the MRPC data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base clas...
8
7
5
0
4
1
1
0.23
1
5
1
0
7
0
7
14
45
7
31
14
23
7
26
14
18
4
1
2
10
275
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.OutputMode
from enum import Enum class OutputMode(Enum): classification = 'classification' regression = 'regression'
class OutputMode(Enum): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
49
3
0
3
3
2
0
3
3
2
0
4
0
0
276
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.QnliProcessor
import warnings from .utils import DataProcessor, InputExample, InputFeatures import os class QnliProcessor(DataProcessor): """Processor for the QNLI data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('pro...
class QnliProcessor(DataProcessor): '''Processor for the QNLI data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base clas...
8
7
5
0
4
1
1
0.23
1
5
1
0
7
0
7
14
44
7
30
14
22
7
25
14
17
4
1
2
10
277
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.QqpProcessor
from .utils import DataProcessor, InputExample, InputFeatures import os import warnings class QqpProcessor(DataProcessor): """Processor for the QQP data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('proce...
class QqpProcessor(DataProcessor): '''Processor for the QQP data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base class....
8
7
6
0
5
1
2
0.19
1
6
1
0
7
0
7
14
50
7
36
17
28
7
31
17
23
7
1
2
13
278
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.RteProcessor
from .utils import DataProcessor, InputExample, InputFeatures import warnings import os class RteProcessor(DataProcessor): """Processor for the RTE data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('proce...
class RteProcessor(DataProcessor): '''Processor for the RTE data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base class....
8
7
5
0
4
1
1
0.23
1
5
1
0
7
0
7
14
44
7
30
14
22
7
25
14
17
4
1
2
10
279
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.Sst2Processor
import warnings import os from .utils import DataProcessor, InputExample, InputFeatures class Sst2Processor(DataProcessor): """Processor for the SST-2 data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('pr...
class Sst2Processor(DataProcessor): '''Processor for the SST-2 data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base cla...
8
7
5
0
4
1
2
0.23
1
5
1
0
7
0
7
14
44
7
30
14
22
7
25
14
17
5
1
2
11
280
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.StsbProcessor
from .utils import DataProcessor, InputExample, InputFeatures import os import warnings class StsbProcessor(DataProcessor): """Processor for the STS-B data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('pr...
class StsbProcessor(DataProcessor): '''Processor for the STS-B data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base cla...
8
7
5
0
4
1
1
0.23
1
5
1
0
7
0
7
14
44
7
30
14
22
7
25
14
17
4
1
2
10
281
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/glue.py
transformers.data.processors.glue.WnliProcessor
import os from .utils import DataProcessor, InputExample, InputFeatures import warnings class WnliProcessor(DataProcessor): """Processor for the WNLI data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format('pro...
class WnliProcessor(DataProcessor): '''Processor for the WNLI data set (GLUE version).''' def __init__(self, *args, **kwargs): pass def get_example_from_tensor_dict(self, tensor_dict): '''See base class.''' pass def get_train_examples(self, data_dir): '''See base clas...
8
7
5
0
4
1
1
0.23
1
5
1
0
7
0
7
14
44
7
30
14
22
7
25
14
17
4
1
2
10
282
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/squad.py
transformers.data.processors.squad.SquadExample
class SquadExample: """ A single training/test example for the Squad dataset, as loaded from disk. Args: qas_id: The example's unique identifier question_text: The question string context_text: The context string answer_text: The answer string start_position_characte...
class SquadExample: ''' A single training/test example for the Squad dataset, as loaded from disk. Args: qas_id: The example's unique identifier question_text: The question string context_text: The context string answer_text: The answer string start_position_character...
2
1
46
5
39
2
5
0.35
0
0
0
0
1
11
1
1
61
7
40
26
28
14
26
16
24
5
0
3
5
283
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/squad.py
transformers.data.processors.squad.SquadFeatures
from typing import Optional from ...tokenization_utils_base import BatchEncoding, PreTrainedTokenizerBase, TruncationStrategy class SquadFeatures: """ Single squad example features to be fed to a model. Those features are model-specific and can be crafted from [`~data.processors.squad.SquadExample`] using ...
class SquadFeatures: ''' Single squad example features to be fed to a model. Those features are model-specific and can be crafted from [`~data.processors.squad.SquadExample`] using the :method:*~transformers.data.processors.squad.squad_convert_examples_to_features* method. Args: input_ids: ...
2
1
38
3
35
0
1
0.67
0
2
1
0
1
16
1
1
65
5
36
36
16
24
18
18
16
1
0
0
1
284
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/squad.py
transformers.data.processors.squad.SquadProcessor
from tqdm import tqdm import json import os from .utils import DataProcessor class SquadProcessor(DataProcessor): """ Processor for the SQuAD data set. overridden by SquadV1Processor and SquadV2Processor, used by the version 1.1 and version 2.0 of SQuAD, respectively. """ train_file = None dev_...
class SquadProcessor(DataProcessor): ''' Processor for the SQuAD data set. overridden by SquadV1Processor and SquadV2Processor, used by the version 1.1 and version 2.0 of SQuAD, respectively. ''' def _get_example_from_tensor_dict(self, tensor_dict, evaluate=False): pass def get_exampl...
6
4
26
4
17
6
4
0.37
1
4
1
2
5
0
5
12
144
26
86
32
80
32
59
30
53
6
1
5
19
285
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/squad.py
transformers.data.processors.squad.SquadResult
class SquadResult: """ Constructs a SquadResult which can be used to evaluate a model's output on the SQuAD dataset. Args: unique_id: The unique identifier corresponding to that example. start_logits: The logits corresponding to the start of the answer end_logits: The logits corresp...
class SquadResult: ''' Constructs a SquadResult which can be used to evaluate a model's output on the SQuAD dataset. Args: unique_id: The unique identifier corresponding to that example. start_logits: The logits corresponding to the start of the answer end_logits: The logits correspo...
2
1
9
1
8
0
2
0.78
0
0
0
0
1
6
1
1
19
3
9
8
7
7
9
8
7
2
0
1
2
286
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/squad.py
transformers.data.processors.squad.SquadV1Processor
class SquadV1Processor(SquadProcessor): train_file = 'train-v1.1.json' dev_file = 'dev-v1.1.json'
class SquadV1Processor(SquadProcessor): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
12
3
0
3
3
2
0
3
3
2
0
2
0
0
287
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/squad.py
transformers.data.processors.squad.SquadV2Processor
class SquadV2Processor(SquadProcessor): train_file = 'train-v2.0.json' dev_file = 'dev-v2.0.json'
class SquadV2Processor(SquadProcessor): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
12
3
0
3
3
2
0
3
3
2
0
2
0
0
288
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/utils.py
transformers.data.processors.utils.DataProcessor
import csv class DataProcessor: """Base class for data converters for sequence classification data sets.""" def get_example_from_tensor_dict(self, tensor_dict): """ Gets an example from a dict. Args: tensor_dict: Keys and values should match the corresponding Glue ...
class DataProcessor: '''Base class for data converters for sequence classification data sets.''' def get_example_from_tensor_dict(self, tensor_dict): ''' Gets an example from a dict. Args: tensor_dict: Keys and values should match the corresponding Glue tens...
9
8
5
0
2
2
1
0.84
0
3
0
12
6
0
7
7
43
8
19
10
10
16
18
8
10
2
0
1
8
289
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/utils.py
transformers.data.processors.utils.InputExample
from dataclasses import dataclass import json from typing import Optional, Union import dataclasses @dataclass class InputExample: """ A single training/test example for simple sequence classification. Args: guid: Unique id for the example. text_a: string. The untokenized text of the first...
@dataclass class InputExample: ''' A single training/test example for simple sequence classification. Args: guid: Unique id for the example. text_a: string. The untokenized text of the first sequence. For single sequence tasks, only this sequence must be specified. text_b...
3
2
3
0
2
1
1
1.71
0
0
0
0
1
0
1
1
22
3
7
4
5
12
7
4
5
1
0
0
1
290
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/utils.py
transformers.data.processors.utils.InputFeatures
import json import dataclasses from typing import Optional, Union from dataclasses import dataclass @dataclass(frozen=True) class InputFeatures: """ A single set of features of data. Property names are the same names as the corresponding inputs to a model. Args: input_ids: Indices of input sequenc...
@dataclass(frozen=True) class InputFeatures: ''' A single set of features of data. Property names are the same names as the corresponding inputs to a model. Args: input_ids: Indices of input sequence tokens in the vocabulary. attention_mask: Mask to avoid performing attention on padding toke...
3
2
3
0
2
1
1
1.86
0
0
0
0
1
0
1
1
23
3
7
5
5
13
7
5
5
1
0
0
1
291
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/utils.py
transformers.data.processors.utils.SingleSentenceClassificationProcessor
from ...utils import is_torch_available, logging class SingleSentenceClassificationProcessor(DataProcessor): """Generic processor for a single sentence classification data set.""" def __init__(self, labels=None, examples=None, mode='classification', verbose=False): self.labels = [] if labels is None e...
class SingleSentenceClassificationProcessor(DataProcessor): '''Generic processor for a single sentence classification data set.''' def __init__(self, labels=None, examples=None, mode='classification', verbose=False): pass def __len__(self): pass def __getitem__(self, idx): pa...
11
2
24
2
19
2
5
0.12
1
13
2
0
6
4
8
15
225
30
174
65
137
21
118
41
105
22
1
2
46
292
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/data/processors/xnli.py
transformers.data.processors.xnli.XnliProcessor
from .utils import DataProcessor, InputExample import os class XnliProcessor(DataProcessor): """ Processor for the XNLI dataset. Adapted from https://github.com/google-research/bert/blob/f39e881b169b9d53bea03d2d341b31707a6c052b/run_classifier.py#L207 """ def __init__(self, language, train_language...
class XnliProcessor(DataProcessor): ''' Processor for the XNLI dataset. Adapted from https://github.com/google-research/bert/blob/f39e881b169b9d53bea03d2d341b31707a6c052b/run_classifier.py#L207 ''' def __init__(self, language, train_language=None): pass def get_train_examples(self...
5
4
12
0
11
1
4
0.15
1
4
1
0
4
2
4
11
57
4
46
23
41
7
46
23
41
8
1
2
17
293
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/debug_utils.py
transformers.debug_utils.DebugOption
from .utils import ExplicitEnum, is_torch_available, logging class DebugOption(ExplicitEnum): UNDERFLOW_OVERFLOW = 'underflow_overflow' TPU_METRICS_DEBUG = 'tpu_metrics_debug'
class DebugOption(ExplicitEnum): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
3
0
3
3
2
0
3
3
2
0
1
0
0
294
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/debug_utils.py
transformers.debug_utils.DebugUnderflowOverflow
import collections class DebugUnderflowOverflow: """ This debug class helps detect and understand where the model starts getting very large or very small, and more importantly `nan` or `inf` weight and activation elements. There are 2 working modes: 1. Underflow/overflow detection (default) 2...
class DebugUnderflowOverflow: ''' This debug class helps detect and understand where the model starts getting very large or very small, and more importantly `nan` or `inf` weight and activation elements. There are 2 working modes: 1. Underflow/overflow detection (default) 2. Specific batch abso...
15
1
9
1
7
1
2
1.06
0
3
0
0
14
10
14
14
264
63
98
30
83
104
87
30
72
9
0
4
33
295
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/feature_extraction_sequence_utils.py
transformers.feature_extraction_sequence_utils.SequenceFeatureExtractor
from .utils import PaddingStrategy, TensorType, is_torch_tensor, logging, to_numpy import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from typing import Optional, Union class SequenceFeatureExtractor(FeatureExtractionMixin): """ This is a general feature extraction cl...
class SequenceFeatureExtractor(FeatureExtractionMixin): ''' This is a general feature extraction class for speech recognition. Args: feature_size (`int`): The feature dimension of the extracted features. sampling_rate (`int`): The sampling rate at which the audio fil...
6
5
65
9
36
20
10
0.62
1
12
1
15
5
5
5
17
343
52
180
58
146
112
107
30
101
22
2
3
48
296
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/feature_extraction_utils.py
transformers.feature_extraction_utils.BatchFeature
import numpy as np from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union from collections import UserDict from .utils import FEATURE_EXTRACTOR_NAME, PROCESSOR_NAME, PushToHubMixin, TensorType, copy_func, download_url, is_numpy_array, is_offline_mode, is_remote_url, is_torch_available, is_torch_device, is_torc...
class BatchFeature(UserDict): ''' Holds the output of the [`~SequenceFeatureExtractor.pad`] and feature extractor specific `__call__` methods. This class is derived from a python dictionary and can be used as a dictionary. Args: data (`dict`, *optional*): Dictionary of lists/arrays/...
12
4
14
1
10
3
3
0.46
1
12
0
1
11
1
11
66
189
29
112
29
94
52
93
29
75
9
8
3
41
297
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/feature_extraction_utils.py
transformers.feature_extraction_utils.FeatureExtractionMixin
from .dynamic_module_utils import custom_object_save from .utils.hub import cached_file from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union import os import copy import json import warnings from .utils import FEATURE_EXTRACTOR_NAME, PROCESSOR_NAME, PushToHubMixin, TensorType, copy_func, download_url, is_num...
class FeatureExtractionMixin(PushToHubMixin): ''' This is a feature extraction mixin used to provide saving/loading functionality for sequential and image feature extractors. ''' def __init__(self, **kwargs): '''Set elements of `kwargs` as attributes.''' pass def _set_processo...
18
12
35
5
18
13
4
0.72
1
10
0
2
7
1
12
12
443
68
218
71
188
157
152
51
138
15
1
2
48
298
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/generation/beam_constraints.py
transformers.generation.beam_constraints.Constraint
from abc import ABC, abstractmethod class Constraint(ABC): """Abstract base class for all constraints that can be applied during generation. It must define how the constraint can be satisfied. All classes that inherit Constraint must follow the requirement that ```py completed = False while n...
class Constraint(ABC): '''Abstract base class for all constraints that can be applied during generation. It must define how the constraint can be satisfied. All classes that inherit Constraint must follow the requirement that ```py completed = False while not completed: _, completed = c...
15
8
12
1
5
6
2
1.12
1
3
0
2
8
0
8
28
125
19
50
19
35
56
30
13
21
6
4
2
13
299
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/generation/beam_constraints.py
transformers.generation.beam_constraints.ConstraintListState
from typing import Optional class ConstraintListState: """ A class for beam scorers to track its progress through a list of constraints. Args: constraints (`list[Constraint]`): A list of [`Constraint`] objects that must be fulfilled by the beam scorer. """ def __init__(self, c...
class ConstraintListState: ''' A class for beam scorers to track its progress through a list of constraints. Args: constraints (`list[Constraint]`): A list of [`Constraint`] objects that must be fulfilled by the beam scorer. ''' def __init__(self, constraints: list[Constraint])...
8
3
22
5
13
5
5
0.46
0
6
1
0
7
7
7
7
171
40
92
25
84
42
80
25
72
14
0
5
33