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
100
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_fim.py
run_fim.ModelArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. """ model_name_or_path: Optional[str] = field(default=None, metadata={'help': "The model check...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. ''' def __post_init__(self): pass
3
1
5
0
5
0
2
0.03
0
1
0
0
1
0
1
1
100
2
95
16
93
3
18
16
16
2
0
1
2
101
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/text-generation/run_generation.py
run_generation._ModelFallbackWrapper
from transformers import AutoTokenizer, BloomForCausalLM, BloomTokenizerFast, CTRLLMHeadModel, CTRLTokenizer, GenerationMixin, GPT2LMHeadModel, GPT2Tokenizer, GPTJForCausalLM, LlamaForCausalLM, OpenAIGPTLMHeadModel, OpenAIGPTTokenizer, OPTForCausalLM, XLMTokenizer, XLMWithLMHeadModel, XLNetLMHeadModel, XLNetTokenizer i...
class _ModelFallbackWrapper(GenerationMixin): def __init__(self, optimized, default): pass def __call__(self, *args, **kwargs): pass def __getattr__(self, item): pass def prepare_inputs_for_generation(self, input_ids, past_key_values=None, inputs_embeds=None, use_cache=None,...
6
1
8
0
7
1
2
0.14
1
4
0
0
5
2
5
43
45
5
35
18
25
5
23
14
17
4
1
2
8
102
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/text-classification/run_glue.py
run_glue.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ 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 o...
@dataclass class DataTrainingArguments: ''' 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
16
0
16
0
5
0.07
0
1
0
0
1
0
1
1
91
3
82
16
80
6
24
16
22
5
0
2
5
103
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/pytorch-lightning/run_glue.py
run_glue.GLUETransformer
from transformers import glue_compute_metrics as compute_metrics from lightning_base import BaseTransformer, add_generic_args, generic_train from transformers import glue_convert_examples_to_features as convert_examples_to_features from transformers import glue_output_modes, glue_tasks_num_labels import os from argpars...
class GLUETransformer(BaseTransformer): def __init__(self, hparams): pass def forward(self, **inputs): pass def training_step(self, batch, batch_idx): pass def prepare_data(self): '''Called to initialize data. Use the call to construct features''' pass d...
12
2
14
2
12
0
2
0.03
1
11
0
0
9
2
10
25
152
28
120
49
108
4
81
47
70
4
2
2
23
104
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/text-classification/run_glue.py
run_glue.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
49
1
45
10
44
3
10
10
9
0
0
0
0
105
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-classification/run_image_classification.py
run_image_classification.DataTrainingArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ 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...
@dataclass class DataTrainingArguments: ''' 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): pass
3
1
5
0
5
0
2
0.11
0
1
0
0
1
0
1
1
53
2
46
11
44
5
13
11
11
2
0
1
2
106
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-classification/run_image_classification.py
run_image_classification.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(default='google/vit-base-patch16-224-in21k', metadata={'help': 'Path to pret...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
47
1
43
10
42
3
10
10
9
0
0
0
0
107
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/instance-segmentation/run_instance_segmentation.py
run_instance_segmentation.Evaluator
from torchmetrics.detection.mean_ap import MeanAveragePrecision from collections.abc import Mapping from transformers.trainer import EvalPrediction import torch from transformers import AutoImageProcessor, AutoModelForUniversalSegmentation, HfArgumentParser, Trainer, TrainingArguments class Evaluator: """ Comp...
class Evaluator: ''' Compute metrics for the instance segmentation task. ''' def __init__(self, image_processor: AutoImageProcessor, id2label: Mapping[int, str], threshold: float=0.0): ''' Initialize evaluator with image processor, id2label mapping and threshold for filtering predictio...
9
5
16
2
11
4
2
0.36
0
9
1
0
7
4
7
7
127
21
78
41
64
28
53
35
45
4
0
2
14
108
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/instance-segmentation/run_instance_segmentation.py
run_instance_segmentation.ModelOutput
from dataclasses import dataclass, field import torch @dataclass class ModelOutput: class_queries_logits: torch.Tensor masks_queries_logits: torch.Tensor
@dataclass class ModelOutput: pass
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
3
1
2
0
3
1
2
0
0
0
0
109
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/run_language_modeling.py
run_language_modeling.DataTrainingArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ train_data_file: Optional[str] = field(default=None, metadata={'help': 'The input training data f...
@dataclass class DataTrainingArguments: ''' 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
67
3
61
14
60
3
14
14
13
0
0
0
0
110
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/run_language_modeling.py
run_language_modeling.ModelArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. """ model_name_or_path: Optional[str] = field(default=None, metadata={'help': 'The model check...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. ''' pass
2
1
0
0
0
0
0
0.13
0
0
0
0
0
0
0
0
28
1
24
6
23
3
6
6
5
0
0
0
0
111
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-pretraining/run_mae.py
run_mae.CustomTrainingArguments
from dataclasses import dataclass, field from transformers import HfArgumentParser, Trainer, TrainingArguments, ViTImageProcessor, ViTMAEConfig, ViTMAEForPreTraining @dataclass class CustomTrainingArguments(TrainingArguments): base_learning_rate: float = field(default=0.001, metadata={'help': 'Base learning rate: ...
@dataclass class CustomTrainingArguments(TrainingArguments): pass
2
0
0
0
0
0
0
0
1
0
0
0
0
0
0
32
4
0
4
2
3
0
2
2
1
0
1
0
0
112
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-pretraining/run_mae.py
run_mae.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ 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...
@dataclass class DataTrainingArguments: ''' 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
7
0
7
0
4
0.12
0
0
0
0
1
1
1
1
58
2
50
13
48
6
17
13
15
4
0
1
4
113
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-pretraining/run_mae.py
run_mae.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/image processor we are going to pre-train. """ model_name_or_path: str = field(default=None, metadata={'help': "The model checkpoint for weights initializ...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/image processor we are going to pre-train. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
48
1
44
10
43
3
10
10
9
0
0
0
0
114
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-pretraining/run_mim.py
run_mim.DataTrainingArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ 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...
@dataclass class DataTrainingArguments: ''' 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): pass
3
1
7
0
7
0
4
0.11
0
0
0
0
1
1
1
1
53
2
46
14
44
5
18
14
16
4
0
1
4
115
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-pretraining/run_mim.py
run_mim.MaskGenerator
import torch import numpy as np class MaskGenerator: """ A class to generate boolean masks for the pretraining task. A mask is a 1D tensor of shape (model_patch_size**2,) where the value is either 0 or 1, where 1 indicates "masked". """ def __init__(self, input_size=192, mask_patch_size=32, m...
class MaskGenerator: ''' A class to generate boolean masks for the pretraining task. A mask is a 1D tensor of shape (model_patch_size**2,) where the value is either 0 or 1, where 1 indicates "masked". ''' def __init__(self, input_size=192, mask_patch_size=32, model_patch_size=4, mask_ratio=0.6...
3
1
13
3
10
0
2
0.24
0
2
0
0
2
8
2
2
34
8
21
13
18
5
21
13
18
3
0
1
4
116
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-pretraining/run_mim.py
run_mim.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/image processor we are going to pre-train. """ model_name_or_path: str = field(default=None, metadata={'help': "The model checkpoint for weights initializ...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/image processor we are going to pre-train. ''' pass
2
1
0
0
0
0
0
0.04
0
0
0
0
0
0
0
0
79
1
75
13
74
3
13
13
12
0
0
0
0
117
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/image-pretraining/run_mim_no_trainer.py
run_mim_no_trainer.MaskGenerator
import numpy as np import torch class MaskGenerator: """ A class to generate boolean masks for the pretraining task. A mask is a 1D tensor of shape (model_patch_size**2,) where the value is either 0 or 1, where 1 indicates "masked". """ def __init__(self, input_size=192, mask_patch_size=32, m...
class MaskGenerator: ''' A class to generate boolean masks for the pretraining task. A mask is a 1D tensor of shape (model_patch_size**2,) where the value is either 0 or 1, where 1 indicates "masked". ''' def __init__(self, input_size=192, mask_patch_size=32, model_patch_size=4, mask_ratio=0.6...
3
1
13
3
10
0
2
0.24
0
2
0
0
2
8
2
2
34
8
21
13
18
5
21
13
18
3
0
1
4
118
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_mlm.py
run_mlm.DataTrainingArguments
from dataclasses import dataclass, field from transformers.utils.versions import require_version from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ dataset_name: Optional[str] = field(defau...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
15
1
14
0
7
0.04
0
1
0
0
1
0
1
1
89
3
83
17
81
3
28
17
26
7
0
3
7
119
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_mlm.py
run_mlm.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. """ model_name_or_path: Optional[str] = field(default=None, metadata={'help': "The model check...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. ''' def __post_init__(self): pass
3
1
5
0
5
0
2
0.04
0
1
0
0
1
0
1
1
88
2
83
14
81
3
16
14
14
2
0
1
2
120
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/multiple_choice/run_multiple_choice.py
run_multiple_choice.DataTrainingArguments
from utils_multiple_choice import MultipleChoiceDataset, Split, processors from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ task_name: str = field(metadata={'help': 'The name...
@dataclass class DataTrainingArguments: ''' 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.2
0
0
0
0
0
0
0
0
19
1
15
5
14
3
5
5
4
0
0
0
0
121
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/multiple_choice/run_multiple_choice.py
run_multiple_choice.ModelArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.21
0
0
0
0
0
0
0
0
18
1
14
5
13
3
5
5
4
0
0
0
0
122
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/token-classification/run_ner.py
run_ner.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ data_dir: str = field(metadata={'help': 'The input data dir. Should contain the .txt files for a ...
@dataclass class DataTrainingArguments: ''' 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.15
0
0
0
0
0
0
0
0
24
1
20
5
19
3
5
5
4
0
0
0
0
123
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/token-classification/run_ner.py
run_ner.DataTrainingArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ task_name: Optional[str] = field(default='ner', metadata={'help': 'The name of the task (ner, pos...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
11
0
11
0
4
0.03
0
1
0
0
1
0
1
1
107
2
102
20
100
3
28
20
26
4
0
2
4
124
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/token-classification/run_ner.py
run_ner.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.28
0
0
0
0
0
0
0
0
24
1
18
7
17
5
7
7
6
0
0
0
0
125
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/token-classification/run_ner.py
run_ner.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
45
1
41
9
40
3
9
9
8
0
0
0
0
126
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/pytorch-lightning/run_ner.py
run_ner.NERTransformer
from utils_ner import TokenClassificationTask from torch.nn import CrossEntropyLoss import os import numpy as np from argparse import Namespace from importlib import import_module import torch from torch.utils.data import DataLoader, TensorDataset from lightning_base import BaseTransformer, add_generic_args, generic_tr...
class NERTransformer(BaseTransformer): ''' A training module for NER. See BaseTransformer for the core options. ''' def __init__(self, hparams): pass def forward(self, **inputs): pass def training_step(self, batch, batch_num): '''Compute loss and log.''' pass ...
12
6
16
1
14
2
2
0.13
1
12
1
0
9
4
10
25
179
20
143
52
131
18
89
50
78
4
2
3
23
127
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/object-detection/run_object_detection.py
run_object_detection.ModelArguments
from typing import Any, Optional, Union from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(default='facebook/detr-resnet-50', metadata={'help': 'Path to pr...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
45
1
41
9
40
3
9
9
8
0
0
0
0
128
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/object-detection/run_object_detection.py
run_object_detection.ModelOutput
from dataclasses import dataclass, field import torch @dataclass class ModelOutput: logits: torch.Tensor pred_boxes: torch.Tensor
@dataclass class ModelOutput: pass
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
3
1
2
0
3
1
2
0
0
0
0
129
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_plm.py
run_plm.DataTrainingArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ dataset_name: Optional[str] = field(default=None, metadata={'help': 'The name of the dataset to u...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
10
0
10
0
4
0.03
0
1
0
0
1
0
1
1
102
2
97
18
95
3
25
18
23
4
0
2
4
130
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_plm.py
run_plm.ModelArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. """ model_name_or_path: Optional[str] = field(default=None, metadata={'help': "The model check...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch. ''' def __post_init__(self): pass
3
1
5
0
5
0
2
0.05
0
1
0
0
1
0
1
1
64
2
59
11
57
3
13
11
11
2
0
1
2
131
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/run_qa.py
run_qa.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ dataset_name: Optional[str] = field(default=None, metadata={'help': 'The name of the dataset to u...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
18
0
18
0
5
0.03
0
1
0
0
1
0
1
1
121
2
116
20
114
3
30
20
28
5
0
2
5
132
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/run_qa.py
run_qa.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.08
0
0
0
0
0
0
0
0
41
1
37
8
36
3
8
8
7
0
0
0
0
133
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/run_qa_beam_search.py
run_qa_beam_search.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ dataset_name: Optional[str] = field(default=None, metadata={'help': 'The name of the dataset to u...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
18
0
18
0
5
0.02
0
1
0
0
1
0
1
1
131
2
126
21
124
3
31
21
29
5
0
2
5
134
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/run_qa_beam_search.py
run_qa_beam_search.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.11
0
0
0
0
0
0
0
0
31
1
27
7
26
3
7
7
6
0
0
0
0
135
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py
run_semantic_segmentation.DataTrainingArguments
import warnings from typing import Optional from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ 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 spe...
@dataclass class DataTrainingArguments: ''' 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): pass
3
1
11
0
11
0
3
0.1
0
2
0
0
1
0
1
1
57
2
50
9
48
5
14
9
12
3
0
1
3
136
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py
run_semantic_segmentation.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(default='nvidia/mit-b0', metadata={'help': 'Path to pretrained model or mode...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.09
0
0
0
0
0
0
0
0
39
1
35
8
34
3
8
8
7
0
0
0
0
137
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/run_seq2seq_qa.py
run_seq2seq_qa.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ dataset_name: Optional[str] = field(default=None, metadata={'help': 'The name of the dataset to u...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
20
0
20
0
6
0.02
0
1
0
0
1
0
1
1
161
2
156
26
154
3
38
26
36
6
0
2
6
138
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/run_seq2seq_qa.py
run_seq2seq_qa.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
45
1
41
9
40
3
9
9
8
0
0
0
0
139
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py
run_speech_recognition_ctc.DataCollatorCTCWithPadding
from transformers import AutoConfig, AutoFeatureExtractor, AutoModelForCTC, AutoProcessor, AutoTokenizer, HfArgumentParser, Trainer, TrainingArguments, Wav2Vec2Processor, set_seed import torch from typing import Optional, Union from dataclasses import dataclass, field @dataclass class DataCollatorCTCWithPadding: "...
@dataclass class DataCollatorCTCWithPadding: ''' Data collator that will dynamically pad the inputs received. Args: processor (:class:`~transformers.AutoProcessor`) The processor used for processing the data. padding (:obj:`bool`, :obj:`str` or :class:`~transformers.tokenization_...
3
1
30
5
22
3
2
0.93
0
3
0
0
1
0
1
1
61
7
28
11
26
26
16
11
14
2
0
1
2
140
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py
run_speech_recognition_ctc.ModelArguments
from typing import Optional, Union from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from ...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.04
0
0
0
0
0
0
0
0
82
1
78
18
77
3
18
18
17
0
0
0
0
141
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py
run_speech_recognition_ctc_adapter.DataCollatorCTCWithPadding
from transformers import AutoConfig, AutoFeatureExtractor, AutoModelForCTC, AutoProcessor, AutoTokenizer, HfArgumentParser, Trainer, TrainingArguments, Wav2Vec2Processor, set_seed import torch from typing import Optional, Union from dataclasses import dataclass, field @dataclass class DataCollatorCTCWithPadding: "...
@dataclass class DataCollatorCTCWithPadding: ''' Data collator that will dynamically pad the inputs received. Args: processor (:class:`~transformers.AutoProcessor`) The processor used for processing the data. padding (:obj:`bool`, :obj:`str` or :class:`~transformers.tokenization_...
3
1
28
5
20
3
2
1.04
0
3
0
0
1
0
1
1
58
7
25
10
23
26
15
10
13
2
0
1
2
142
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py
run_speech_recognition_ctc_adapter.ModelArguments
from dataclasses import dataclass, field from typing import Optional, Union @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from ...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.06
0
0
0
0
0
0
0
0
58
1
54
12
53
3
12
12
11
0
0
0
0
143
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
run_speech_recognition_seq2seq.DataCollatorSpeechSeq2SeqWithPadding
import torch from dataclasses import dataclass, field from typing import Any, Optional, Union @dataclass class DataCollatorSpeechSeq2SeqWithPadding: """ Data collator that will dynamically pad the inputs received. Args: processor ([`WhisperProcessor`]) The processor used for processing ...
@dataclass class DataCollatorSpeechSeq2SeqWithPadding: ''' Data collator that will dynamically pad the inputs received. Args: processor ([`WhisperProcessor`]) The processor used for processing the data. decoder_start_token_id (`int`) The begin-of-sentence of the decod...
3
1
25
7
13
5
3
0.88
0
3
0
0
1
0
1
1
41
9
17
8
15
15
17
8
15
3
0
1
3
144
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
run_speech_recognition_seq2seq.DataTrainingArguments
from typing import Any, Optional, Union from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ dataset_name: str = field(default=None, metadata={'help': 'The name of the dataset to...
@dataclass class DataTrainingArguments: ''' 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.03
0
0
0
0
0
0
0
0
96
1
92
17
91
3
17
17
16
0
0
0
0
145
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py
run_speech_recognition_seq2seq.ModelArguments
from typing import Any, Optional, Union from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier ...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.04
0
0
0
0
0
0
0
0
73
1
69
15
68
3
15
15
14
0
0
0
0
146
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/question-answering/run_squad_trainer.py
run_squad_trainer.ModelArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.33
0
0
0
0
0
0
0
0
21
1
15
6
14
5
6
6
5
0
0
0
0
147
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/summarization/run_summarization.py
run_summarization.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ lang: Optional[str] = field(default=None, metadata={'help': 'Language id for summarization.'}) ...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
20
0
20
0
6
0.02
0
1
0
0
1
0
1
1
161
4
154
24
152
3
36
24
34
6
0
2
6
148
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/summarization/run_summarization.py
run_summarization.ModelArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.06
0
0
0
0
0
0
0
0
54
1
50
10
49
3
10
10
9
0
0
0
0
149
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/multiple-choice/run_swag.py
run_swag.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ train_file: Optional[str] = field(default=None, metadata={'help': 'The input training data file (...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
7
0
7
0
3
0.05
0
0
0
0
1
0
1
1
62
2
57
11
55
3
16
11
14
3
0
1
3
150
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/run_swag.py
run_swag.InputFeatures
class InputFeatures: def __init__(self, example_id, choices_features, label): self.example_id = example_id self.choices_features = [{'input_ids': input_ids, 'input_mask': input_mask, 'segment_ids': segment_ids} for _, input_ids, input_mask, segment_ids in choices_features] self.label = labe...
class InputFeatures: def __init__(self, example_id, choices_features, label): pass
2
0
7
0
7
0
1
0
1
0
0
0
1
3
1
1
8
0
8
6
6
0
5
5
3
1
1
0
1
151
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/multiple-choice/run_swag.py
run_swag.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
45
1
41
9
40
3
9
9
8
0
0
0
0
152
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/run_swag.py
run_swag.SwagExample
class SwagExample: """A single training/test example for the SWAG dataset.""" def __init__(self, swag_id, context_sentence, start_ending, ending_0, ending_1, ending_2, ending_3, label=None): self.swag_id = swag_id self.context_sentence = context_sentence self.start_ending = start_ending...
class SwagExample: '''A single training/test example for the SWAG dataset.''' def __init__(self, swag_id, context_sentence, start_ending, ending_0, ending_1, ending_2, ending_3, label=None): pass def __str__(self): pass def __repr__(self): pass
4
1
9
1
9
0
1
0.04
1
0
0
0
3
5
3
3
33
5
27
10
23
1
14
10
10
2
1
1
4
153
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/translation/run_translation.py
run_translation.DataTrainingArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ source_lang: str = field(default=None, metadata={'help': 'Source language id for translation.'}) ...
@dataclass class DataTrainingArguments: ''' Arguments pertaining to what data we are going to input our model for training and eval. ''' def __post_init__(self): pass
3
1
18
2
14
2
6
0.04
0
1
0
0
1
0
1
1
145
5
135
24
133
5
34
24
32
6
0
1
6
154
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/translation/run_translation.py
run_translation.ModelArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model identifier from hugging...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.07
0
0
0
0
0
0
0
0
45
1
41
9
40
3
9
9
8
0
0
0
0
155
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/speech-pretraining/run_wav2vec2_pretraining_no_trainer.py
run_wav2vec2_pretraining_no_trainer.DataCollatorForWav2Vec2Pretraining
import torch from typing import Optional, Union from transformers import SchedulerType, Wav2Vec2Config, Wav2Vec2FeatureExtractor, Wav2Vec2ForPreTraining, get_scheduler, is_wandb_available, set_seed from dataclasses import dataclass from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices, _sampl...
@dataclass class DataCollatorForWav2Vec2Pretraining: ''' Data collator that will dynamically pad the inputs received and prepare masked indices for self-supervised pretraining. Args: model (:class:`~transformers.Wav2Vec2ForPreTraining`): The Wav2Vec2 model used for pretraining. The d...
3
1
43
7
30
6
2
1.05
0
3
0
0
1
0
1
1
86
10
37
13
35
39
21
13
19
2
0
1
2
156
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/text-classification/run_xnli.py
run_xnli.ModelArguments
from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field(default=None, metadata={'help': 'Path to pretrained model or model identifie...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.05
0
0
0
0
0
0
0
0
59
1
55
13
54
3
13
13
12
0
0
0
0
157
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/finetune_trainer.py
seq2seq.finetune_trainer.DataTrainingArguments
from dataclasses import dataclass, field from typing import Optional @dataclass class DataTrainingArguments: """ Arguments pertaining to what data we are going to input our model for training and eval. """ data_dir: str = field(metadata={'help': 'The input data dir. Should contain the .tsv files (or ot...
@dataclass class DataTrainingArguments: ''' 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.13
0
0
0
0
0
0
0
0
60
1
56
14
55
7
14
14
13
0
0
0
0
158
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/finetune_trainer.py
seq2seq.finetune_trainer.ModelArguments
from utils import Seq2SeqDataCollator, Seq2SeqDataset, assert_all_frozen, build_compute_metrics_fn, check_output_dir, freeze_embeds, freeze_params, lmap, save_json, use_task_specific_params, write_txt_file from typing import Optional from dataclasses import dataclass, field @dataclass class ModelArguments: """ ...
@dataclass class ModelArguments: ''' Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. ''' pass
2
1
0
0
0
0
0
0.19
0
0
0
0
0
0
0
0
20
1
16
7
15
3
7
7
6
0
0
0
0
159
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/seq2seq_trainer.py
seq2seq.seq2seq_trainer.Seq2SeqTrainer
from transformers import PreTrainedModel, Trainer, logging from transformers.training_args import ParallelMode from transformers.utils import is_torch_xla_available from transformers.optimization import Adafactor, get_constant_schedule, get_constant_schedule_with_warmup, get_cosine_schedule_with_warmup, get_cosine_with...
class Seq2SeqTrainer(Trainer): def __init__(self, config=None, data_args=None, *args, **kwargs): pass def create_optimizer_and_scheduler(self, num_training_steps: int): ''' Setup the optimizer and the learning rate scheduler. We provide a reasonable default that works well. If...
9
2
24
3
18
4
4
0.2
1
17
0
0
8
6
8
92
201
29
144
41
128
29
84
34
74
8
1
2
34
160
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/seq2seq_training_args.py
seq2seq.seq2seq_training_args.Seq2SeqTrainingArguments
from seq2seq_trainer import arg_to_scheduler from transformers import TrainingArguments from typing import Optional from dataclasses import dataclass, field @dataclass class Seq2SeqTrainingArguments(TrainingArguments): """ Parameters: label_smoothing (:obj:`float`, `optional`, defaults to 0): ...
@dataclass class Seq2SeqTrainingArguments(TrainingArguments): ''' Parameters: label_smoothing (:obj:`float`, `optional`, defaults to 0): The label smoothing epsilon to apply (if not zero). sortish_sampler (:obj:`bool`, `optional`, defaults to :obj:`False`): Whether to Sor...
2
1
0
0
0
0
0
0.39
1
0
0
0
0
0
0
32
33
1
23
10
22
9
10
10
9
0
1
0
0
161
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/utils.py
seq2seq.utils.AbstractSeq2SeqDataset
from transformers.utils import cached_property import os from pathlib import Path from torch.utils.data import Dataset, Sampler import numpy as np from transformers import BartTokenizer, EvalPrediction, PreTrainedTokenizer, T5Tokenizer class AbstractSeq2SeqDataset(Dataset): def __init__(self, tokenizer, data_dir,...
class AbstractSeq2SeqDataset(Dataset): def __init__(self, tokenizer, data_dir, max_source_length, max_target_length, type_path='train', n_obs=None, prefix='', **dataset_kwargs): pass def __len__(self): pass @staticmethod def get_char_lens(data_file): pass @cached_property ...
12
1
8
0
8
0
2
0.04
1
9
2
2
7
11
8
8
82
10
69
38
47
3
47
26
37
5
1
1
14
162
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/utils.py
seq2seq.utils.DistributedSortishSampler
import torch import numpy as np from torch.utils.data import Dataset, Sampler import torch.distributed as dist from collections.abc import Iterable from transformers.utils import cached_property import math class DistributedSortishSampler(Sampler): """Copied from torch DistributedSampler""" def __init__(self,...
class DistributedSortishSampler(Sampler): '''Copied from torch DistributedSampler''' def __init__(self, dataset, batch_size, num_replicas=None, rank=None, add_extra_examples=True, shuffle=True): pass def __iter__(self) -> Iterable: pass @cached_property def available_indices(self)...
7
1
9
0
8
0
2
0.07
1
4
0
0
5
9
5
5
51
6
42
22
35
3
40
21
34
6
1
2
10
163
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/utils.py
seq2seq.utils.LegacySeq2SeqDataset
import torch.distributed as dist import torch import linecache class LegacySeq2SeqDataset(AbstractSeq2SeqDataset): def __getitem__(self, index) -> dict[str, torch.Tensor]: """Call tokenizer on src and tgt_lines""" index = index + 1 source_line = self.prefix + linecache.getline(str(self.src...
class LegacySeq2SeqDataset(AbstractSeq2SeqDataset): def __getitem__(self, index) -> dict[str, torch.Tensor]: '''Call tokenizer on src and tgt_lines''' pass def encode_line(self, tokenizer, line, max_length, pad_to_max_length=True, return_tensors='pt'): '''Only used by LegacyDataset'''...
4
2
14
0
13
1
1
0.08
1
2
0
0
3
0
3
11
44
3
39
17
35
3
24
17
20
2
2
0
4
164
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/utils.py
seq2seq.utils.Seq2SeqDataCollator
import torch.distributed as dist import torch from transformers import BartTokenizer, EvalPrediction, PreTrainedTokenizer, T5Tokenizer from transformers.models.bart.modeling_bart import shift_tokens_right class Seq2SeqDataCollator: def __init__(self, tokenizer, data_args, decoder_start_token_id, tpu_num_cores=Non...
class Seq2SeqDataCollator: def __init__(self, tokenizer, data_args, decoder_start_token_id, tpu_num_cores=None): pass def __call__(self, batch) -> dict[str, torch.Tensor]: pass def _shift_right_t5(self, input_ids): pass def _encode(self, batch) -> dict[str, torch.Tensor]: ...
5
0
15
1
14
1
3
0.04
0
4
0
0
4
6
4
4
63
6
56
15
51
2
35
15
30
4
0
1
10
165
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/utils.py
seq2seq.utils.Seq2SeqDataset
import torch.distributed as dist import torch import linecache class Seq2SeqDataset(AbstractSeq2SeqDataset): """A dataset that calls prepare_seq2seq_batch.""" def __getitem__(self, index) -> dict[str, str]: index = index + 1 source_line = self.prefix + linecache.getline(str(self.src_file), ind...
class Seq2SeqDataset(AbstractSeq2SeqDataset): '''A dataset that calls prepare_seq2seq_batch.''' def __getitem__(self, index) -> dict[str, str]: pass def collate_fn(self, batch) -> dict[str, torch.Tensor]: '''Call prepare_seq2seq_batch.''' pass
3
2
10
0
9
1
1
0.16
1
2
0
0
2
2
2
10
23
2
19
8
16
3
12
6
9
1
2
0
2
166
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/seq2seq/utils.py
seq2seq.utils.SortishSampler
from torch.utils.data import Dataset, Sampler class SortishSampler(Sampler): """Go through the text data by order of src length with a bit of randomness. From fastai repo.""" def __init__(self, data, batch_size, shuffle=True): self.data, self.bs, self.shuffle = (data, batch_size, shuffle) def __l...
class SortishSampler(Sampler): '''Go through the text data by order of src length with a bit of randomness. From fastai repo.''' def __init__(self, data, batch_size, shuffle=True): pass def __len__(self) -> int: pass def __iter__(self): pass
4
1
2
0
2
0
1
0.14
1
1
0
0
3
3
3
3
11
3
7
5
3
1
7
5
3
1
1
0
3
167
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/setup.py
setup.DepsTableUpdateCommand
from setuptools import Command, find_packages, setup class DepsTableUpdateCommand(Command): """ A custom distutils command that updates the dependency table. usage: python setup.py deps_table_update """ description = 'build runtime dependency table' user_options = [('dep-table-update', None, 'u...
class DepsTableUpdateCommand(Command): ''' A custom distutils command that updates the dependency table. usage: python setup.py deps_table_update ''' def initialize_options(self): pass def finalize_options(self): pass def run(self): pass
4
1
6
0
6
1
1
0.33
1
0
0
0
3
0
3
3
33
4
24
10
20
8
14
9
10
1
1
1
3
168
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/token-classification/tasks.py
tasks.Chunk
class Chunk(NER): def __init__(self): super().__init__(label_idx=-2) def get_labels(self, path: str) -> list[str]: if path: with open(path) as f: labels = f.read().splitlines() if 'O' not in labels: labels = ['O'] + labels ret...
class Chunk(NER): def __init__(self): pass def get_labels(self, path: str) -> list[str]: pass
3
0
17
0
17
1
2
0.03
1
2
0
0
2
0
2
9
36
1
34
5
31
1
11
4
8
3
2
2
4
169
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/token-classification/tasks.py
tasks.NER
import os from typing import TextIO, Union from utils_ner import InputExample, Split, TokenClassificationTask class NER(TokenClassificationTask): def __init__(self, label_idx=-1): self.label_idx = label_idx def read_examples_from_file(self, data_dir, mode: Union[Split, str]) -> list[InputExample]: ...
class NER(TokenClassificationTask): def __init__(self, label_idx=-1): pass def read_examples_from_file(self, data_dir, mode: Union[Split, str]) -> list[InputExample]: pass def write_predictions_to_file(self, writer: TextIO, test_input_reader: TextIO, preds_list: list): pass ...
5
0
13
0
12
1
4
0.04
1
4
2
1
4
1
4
7
55
3
50
19
45
2
45
17
40
7
1
4
16
170
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/legacy/token-classification/tasks.py
tasks.POS
from conllu import parse_incr from typing import TextIO, Union import os from utils_ner import InputExample, Split, TokenClassificationTask class POS(TokenClassificationTask): def read_examples_from_file(self, data_dir, mode: Union[Split, str]) -> list[InputExample]: if isinstance(mode, Split): ...
class POS(TokenClassificationTask): def read_examples_from_file(self, data_dir, mode: Union[Split, str]) -> list[InputExample]: pass def write_predictions_to_file(self, writer: TextIO, test_input_reader: TextIO, preds_list: list): pass def get_labels(self, path: str) -> list[str]: ...
4
0
18
0
17
0
3
0
1
4
2
0
3
0
3
6
56
3
53
18
49
0
34
16
30
5
1
3
10
171
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/trainer_qa.py
trainer_qa.QuestionAnsweringTrainer
import math import time from transformers.trainer_utils import PredictionOutput, speed_metrics from transformers import Trainer, is_torch_xla_available class QuestionAnsweringTrainer(Trainer): def __init__(self, *args, eval_examples=None, post_process_function=None, **kwargs): super().__init__(*args, **kw...
class QuestionAnsweringTrainer(Trainer): def __init__(self, *args, eval_examples=None, post_process_function=None, **kwargs): pass def evaluate(self, eval_dataset=None, eval_examples=None, ignore_keys=None, metric_key_prefix: str='eval'): pass def predict(self, predict_dataset, predict_e...
4
0
35
3
28
4
6
0.13
1
4
0
0
3
4
3
3
107
11
85
26
81
11
56
26
52
11
1
3
19
172
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/examples/pytorch/question-answering/trainer_seq2seq_qa.py
trainer_seq2seq_qa.QuestionAnsweringSeq2SeqTrainer
from typing import Optional from torch.utils.data import Dataset from transformers.trainer_utils import PredictionOutput, speed_metrics import math import time from transformers import Seq2SeqTrainer, is_torch_xla_available class QuestionAnsweringSeq2SeqTrainer(Seq2SeqTrainer): def __init__(self, *args, eval_exam...
class QuestionAnsweringSeq2SeqTrainer(Seq2SeqTrainer): def __init__(self, *args, eval_examples=None, post_process_function=None, **kwargs): pass def evaluate(self, eval_dataset: Optional[Dataset]=None, eval_examples=None, ignore_keys: Optional[list[str]]=None, metric_key_prefix: str='eval', **gen_kwa...
4
0
42
5
33
4
7
0.14
1
5
0
0
3
5
3
93
131
16
101
36
88
14
63
27
59
13
2
3
21
173
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.AccurateGELUActivation
import math import torch from torch import Tensor, nn class AccurateGELUActivation(nn.Module): """ Applies GELU approximation that is faster than default and more accurate than QuickGELU. See: https://github.com/hendrycks/GELUs Implemented along with MEGA (Moving Average Equipped Gated Attention) ...
class AccurateGELUActivation(nn.Module): ''' Applies GELU approximation that is faster than default and more accurate than QuickGELU. See: https://github.com/hendrycks/GELUs Implemented along with MEGA (Moving Average Equipped Gated Attention) ''' def __init__(self): pass def forw...
3
1
3
0
3
0
1
0.83
1
2
0
0
2
1
2
12
14
3
6
4
3
5
6
4
3
1
1
0
2
174
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.ClassInstantier
from collections import OrderedDict class ClassInstantier(OrderedDict): def __getitem__(self, key): content = super().__getitem__(key) cls, kwargs = content if isinstance(content, tuple) else (content, {}) return cls(**kwargs)
class ClassInstantier(OrderedDict): def __getitem__(self, key): pass
2
0
4
0
4
0
2
0
1
2
0
0
1
0
1
51
5
0
5
4
3
0
5
4
3
2
3
0
2
175
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.ClippedGELUActivation
import torch from torch import Tensor, nn class ClippedGELUActivation(nn.Module): """ Clip the range of possible GeLU outputs between [min, max]. This is especially useful for quantization purpose, as it allows mapping negatives values in the GeLU spectrum. For more information on this trick, please refer ...
class ClippedGELUActivation(nn.Module): ''' Clip the range of possible GeLU outputs between [min, max]. This is especially useful for quantization purpose, as it allows mapping negatives values in the GeLU spectrum. For more information on this trick, please refer to https://huggingface.co/papers/2004....
3
1
5
1
4
0
2
1
1
4
0
0
2
2
2
12
23
5
9
5
6
9
9
5
6
2
1
1
3
176
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.FastGELUActivation
import torch from .integrations.hub_kernels import use_kernel_forward_from_hub from torch import Tensor, nn @use_kernel_forward_from_hub('FastGELU') class FastGELUActivation(nn.Module): """ Applies GELU approximation that is slower than QuickGELU but more accurate. See: https://github.com/hendrycks/GELUs "...
@use_kernel_forward_from_hub('FastGELU') class FastGELUActivation(nn.Module): ''' Applies GELU approximation that is slower than QuickGELU but more accurate. See: https://github.com/hendrycks/GELUs ''' def forward(self, input: Tensor) -> Tensor: pass
3
1
2
0
2
0
1
1
1
1
0
0
1
0
1
11
7
1
3
2
1
3
3
2
1
1
1
0
1
177
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.GELUActivation
import torch from torch import Tensor, nn import math class GELUActivation(nn.Module): """ Original Implementation of the GELU activation function in Google BERT repo when initially created. For information: OpenAI GPT's GELU is slightly different (and gives slightly different results): 0.5 * x * (1 + ...
class GELUActivation(nn.Module): ''' Original Implementation of the GELU activation function in Google BERT repo when initially created. For information: OpenAI GPT's GELU is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * to...
4
1
3
0
3
0
1
0.55
1
3
0
0
3
1
3
13
20
3
11
5
7
6
10
5
6
2
1
1
4
178
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.LaplaceActivation
import torch from torch import Tensor, nn import math class LaplaceActivation(nn.Module): """ Applies elementwise activation based on Laplace function, introduced in MEGA as an attention activation. See https://huggingface.co/papers/2209.10655 Inspired by squared relu, but with bounded range and gradi...
class LaplaceActivation(nn.Module): ''' Applies elementwise activation based on Laplace function, introduced in MEGA as an attention activation. See https://huggingface.co/papers/2209.10655 Inspired by squared relu, but with bounded range and gradient for better stability ''' def forward(self,...
2
1
3
0
3
0
1
1.25
1
0
0
0
1
0
1
11
11
2
4
2
2
5
4
2
2
1
1
0
1
179
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.LinearActivation
from torch import Tensor, nn class LinearActivation(nn.Module): """ Applies the linear activation function, i.e. forwarding input directly to output. """ def forward(self, input: Tensor) -> Tensor: return input
class LinearActivation(nn.Module): ''' Applies the linear activation function, i.e. forwarding input directly to output. ''' def forward(self, input: Tensor) -> Tensor: pass
2
1
2
0
2
0
1
1
1
1
0
0
1
0
1
11
7
1
3
2
1
3
3
2
1
1
1
0
1
180
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.MishActivation
from torch import Tensor, nn import torch class MishActivation(nn.Module): """ See Mish: A Self-Regularized Non-Monotonic Activation Function (Misra., https://huggingface.co/papers/1908.08681). Also visit the official repository for the paper: https://github.com/digantamisra98/Mish """ def __init_...
class MishActivation(nn.Module): ''' See Mish: A Self-Regularized Non-Monotonic Activation Function (Misra., https://huggingface.co/papers/1908.08681). Also visit the official repository for the paper: https://github.com/digantamisra98/Mish ''' def __init__(self): pass def _mish_pytho...
4
1
3
0
3
0
1
0.36
1
2
0
0
3
1
3
13
18
3
11
5
7
4
10
5
6
2
1
1
4
181
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.NewGELUActivation
from .integrations.hub_kernels import use_kernel_forward_from_hub import torch from torch import Tensor, nn import math @use_kernel_forward_from_hub('NewGELU') class NewGELUActivation(nn.Module): """ Implementation of the GELU activation function currently in Google BERT repo (identical to OpenAI GPT). Also se...
@use_kernel_forward_from_hub('NewGELU') class NewGELUActivation(nn.Module): ''' Implementation of the GELU activation function currently in Google BERT repo (identical to OpenAI GPT). Also see the Gaussian Error Linear Units paper: https://huggingface.co/papers/1606.08415 ''' def forward(self, inpu...
3
1
2
0
2
0
1
1.33
1
1
0
0
1
0
1
11
8
1
3
2
1
4
3
2
1
1
1
0
1
182
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.PytorchGELUTanh
from torch import Tensor, nn class PytorchGELUTanh(nn.Module): """ A fast C implementation of the tanh approximation of the GeLU activation function. See https://huggingface.co/papers/1606.08415. This implementation is equivalent to NewGELU and FastGELU but much faster. However, it is not an exact num...
class PytorchGELUTanh(nn.Module): ''' A fast C implementation of the tanh approximation of the GeLU activation function. See https://huggingface.co/papers/1606.08415. This implementation is equivalent to NewGELU and FastGELU but much faster. However, it is not an exact numerical match due to roundi...
2
1
5
0
5
0
2
0.6
1
3
0
0
2
0
2
12
19
3
10
3
7
6
7
3
4
2
1
1
3
183
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.QuickGELUActivation
from .integrations.hub_kernels import use_kernel_forward_from_hub from torch import Tensor, nn import torch @use_kernel_forward_from_hub('QuickGELU') class QuickGELUActivation(nn.Module): """ Applies GELU approximation that is fast but somewhat inaccurate. See: https://github.com/hendrycks/GELUs """ d...
@use_kernel_forward_from_hub('QuickGELU') class QuickGELUActivation(nn.Module): ''' Applies GELU approximation that is fast but somewhat inaccurate. See: https://github.com/hendrycks/GELUs ''' def forward(self, input: Tensor) -> Tensor: pass
3
1
2
0
2
0
1
1
1
1
0
0
1
0
1
11
7
1
3
2
1
3
3
2
1
1
1
0
1
184
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/activations.py
transformers.activations.ReLUSquaredActivation
import torch from torch import Tensor, nn class ReLUSquaredActivation(nn.Module): """ Applies the relu^2 activation introduced in https://huggingface.co/papers/2109.08668v2 """ def forward(self, input): relu_applied = nn.functional.relu(input) squared = torch.square(relu_applied) ...
class ReLUSquaredActivation(nn.Module): ''' Applies the relu^2 activation introduced in https://huggingface.co/papers/2109.08668v2 ''' def forward(self, input): pass
2
1
4
0
4
0
1
0.6
1
0
0
0
1
0
1
11
9
1
5
4
3
3
5
4
3
1
1
0
1
185
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.Cache
from typing import Any, Optional import torch class Cache: """ A `Cache` is mostly a list of `CacheLayerMixin` objects, one per model layer. It serves as a container for the Cache of each layer. Args: layers (`Optional`, *optional*): A list of pre-created `CacheLayerMixin`. If omit...
class Cache: ''' A `Cache` is mostly a list of `CacheLayerMixin` objects, one per model layer. It serves as a container for the Cache of each layer. Args: layers (`Optional`, *optional*): A list of pre-created `CacheLayerMixin`. If omitted (`None`), then `layer_class_to_replicate` w...
28
21
9
0
5
3
2
0.65
1
7
0
5
7
0
7
17
76
10
40
20
25
26
29
13
21
4
1
2
12
186
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.DynamicCache
import torch from collections.abc import Iterable from typing import Any, Optional from .configuration_utils import PretrainedConfig class DynamicCache(Cache): """ A cache that grows dynamically as more tokens are generated. This is the default for generative models. It stores the key and value states as a...
class DynamicCache(Cache): ''' A cache that grows dynamically as more tokens are generated. This is the default for generative models. It stores the key and value states as a list of `CacheLayer`, one for each layer. The expected shape for each tensor in the `CacheLayer`s is `[batch_size, num_heads, se...
5
3
11
0
7
4
2
0.61
1
7
0
5
12
3
14
31
198
26
110
53
79
67
85
39
70
6
2
3
34
187
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.EncoderDecoderCache
from collections.abc import Iterable from typing import Any, Optional import torch class EncoderDecoderCache(Cache): """ Base, abstract class for all encoder-decoder caches. Can be used to hold combinations of self-attention and cross-attention caches. See `Cache` for details on common methods that ar...
null
23
13
9
0
8
2
2
0.35
1
10
1
0
12
4
14
31
176
23
113
44
88
40
79
35
64
5
2
3
28
188
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.HQQQuantizedCache
from .configuration_utils import PretrainedConfig class HQQQuantizedCache(QuantizedCache): def __init__(self, config: PretrainedConfig, nbits: int=4, axis_key: int=0, axis_value: int=0, q_group_size: int=64, residual_length: int=128): logger.warning_once("`HQQQuantizedCache` is deprecated and will be remo...
class HQQQuantizedCache(QuantizedCache): def __init__(self, config: PretrainedConfig, nbits: int=4, axis_key: int=0, axis_value: int=0, q_group_size: int=64, residual_length: int=128): pass
2
0
10
1
9
0
2
0.75
1
3
1
0
3
4
3
39
60
12
28
11
24
21
19
8
15
4
4
1
6
189
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.HybridCache
from .configuration_utils import PretrainedConfig class HybridCache(StaticCache): def __init__(self, config: PretrainedConfig, max_cache_len: int, *args, **kwargs): logger.warning_once('`HybridCache` is deprecated and will be removed in version v4.59 Use `StaticCache(...)` instead which will correctly inf...
class HybridCache(StaticCache): def __init__(self, config: PretrainedConfig, max_cache_len: int, *args, **kwargs): pass
2
0
20
1
17
2
3
0.36
1
8
0
0
8
9
8
25
213
26
138
52
112
50
87
35
78
10
2
2
24
190
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.OffloadedCache
class OffloadedCache(DynamicCache): def __init__(self) -> None: logger.warning_once('`OffloadedCache` is deprecated and will be removed in version v4.59 Use `DynamicCache(offloading=True)` instead') super().__init__(offloading=True)
class OffloadedCache(DynamicCache): def __init__(self) -> None: pass
2
0
15
0
10
5
2
0.67
1
9
0
0
6
3
6
37
112
11
61
24
48
41
52
18
45
4
3
2
14
191
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.OffloadedStaticCache
from .configuration_utils import PretrainedConfig class OffloadedStaticCache(StaticCache): def __init__(self, config: PretrainedConfig, max_cache_len: int, *args, **kwargs): logger.warning_once('`OffloadedStaticCache` is deprecated and will be removed in version v4.59 Use `StaticCache(..., offloading=True...
class OffloadedStaticCache(StaticCache): def __init__(self, config: PretrainedConfig, max_cache_len: int, *args, **kwargs): pass
2
0
23
4
12
7
3
0.97
1
8
0
0
9
11
9
32
280
53
115
53
86
112
89
34
79
10
3
3
29
192
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.QuantizedCache
from .configuration_utils import PretrainedConfig class QuantizedCache(Cache): """ A quantizer cache similar to what is described in the [KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache paper](https://huggingface.co/papers/2402.02750). It allows the model to generate longer sequence lengt...
class QuantizedCache(Cache): ''' A quantizer cache similar to what is described in the [KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache paper](https://huggingface.co/papers/2402.02750). It allows the model to generate longer sequence length without allocating too much memory for keys and ...
2
1
14
1
12
1
2
0.29
1
8
1
2
5
9
5
36
88
12
59
24
47
17
45
18
39
5
3
2
11
193
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.QuantoQuantizedCache
from .configuration_utils import PretrainedConfig class QuantoQuantizedCache(QuantizedCache): def __init__(self, config: PretrainedConfig, nbits: int=4, axis_key: int=0, axis_value: int=0, q_group_size: int=64, residual_length: int=128): logger.warning_once("`QuantoQuantizedCache` is deprecated and will b...
class QuantoQuantizedCache(QuantizedCache): def __init__(self, config: PretrainedConfig, nbits: int=4, axis_key: int=0, axis_value: int=0, q_group_size: int=64, residual_length: int=128): pass
2
0
11
2
9
1
3
0.79
1
4
1
0
3
2
3
39
64
15
28
11
22
22
24
11
18
7
4
2
10
194
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.SinkCache
class SinkCache(Cache): """ It is now a `custom_generate` repository on the Hub: https://huggingface.co/transformers-community/sink_cache. See [these docs](https://huggingface.co/docs/transformers/generation_strategies#custom-decoding-methods) for general `custom_generate`usage. """ def __init_...
class SinkCache(Cache): ''' It is now a `custom_generate` repository on the Hub: https://huggingface.co/transformers-community/sink_cache. See [these docs](https://huggingface.co/docs/transformers/generation_strategies#custom-decoding-methods) for general `custom_generate`usage. ''' def __init_...
2
1
20
2
14
5
3
0.6
1
5
0
0
6
8
7
24
185
28
99
47
80
59
72
36
64
11
2
3
19
195
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.SlidingWindowCache
from .configuration_utils import PretrainedConfig class SlidingWindowCache(StaticCache): def __init__(self, config: PretrainedConfig, max_cache_len: int, *args, **kwargs): logger.warning_once('`SlidingWindowCache` is deprecated and will be removed in version v4.59 Use `StaticCache(...)` instead which will...
class SlidingWindowCache(StaticCache): def __init__(self, config: PretrainedConfig, max_cache_len: int, *args, **kwargs): pass
2
0
22
2
18
2
3
0.7
1
8
0
0
4
1
4
27
149
23
74
29
54
52
47
14
42
4
3
2
10
196
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/cache_utils.py
transformers.cache_utils.StaticCache
from .configuration_utils import PretrainedConfig class StaticCache(Cache): """ Static Cache class to be used with `torch.compile(model)` and `torch.export()`. It will check the `config` for potential hybrid cache structure, and initialize each layer accordingly. See `Cache` for details on common meth...
class StaticCache(Cache): ''' Static Cache class to be used with `torch.compile(model)` and `torch.export()`. It will check the `config` for potential hybrid cache structure, and initialize each layer accordingly. See `Cache` for details on common methods that are implemented by all cache classes. ...
2
1
22
2
15
6
3
0.72
1
7
0
2
6
8
6
23
186
24
94
42
70
68
63
25
56
9
2
2
20
197
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/__init__.py
transformers.commands.BaseTransformersCLICommand
from abc import ABC, abstractmethod from argparse import ArgumentParser class BaseTransformersCLICommand(ABC): @staticmethod @abstractmethod def register_subcommand(parser: ArgumentParser): raise NotImplementedError() @abstractmethod def run(self): raise NotImplementedError()
class BaseTransformersCLICommand(ABC): @staticmethod @abstractmethod def register_subcommand(parser: ArgumentParser): pass @abstractmethod def run(self): pass
6
0
2
0
2
0
1
0
1
2
0
11
1
0
2
22
9
1
8
5
2
0
5
3
2
1
4
0
2
198
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/add_fast_image_processor.py
transformers.commands.add_fast_image_processor.AddFastImageProcessorCommand
from argparse import ArgumentParser, Namespace from . import BaseTransformersCLICommand class AddFastImageProcessorCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): add_fast_image_processor_parser = parser.add_parser('add-fast-image-processor') ...
class AddFastImageProcessorCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): pass def __init__(self, model_name: str, *args): pass def run(self): pass
5
0
4
0
4
0
1
0
1
2
0
0
2
1
3
25
17
2
15
7
10
0
9
6
5
1
5
0
3
199
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/commands/add_new_model_like.py
transformers.commands.add_new_model_like.AddNewModelLikeCommand
from . import BaseTransformersCLICommand from pathlib import Path from argparse import ArgumentParser, Namespace class AddNewModelLikeCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): add_new_model_like_parser = parser.add_parser('add-new-model-like') ...
class AddNewModelLikeCommand(BaseTransformersCLICommand): @staticmethod def register_subcommand(parser: ArgumentParser): pass def __init__(self, path_to_repo=None, *args): pass def run(self): pass
5
0
15
1
13
0
2
0.02
1
4
1
0
2
6
3
25
48
5
42
16
35
1
24
14
18
2
5
2
5