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
3,400
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llama/tokenization_llama.py
transformers.models.llama.tokenization_llama.LlamaTokenizer
from ...convert_slow_tokenizer import import_protobuf from ...tokenization_utils import AddedToken, PreTrainedTokenizer from typing import TYPE_CHECKING, Any, Optional import os import sentencepiece as spm from ...utils.import_utils import requires from shutil import copyfile @requires(backends=('sentencepiece',)) cla...
@requires(backends=('sentencepiece',)) class LlamaTokenizer(PreTrainedTokenizer): ''' Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as there is no padding token in the original model. Args: vocab_file (`str`): Path to the voca...
20
11
16
2
11
4
3
0.69
1
7
0
1
16
8
16
105
357
53
180
75
141
125
124
51
107
7
3
3
47
3,401
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llama/tokenization_llama_fast.py
transformers.models.llama.tokenization_llama_fast.LlamaTokenizerFast
from tokenizers import processors from ...tokenization_utils_fast import PreTrainedTokenizerFast from typing import Optional from shutil import copyfile import os class LlamaTokenizerFast(PreTrainedTokenizerFast): """ Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding. This uses notably B...
class LlamaTokenizerFast(PreTrainedTokenizerFast): ''' Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding. This uses notably ByteFallback and no normalization. ```python >>> from transformers import LlamaTokenizerFast >>> tokenizer = LlamaTokenizerFast.from_pretrained("hf-inter...
13
2
13
1
11
0
3
0.6
1
4
0
0
9
5
9
97
207
31
110
49
81
66
64
30
54
9
3
1
27
3,402
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/configuration_llava.py
transformers.models.llava.configuration_llava.LlavaConfig
from ..auto import CONFIG_MAPPING, AutoConfig from ...configuration_utils import PretrainedConfig class LlavaConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`LlavaForConditionalGeneration`]. It is used to instantiate an Llava model according to the specified a...
class LlavaConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`LlavaForConditionalGeneration`]. It is used to instantiate an Llava model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults wil...
2
1
56
7
49
0
8
0.83
1
3
0
0
1
9
1
1
114
19
52
25
38
43
24
13
22
8
1
1
8
3,403
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/image_processing_llava.py
transformers.models.llava.image_processing_llava.LlavaImageProcessor
from ...image_transforms import convert_to_rgb, get_resize_output_image_size, resize, to_channel_dimension_format from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...utils import TensorType, is_vision_available, logging from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_S...
class LlavaImageProcessor(BaseImageProcessor): ''' Constructs a LLaVa image processor. Args: do_pad (`bool`, *optional*, defaults to `False`): Whether to pad the image to a square based on the longest edge. The padding value is determined by the `image_mean` parameter. ...
5
4
83
6
53
24
11
0.63
1
11
3
0
4
13
4
24
381
31
215
76
162
135
101
28
96
23
3
2
43
3,404
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/image_processing_llava_fast.py
transformers.models.llava.image_processing_llava_fast.LlavaImageProcessorFast
from ...image_processing_utils import BatchFeature from ...processing_utils import Unpack import torch from typing import Optional, Union from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, SizeDict, get_image_size from ...utils import TensorType, auto_docstri...
@auto_docstring class LlavaImageProcessorFast(BaseImageProcessorFast): def __init__(self, **kwargs: Unpack[LlavaFastImageProcessorKwargs]) -> None: pass @auto_docstring def preprocess(self, images: ImageInput, **kwargs: Unpack[LlavaFastImageProcessorKwargs]) -> BatchFeature: pass def p...
7
1
25
2
19
5
4
0.19
1
12
5
0
4
0
4
38
127
13
96
62
63
18
59
34
54
8
4
2
15
3,405
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/modeling_llava.py
transformers.models.llava.modeling_llava.LlavaCausalLMOutputWithPast
from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput from ...cache_utils import Cache import torch from typing import Optional, Union from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from dataclasses import dataclass @dataclass @auto_docstring(custom_intro='\n Base ...
@dataclass @auto_docstring(custom_intro='\n Base class for Llava causal language model (or autoregressive) outputs.\n ') class LlavaCausalLMOutputWithPast(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-...
3
1
0
0
0
0
0
3.57
1
0
0
1
0
0
0
0
37
5
7
7
6
25
7
7
6
0
1
0
0
3,406
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/modeling_llava.py
transformers.models.llava.modeling_llava.LlavaForConditionalGeneration
from .configuration_llava import LlavaConfig from torch import nn from ...processing_utils import Unpack from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...cache_utils import Cache import torch from typing import Optional, Union from ...generation import GenerationMixin @auto_do...
@auto_docstring(custom_intro='\n The LLAVA model which consists of a vision backbone and a language model.\n ') class LlavaForConditionalGeneration(LlavaPreTrainedModel, GenerationMixin): def __init__(self, config: LlavaConfig): pass def get_input_embeddings(self): pass def set_inpu...
19
1
30
4
20
6
4
0.31
2
11
5
0
11
6
11
12
345
51
225
91
175
70
123
55
111
16
2
2
39
3,407
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/modeling_llava.py
transformers.models.llava.modeling_llava.LlavaMultiModalProjector
from torch import nn from .configuration_llava import LlavaConfig from ...activations import ACT2FN class LlavaMultiModalProjector(nn.Module): def __init__(self, config: LlavaConfig): super().__init__() num_feature_layers = 1 if isinstance(config.vision_feature_layer, int) else len(config.vision_f...
class LlavaMultiModalProjector(nn.Module): def __init__(self, config: LlavaConfig): pass def forward(self, image_features): pass
3
0
9
0
9
1
2
0.06
1
3
1
0
2
3
2
12
20
1
18
8
15
1
12
8
9
2
1
0
3
3,408
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/modeling_llava.py
transformers.models.llava.modeling_llava.LlavaPreTrainedModel
from ...modeling_utils import PreTrainedModel from .configuration_llava import LlavaConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging @auto_docstring class LlavaPreTrainedModel(PreTrainedModel): config: LlavaConfig base_model_prefix = '' supports_gradient_checkpointi...
@auto_docstring class LlavaPreTrainedModel(PreTrainedModel): pass
2
0
21
2
16
3
7
0.12
1
0
0
1
1
0
1
1
31
3
25
11
23
3
20
11
18
7
1
2
7
3,409
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/processing_llava.py
transformers.models.llava.processing_llava.LlavaProcessor
from ...image_utils import ImageInput, get_image_size, to_numpy_array from ...feature_extraction_utils import BatchFeature from ...tokenization_utils_base import PreTokenizedInput, TextInput from typing import Optional, Union import numpy as np from ...processing_utils import MultiModalData, ProcessingKwargs, Processor...
class LlavaProcessor(ProcessorMixin): ''' Constructs a LLaVa processor which wraps a LLaVa image processor and a LLaMa tokenizer into a single processor. [`LlavaProcessor`] offers all the functionalities of [`LlavaImageProcessor`] and [`LlamaTokenizerFast`]. See the [`~LlavaProcessor.__call__`] and [`~...
4
3
22
2
13
8
3
0.87
1
7
2
0
5
4
5
22
156
17
75
42
51
65
43
24
37
8
2
2
13
3,410
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava/processing_llava.py
transformers.models.llava.processing_llava.LlavaProcessorKwargs
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack class LlavaProcessorKwargs(ProcessingKwargs, total=False): _defaults = {'text_kwargs': {'padding': False, 'return_mm_token_type_ids': False}, 'images_kwargs': {}}
class LlavaProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
7
0
7
2
6
0
2
2
1
0
3
0
0
3,411
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/configuration_llava_next.py
transformers.models.llava_next.configuration_llava_next.LlavaNextConfig
from ...configuration_utils import PretrainedConfig from ..auto import CONFIG_MAPPING, AutoConfig class LlavaNextConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`LlavaNextForConditionalGeneration`]. It is used to instantiate an Llava-NeXT model according to th...
class LlavaNextConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`LlavaNextForConditionalGeneration`]. It is used to instantiate an Llava-NeXT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the...
2
1
64
7
57
0
9
0.82
1
3
0
0
1
10
1
1
127
18
60
28
44
49
26
14
24
9
1
1
9
3,412
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/image_processing_llava_next.py
transformers.models.llava_next.image_processing_llava_next.LlavaNextImageProcessor
import numpy as np from collections.abc import Iterable from ...utils import TensorType, is_vision_available, logging from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_patch_output_size, get_size_dict, select_best_resolution from ...image_transforms import PaddingMode, convert_to_rgb, get_resi...
class LlavaNextImageProcessor(BaseImageProcessor): ''' Constructs a LLaVa-NeXT image processor. Based on [`CLIPImageProcessor`] with incorporation of additional techniques for processing high resolution images as explained in the [LLaVa paper](https://huggingface.co/papers/2310.03744). Args: do...
11
9
61
5
33
23
5
0.85
1
12
3
0
9
13
9
29
610
58
299
133
205
253
124
49
114
21
3
2
49
3,413
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/image_processing_llava_next_fast.py
transformers.models.llava_next.image_processing_llava_next_fast.LlavaNextImageProcessorFast
import torch from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, SizeDict, get_image_size from ...image_processing_utils import BatchFeature, get_patch_output_size, select_best_resolution from ...utils import TensorType, auto_docstring, is_torchvision_v2_avail...
@auto_docstring class LlavaNextImageProcessorFast(BaseImageProcessorFast): def __init__(self, **kwargs: Unpack[LlavaNextFastImageProcessorKwargs]): pass @auto_docstring def preprocess(self, images: ImageInput, **kwargs: Unpack[LlavaNextFastImageProcessorKwargs]) -> BatchFeature: pass d...
11
4
25
3
16
7
2
0.37
1
13
5
1
8
0
8
42
238
30
152
100
93
56
78
50
69
11
4
3
19
3,414
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/modeling_llava_next.py
transformers.models.llava_next.modeling_llava_next.LlavaNextCausalLMOutputWithPast
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput from dataclasses import dataclass import torch from typing import Optional, Union from ...cache_utils import Cache @dataclass @auto_docstring(custom_intro='\n Base ...
@dataclass @auto_docstring(custom_intro='\n Base class for LlavaNext causal language model (or autoregressive) outputs.\n ') class LlavaNextCausalLMOutputWithPast(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (f...
3
1
0
0
0
0
0
3.57
1
0
0
0
0
0
0
0
37
5
7
7
6
25
7
7
6
0
1
0
0
3,415
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/modeling_llava_next.py
transformers.models.llava_next.modeling_llava_next.LlavaNextForConditionalGeneration
import torch from torch import nn from typing import Optional, Union from .configuration_llava_next import LlavaNextConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from ...processing_utils import Unpack from ...generation import GenerationMixin from ...cache_utils import Cache ...
@auto_docstring(custom_intro='\n The LLAVA-NeXT model which consists of a vision backbone and a language model.\n ') class LlavaNextForConditionalGeneration(LlavaNextPreTrainedModel, GenerationMixin): def __init__(self, config: LlavaNextConfig): pass def get_input_embeddings(self): pass ...
22
2
42
4
25
13
4
0.54
2
13
5
0
14
8
14
15
611
62
357
124
290
193
191
74
176
16
2
3
57
3,416
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/modeling_llava_next.py
transformers.models.llava_next.modeling_llava_next.LlavaNextMultiModalProjector
from torch import nn from ...activations import ACT2FN from .configuration_llava_next import LlavaNextConfig class LlavaNextMultiModalProjector(nn.Module): def __init__(self, config: LlavaNextConfig): super().__init__() num_feature_layers = 1 if isinstance(config.vision_feature_layer, int) else le...
class LlavaNextMultiModalProjector(nn.Module): def __init__(self, config: LlavaNextConfig): pass def forward(self, image_features): pass
3
0
9
0
9
1
2
0.06
1
3
1
0
2
3
2
12
20
1
18
8
15
1
12
8
9
2
1
0
3
3,417
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/modeling_llava_next.py
transformers.models.llava_next.modeling_llava_next.LlavaNextPreTrainedModel
from ...modeling_utils import PreTrainedModel from torch import nn from .configuration_llava_next import LlavaNextConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging import math @auto_docstring class LlavaNextPreTrainedModel(PreTrainedModel): config: LlavaNextConfig base_m...
@auto_docstring class LlavaNextPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
21
2
16
3
7
0.12
1
0
0
1
1
0
1
1
31
3
25
11
23
3
20
11
18
7
1
2
7
3,418
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/processing_llava_next.py
transformers.models.llava_next.processing_llava_next.LlavaNextProcessor
from ...tokenization_utils_base import PreTokenizedInput, TextInput from ...image_utils import ImageInput, get_image_size, to_numpy_array from ...feature_extraction_utils import BatchFeature from typing import Optional, Union from ...image_processing_utils import select_best_resolution from ...processing_utils import M...
class LlavaNextProcessor(ProcessorMixin): ''' Constructs a LLaVa-NeXT processor which wraps a LLaVa-NeXT image processor and a LLaMa tokenizer into a single processor. [`LlavaNextProcessor`] offers all the functionalities of [`LlavaNextImageProcessor`] and [`LlamaTokenizerFast`]. See the [`~LlavaNextPr...
6
4
21
2
14
6
3
0.59
1
9
2
0
7
4
7
24
194
22
109
63
83
64
74
45
66
10
2
4
18
3,419
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next/processing_llava_next.py
transformers.models.llava_next.processing_llava_next.LlavaNextProcessorKwargs
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack class LlavaNextProcessorKwargs(ProcessingKwargs, total=False): _defaults = {'text_kwargs': {'padding': False, 'return_mm_token_type_ids': False}, 'images_kwargs': {'do_pad': True}}
class LlavaNextProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
9
0
9
2
8
0
2
2
1
0
3
0
0
3,420
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/image_processing_llava_next_video.py
transformers.models.llava_next_video.image_processing_llava_next_video.LlavaNextVideoImageProcessor
from ...utils import TensorType, logging from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, validate_preprocess_arguments from ...image_processing_utils import BaseImag...
class LlavaNextVideoImageProcessor(BaseImageProcessor): ''' Constructs a LLaVa-NeXT-Video video processor. Based on [`CLIPImageProcessor`] with incorporation of processing each video frame. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, ...
5
4
75
5
44
27
7
0.85
1
9
2
0
4
12
4
24
349
24
176
79
115
149
70
23
65
12
3
2
29
3,421
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modeling_llava_next_video.py
transformers.models.llava_next_video.modeling_llava_next_video.LlavaNextVideoCausalLMOutputWithPast
from dataclasses import dataclass import torch from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput from ...cache_utils import Cache from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Base ...
@dataclass @auto_docstring(custom_intro='\n Base class for LlavaNextVideo causal language model (or autoregressive) outputs.\n ') class LlavaNextVideoCausalLMOutputWithPast(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeli...
3
1
0
0
0
0
0
3.5
1
0
0
0
0
0
0
0
43
7
8
8
7
28
8
8
7
0
1
0
0
3,422
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modeling_llava_next_video.py
transformers.models.llava_next_video.modeling_llava_next_video.LlavaNextVideoForConditionalGeneration
from ...generation import GenerationMixin from ...cache_utils import Cache from ...processing_utils import Unpack from torch import nn from .configuration_llava_next_video import LlavaNextVideoConfig from typing import Optional, Union import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tupl...
@auto_docstring(custom_intro='\n The LLAVA-NeXT model which consists of a vision backbone and a language model.\n ') class LlavaNextVideoForConditionalGeneration(LlavaNextVideoPreTrainedModel, GenerationMixin): def __init__(self, config: LlavaNextVideoConfig): pass def get_input_embeddings(self)...
23
2
47
4
27
16
4
0.59
2
14
6
0
15
11
15
16
718
69
408
146
330
242
222
86
206
19
2
3
64
3,423
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modeling_llava_next_video.py
transformers.models.llava_next_video.modeling_llava_next_video.LlavaNextVideoMultiModalProjector
from .configuration_llava_next_video import LlavaNextVideoConfig from ...activations import ACT2FN from torch import nn class LlavaNextVideoMultiModalProjector(nn.Module): def __init__(self, config: LlavaNextVideoConfig): super().__init__() num_feature_layers = 1 if isinstance(config.vision_featur...
class LlavaNextVideoMultiModalProjector(nn.Module): def __init__(self, config: LlavaNextVideoConfig): pass def forward(self, image_features): pass
3
0
9
0
9
1
2
0.06
1
3
1
0
2
3
2
12
20
1
18
8
15
1
12
8
9
2
1
0
3
3,424
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modeling_llava_next_video.py
transformers.models.llava_next_video.modeling_llava_next_video.LlavaNextVideoPooler
import math from torch import nn class LlavaNextVideoPooler(nn.Module): def __init__(self, config): super().__init__() mode = config.spatial_pool_mode stride = config.spatial_pool_stride out_channels = getattr(config, 'spatial_pool_out_channels', config.vision_config.hidden_size) ...
class LlavaNextVideoPooler(nn.Module): def __init__(self, config): pass def forward(self, image_features): pass
3
0
15
2
13
0
3
0
1
3
0
0
2
2
2
12
32
5
27
13
24
0
19
13
16
4
1
1
5
3,425
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modeling_llava_next_video.py
transformers.models.llava_next_video.modeling_llava_next_video.LlavaNextVideoPreTrainedModel
from .configuration_llava_next_video import LlavaNextVideoConfig from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging import math from torch import nn from ...modeling_utils import PreTrainedModel @auto_docstring class LlavaNextVideoPreTrainedModel(PreTrainedModel): config: LlavaNextV...
@auto_docstring class LlavaNextVideoPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
21
2
16
3
7
0.12
1
0
0
1
1
0
1
1
31
3
25
11
23
3
20
11
18
7
1
2
7
3,426
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modular_llava_next_video.py
transformers.models.llava_next_video.modular_llava_next_video.LlavaNextVideoCausalLMOutputWithPast
from typing import Optional, Union from transformers.models.llava_next.modeling_llava_next import LlavaNextCausalLMOutputWithPast, LlavaNextForConditionalGeneration, LlavaNextModel, LlavaNextModelOutputWithPast, LlavaNextMultiModalProjector, TransformersKwargs, image_size_to_num_patches import torch class LlavaNextVid...
class LlavaNextVideoCausalLMOutputWithPast(LlavaNextCausalLMOutputWithPast): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-token prediction). logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config...
1
1
0
0
0
0
0
2.5
1
0
0
0
0
0
0
0
8
1
2
2
1
5
2
2
1
0
2
0
0
3,427
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modular_llava_next_video.py
transformers.models.llava_next_video.modular_llava_next_video.LlavaNextVideoConfig
from ..auto import CONFIG_MAPPING, AutoConfig from ...configuration_utils import PretrainedConfig class LlavaNextVideoConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`LlavaNextVideoForConditionalGeneration`]. It is used to instantiate an Llava-NeXT model accor...
class LlavaNextVideoConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`LlavaNextVideoForConditionalGeneration`]. It is used to instantiate an Llava-NeXT model according to the specified arguments, defining the model architecture. Instantiating a configuration ...
2
1
72
7
65
0
9
0.81
1
3
0
0
1
14
1
33
140
17
68
36
48
55
30
18
28
9
2
1
9
3,428
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modular_llava_next_video.py
transformers.models.llava_next_video.modular_llava_next_video.LlavaNextVideoForConditionalGeneration
from ...processing_utils import Unpack import torch from typing import Optional, Union from transformers.models.llava_next.modeling_llava_next import LlavaNextCausalLMOutputWithPast, LlavaNextForConditionalGeneration, LlavaNextModel, LlavaNextModelOutputWithPast, LlavaNextMultiModalProjector, TransformersKwargs, image_...
class LlavaNextVideoForConditionalGeneration(LlavaNextForConditionalGeneration): def get_video_features(self, pixel_values: torch.FloatTensor, vision_feature_layer: Optional[Union[int, list[int]]]=None, vision_feature_select_strategy: Optional[str]=None): pass def forward(self, input_ids: Optional[to...
4
1
72
7
42
23
6
0.54
1
10
3
0
5
3
5
22
364
37
212
79
163
115
97
36
91
19
3
2
32
3,429
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/modular_llava_next_video.py
transformers.models.llava_next_video.modular_llava_next_video.LlavaNextVideoPooler
from torch import nn import math class LlavaNextVideoPooler(nn.Module): def __init__(self, config): super().__init__() mode = config.spatial_pool_mode stride = config.spatial_pool_stride out_channels = getattr(config, 'spatial_pool_out_channels', config.vision_config.hidden_size) ...
class LlavaNextVideoPooler(nn.Module): def __init__(self, config): pass def forward(self, image_features): pass
3
0
15
2
13
0
3
0
1
3
0
0
2
2
2
12
32
5
27
13
24
0
19
13
16
4
1
1
5
3,430
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_next_video/processing_llava_next_video.py
transformers.models.llava_next_video.processing_llava_next_video.LlavaNextVideoProcessor
from ...tokenization_utils_base import PreTokenizedInput, TextInput from ...image_processing_utils import select_best_resolution from ...video_utils import VideoInput import numpy as np from ...image_utils import ImageInput, get_image_size, to_numpy_array from typing import Optional, Union from ...processing_utils impo...
class LlavaNextVideoProcessor(ProcessorMixin): ''' Constructs a LLaVa-NeXT-Video processor which wraps a LLaVa-NeXT image processor, LLaVa-NeXT-Video video processor and a LLaMa tokenizer into a single processor. [`LlavaNextVideoProcessor`] offers all the functionalities of [`LlavaNextImageProcessor`],...
6
4
28
2
17
9
3
0.75
1
10
2
0
7
5
7
24
253
24
132
72
102
99
88
50
80
13
2
4
22
3,431
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/configuration_llava_onevision.py
transformers.models.llava_onevision.configuration_llava_onevision.LlavaOnevisionConfig
from ...configuration_utils import PretrainedConfig from ..auto import CONFIG_MAPPING, AutoConfig class LlavaOnevisionConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`LlavaOnevisionForConditionalGeneration`]. It is used to instantiate an Llava-NeXT model accor...
class LlavaOnevisionConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`LlavaOnevisionForConditionalGeneration`]. It is used to instantiate an Llava-NeXT model according to the specified arguments, defining the model architecture. Instantiating a configuration ...
2
1
100
7
93
0
9
0.51
1
3
0
0
1
10
1
1
163
18
96
28
80
49
26
14
24
9
1
1
9
3,432
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/image_processing_llava_onevision.py
transformers.models.llava_onevision.image_processing_llava_onevision.LlavaOnevisionImageProcessor
from ...utils import TensorType, is_vision_available, logging from typing import Optional, Union from ...image_transforms import PaddingMode, convert_to_rgb, pad, resize, to_channel_dimension_format import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_patch_output_size, get_siz...
class LlavaOnevisionImageProcessor(BaseImageProcessor): ''' Constructs a LLaVa-Onevision image processor. Based on [`SiglipImageProcessor`] with incorporation of processing each video frame. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height,...
11
9
64
5
36
23
5
0.77
1
12
3
0
8
11
8
28
569
51
292
114
212
226
103
43
94
19
3
1
41
3,433
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/image_processing_llava_onevision_fast.py
transformers.models.llava_onevision.image_processing_llava_onevision_fast.LlavaOnevisionImageProcessorFast
from ...image_processing_utils_fast import BaseImageProcessorFast, DefaultFastImageProcessorKwargs, divide_to_patches, group_images_by_shape, reorder_images import torch from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, SizeDict, get_image_size from ...proce...
@auto_docstring class LlavaOnevisionImageProcessorFast(BaseImageProcessorFast): def __init__(self, **kwargs: Unpack[LlavaOnevisionFastImageProcessorKwargs]): pass @auto_docstring def preprocess(self, images: ImageInput, **kwargs: Unpack[LlavaOnevisionFastImageProcessorKwargs]) -> BatchFeature: ...
12
5
25
3
16
7
2
0.36
1
13
5
0
8
0
8
42
237
30
153
101
94
55
79
51
70
11
4
3
19
3,434
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/modeling_llava_onevision.py
transformers.models.llava_onevision.modeling_llava_onevision.LlavaOnevisionCausalLMOutputWithPast
from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput from typing import Optional, Union import torch from ...cache_utils import Cache from dataclasses import dataclass from ...utils import TransformersKwargs, auto_docstring, can_return_tuple @dataclass @auto_docstring(custom_intro='\n Base class for...
@dataclass @auto_docstring(custom_intro='\n Base class for LlavaOnevision causal language model (or autoregressive) outputs.\n ') class LlavaOnevisionCausalLMOutputWithPast(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeli...
3
1
0
0
0
0
0
3.5
1
0
0
0
0
0
0
0
42
6
8
8
7
28
8
8
7
0
1
0
0
3,435
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/modeling_llava_onevision.py
transformers.models.llava_onevision.modeling_llava_onevision.LlavaOnevisionForConditionalGeneration
import torch from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...processing_utils import Unpack from ...cache_utils import Cache from ...generation import GenerationMixin from .configuration_llava_onevision import LlavaOnevisionConfig from typing import Optional, Union from torch import nn...
@auto_docstring(custom_intro='\n The LLAVA-NeXT model which consists of a vision backbone and a language model.\n ') class LlavaOnevisionForConditionalGeneration(LlavaOnevisionPreTrainedModel, GenerationMixin): def __init__(self, config: LlavaOnevisionConfig): pass def get_input_embeddings(self)...
23
2
34
3
23
8
4
0.36
2
13
5
0
13
6
13
14
469
50
308
108
246
111
159
61
145
20
2
3
48
3,436
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/modeling_llava_onevision.py
transformers.models.llava_onevision.modeling_llava_onevision.LlavaOnevisionMultiModalProjector
from ...activations import ACT2FN from .configuration_llava_onevision import LlavaOnevisionConfig from torch import nn class LlavaOnevisionMultiModalProjector(nn.Module): def __init__(self, config: LlavaOnevisionConfig): super().__init__() num_feature_layers = 1 if isinstance(config.vision_feature...
class LlavaOnevisionMultiModalProjector(nn.Module): def __init__(self, config: LlavaOnevisionConfig): pass def forward(self, image_features): pass
3
0
9
0
9
1
2
0.06
1
3
1
0
2
3
2
12
20
1
18
8
15
1
12
8
9
2
1
0
3
3,437
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/modeling_llava_onevision.py
transformers.models.llava_onevision.modeling_llava_onevision.LlavaOnevisionPreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple from ...modeling_utils import PreTrainedModel from .configuration_llava_onevision import LlavaOnevisionConfig from torch import nn import math @auto_docstring class LlavaOnevisionPreTrainedModel(PreTrainedModel): config: LlavaOnevisionConfig...
@auto_docstring class LlavaOnevisionPreTrainedModel(PreTrainedModel): def _init_weights(self, module): pass
3
0
21
2
16
3
7
0.19
1
0
0
1
1
0
1
1
34
3
27
13
25
5
22
13
20
7
1
2
7
3,438
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/modular_llava_onevision.py
transformers.models.llava_onevision.modular_llava_onevision.LlavaOnevisionImageProcessorFast
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, SizeDict, get_image_size from ...utils import TensorType, auto_docstring, can_return_tuple, is_torchvision_v2_available, logging from ...image_processing_utils import BatchFeature from typing import Optional,...
class LlavaOnevisionImageProcessorFast(LlavaNextImageProcessorFast): def pad_to_square(self, images: 'torch.Tensor', background_color: Union[int, tuple[int, int, int]]=0) -> 'torch.Tensor': ''' Pads an image to a square based on the longest edge. Args: images (`np.ndarray`): ...
5
1
0
0
0
0
0
0.07
1
0
0
0
0
0
0
42
15
0
15
15
14
1
15
15
14
0
5
0
0
3,439
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/processing_llava_onevision.py
transformers.models.llava_onevision.processing_llava_onevision.LlavaOnevisionProcessor
from ...feature_extraction_utils import BatchFeature from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack from collections.abc import Iterable import numpy as np import math from typing import Optional, Union from ...video_utils import VideoInput from ...image_processing_utils import...
class LlavaOnevisionProcessor(ProcessorMixin): ''' Constructs a LLaVa-Onevision processor which wraps a LLaVa-Onevision video processor, LLaVa-NeXT image processor and a LLaMa tokenizer into a single processor. [`LlavaNextProcessor`] offers all the functionalities of [`LlavaOnevisionVideoProcessor`], [`Lla...
7
4
22
2
15
5
3
0.45
1
10
3
0
9
4
10
27
276
37
166
88
127
75
112
60
101
6
2
3
29
3,440
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/processing_llava_onevision.py
transformers.models.llava_onevision.processing_llava_onevision.LlavaOnevisionProcessorKwargs
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack class LlavaOnevisionProcessorKwargs(ProcessingKwargs, total=False): _defaults = {'text_kwargs': {'padding': False, 'return_mm_token_type_ids': False}, 'image_kwargs': {}, 'videos_kwargs': {}}
class LlavaOnevisionProcessorKwargs(ProcessingKwargs, total=False): pass
1
0
0
0
0
0
0
0.13
2
0
0
0
0
0
0
0
9
0
8
2
7
1
2
2
1
0
3
0
0
3,441
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/llava_onevision/video_processing_llava_onevision.py
transformers.models.llava_onevision.video_processing_llava_onevision.LlavaOnevisionVideoProcessor
from ...video_processing_utils import BaseVideoProcessor from ...processing_utils import Unpack, VideosKwargs from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, PILImageResampling class LlavaOnevisionVideoProcessor(BaseVideoProcessor): resample = PILImageResampling.BICUBIC image_mean = OPENAI_CLIP_M...
class LlavaOnevisionVideoProcessor(BaseVideoProcessor): def __init__(self, **kwargs: Unpack[LlavaOnevisionFastVideoProcessorInitKwargs]): pass
2
0
78
5
45
27
8
0.81
1
9
2
0
3
9
3
23
271
21
138
57
93
112
48
16
44
12
3
1
23
3,442
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/configuration_longformer.py
transformers.models.longformer.configuration_longformer.LongformerConfig
from typing import TYPE_CHECKING, Any, Optional, Union from ...configuration_utils import PretrainedConfig class LongformerConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`LongformerModel`] or a [`TFLongformerModel`]. It is used to instantiate a Longformer mod...
class LongformerConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`LongformerModel`] or a [`TFLongformerModel`]. It is used to instantiate a Longformer model according to the specified arguments, defining the model architecture. This is the configuration cla...
2
2
42
1
40
1
1
1.26
1
5
0
0
1
17
1
1
106
11
42
41
19
53
21
20
19
1
1
0
1
3,443
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/configuration_longformer.py
transformers.models.longformer.configuration_longformer.LongformerOnnxConfig
from ...onnx import OnnxConfig from collections import OrderedDict from typing import TYPE_CHECKING, Any, Optional, Union from collections.abc import Mapping class LongformerOnnxConfig(OnnxConfig): def __init__(self, config: 'PretrainedConfig', task: str='default', patching_specs: 'Optional[list[PatchingSpec]]'=N...
class LongformerOnnxConfig(OnnxConfig): def __init__(self, config: 'PretrainedConfig', task: str='default', patching_specs: 'Optional[list[PatchingSpec]]'=None): pass @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def outputs(self) -> Mapping[str, Map...
11
1
9
1
7
2
1
0.2
1
7
0
0
6
0
6
6
61
8
44
22
25
9
24
11
16
2
1
1
8
3,444
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/convert_longformer_original_pytorch_lightning_to_pytorch.py
transformers.models.longformer.convert_longformer_original_pytorch_lightning_to_pytorch.LightningModel
from torch import nn import pytorch_lightning as pl class LightningModel(pl.LightningModule): def __init__(self, model): super().__init__() self.model = model self.num_labels = 2 self.qa_outputs = nn.Linear(self.model.config.hidden_size, self.num_labels) def forward(self): ...
class LightningModel(pl.LightningModule): def __init__(self, model): pass def forward(self): pass
3
0
4
0
4
0
1
0.13
1
1
0
0
2
3
2
2
10
1
8
6
5
1
8
6
5
1
1
0
2
3,445
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerAttention
from torch import nn from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer class LongformerAttention(nn.Module): def __init__(self, config, layer_id=0): super().__init__() self.self = LongformerSelfAttention(config, layer_id) self.outp...
class LongformerAttention(nn.Module): def __init__(self, config, layer_id=0): pass def prune_heads(self, heads): pass def forward(self, hidden_states, attention_mask=None, layer_head_mask=None, is_index_masked=None, is_index_global_attn=None, is_global_attn=None, output_attentions=False)...
4
0
15
1
13
1
1
0.05
1
4
2
0
3
3
3
13
47
4
41
20
28
2
22
11
18
2
1
1
4
3,446
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerBaseModelOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro="\n Base class for Longformer's outputs, with potential hidden states, local and global attentions.\n ") class LongformerBaseModelOut...
@dataclass @auto_docstring(custom_intro="\n Base class for Longformer's outputs, with potential hidden states, local and global attentions.\n ") class LongformerBaseModelOutput(ModelOutput): ''' attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `c...
3
1
0
0
0
0
0
6
1
0
0
0
0
0
0
0
40
5
5
4
4
30
5
4
4
0
1
0
0
3,447
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerBaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro="\n Base class for Longformer's outputs that also contains a pooling of the last hidden states.\n ") class LongformerBaseModelOutputW...
@dataclass @auto_docstring(custom_intro="\n Base class for Longformer's outputs that also contains a pooling of the last hidden states.\n ") class LongformerBaseModelOutputWithPooling(ModelOutput): ''' pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): Last layer hidden-stat...
3
1
0
0
0
0
0
5.67
1
0
0
0
0
0
0
0
45
5
6
5
5
34
6
5
5
0
1
0
0
3,448
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerClassificationHead
from torch import nn import torch class LongformerClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dro...
class LongformerClassificationHead(nn.Module): '''Head for sentence-level classification tasks.''' def __init__(self, config): pass def forward(self, hidden_states, **kwargs): pass
3
1
7
0
7
1
1
0.14
1
1
0
0
2
3
2
12
17
2
14
7
11
2
14
7
11
1
1
0
2
3,449
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerEmbeddings
from torch import nn import torch class LongformerEmbeddings(nn.Module): """ Same as BertEmbeddings with a tiny tweak for positional embeddings indexing. """ def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, paddin...
class LongformerEmbeddings(nn.Module): ''' Same as BertEmbeddings with a tiny tweak for positional embeddings indexing. ''' def __init__(self, config): pass def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None): pass def create_position...
4
2
18
3
12
3
3
0.32
1
1
0
0
3
6
3
13
62
12
38
17
34
12
32
17
28
6
1
2
8
3,450
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerEncoder
from torch import nn class LongformerEncoder(nn.Module): def __init__(self, config): super().__init__() self.config = config self.layer = nn.ModuleList([LongformerLayer(config, layer_id=i) for i in range(config.num_hidden_layers)]) self.gradient_checkpointing = False def forwa...
class LongformerEncoder(nn.Module): def __init__(self, config): pass def forward(self, hidden_states, attention_mask=None, head_mask=None, padding_len=0, output_attentions=False, output_hidden_states=False, return_dict=True): pass
3
0
44
5
36
4
9
0.11
1
6
2
0
2
3
2
12
90
11
72
23
60
8
36
14
33
16
1
3
17
3,451
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerForMaskedLM
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import ModelOutput, auto_docstring, logging import torch from typing import Optional, Union @auto_docstring class LongformerForMaskedLM(LongformerPreTrainedModel): _tied_weights_keys = ['lm_head.decoder'] def __init__(self, config...
@auto_docstring class LongformerForMaskedLM(LongformerPreTrainedModel): def __init__(self, config): pass def get_output_embeddings(self): pass def set_output_embeddings(self, new_embeddings): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, at...
7
1
24
4
13
7
2
0.51
1
6
3
0
4
2
4
5
105
19
57
28
37
29
25
14
20
5
2
1
8
3,452
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerForMultipleChoice
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn import torch from ...utils import ModelOutput, auto_docstring, logging from typing import Optional, Union @auto_docstring class LongformerForMultipleChoice(LongformerPreTrainedModel): def __init__(self, config): super()...
@auto_docstring class LongformerForMultipleChoice(LongformerPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, global_attention_mask: O...
5
1
48
5
38
5
7
0.11
1
6
2
0
2
3
2
3
105
11
85
36
61
9
33
20
30
13
2
1
14
3,453
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerForQuestionAnswering
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn import torch from ...utils import ModelOutput, auto_docstring, logging from typing import Optional, Union @auto_docstring class LongformerForQuestionAnswering(LongformerPreTrainedModel): def __init__(self, config): supe...
@auto_docstring class LongformerForQuestionAnswering(LongformerPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, global_attention_mask: Optional[torch.Tensor]=None, head_mask: Opt...
5
1
62
9
36
18
5
0.47
1
5
2
0
2
3
2
3
128
19
74
31
55
35
36
16
33
9
2
2
10
3,454
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerForSequenceClassification
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...utils import ModelOutput, auto_docstring, logging import torch from typing import Optional, Union @auto_docstring(custom_intro='\n Longformer Model transformer with a sequence classification/regression head on top (a linear layer on top of th...
@auto_docstring(custom_intro='\n Longformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ') class LongformerForSequenceClassification(LongformerPreTrainedModel): def __init__(self, config): pass @a...
5
1
45
5
36
4
7
0.1
1
7
3
0
2
4
2
3
99
10
81
27
57
8
38
13
35
13
2
3
14
3,455
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerForTokenClassification
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from torch import nn import torch from ...utils import ModelOutput, auto_docstring, logging from typing import Optional, Union @auto_docstring class LongformerForTokenClassification(LongformerPreTrainedModel): def __init__(self, config): su...
@auto_docstring class LongformerForTokenClassification(LongformerPreTrainedModel): def __init__(self, config): pass @auto_docstring def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, global_attention_mask: Optional[torch.Tensor]=None, head_mask: O...
5
1
33
5
26
3
3
0.08
1
5
2
0
2
4
2
3
79
10
64
27
37
5
23
13
20
5
2
1
6
3,456
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerIntermediate
import torch from ...activations import ACT2FN, gelu from torch import nn class LongformerIntermediate(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.int...
class LongformerIntermediate(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
6
0
2
0
1
3
0
0
2
2
2
12
13
1
12
5
9
0
11
5
8
2
1
1
3
3,457
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerLMHead
from torch import nn from ...activations import ACT2FN, gelu import torch class LongformerLMHead(nn.Module): """Longformer Head for masked language modeling.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.layer_norm...
class LongformerLMHead(nn.Module): '''Longformer Head for masked language modeling.''' def __init__(self, config): pass def forward(self, features, **kwargs): pass def _tie_weights(self): pass
4
1
8
1
6
1
1
0.21
1
1
0
0
3
4
3
13
29
6
19
9
15
4
18
9
14
2
1
1
4
3,458
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerLayer
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer from ...modeling_layers import GradientCheckpointingLayer class LongformerLayer(GradientCheckpointingLayer): def __init__(self, config, layer_id=0): super().__init__() self.attention = Long...
class LongformerLayer(GradientCheckpointingLayer): def __init__(self, config, layer_id=0): pass def forward(self, hidden_states, attention_mask=None, layer_head_mask=None, is_index_masked=None, is_index_global_attn=None, is_global_attn=None, output_attentions=False): pass def ff_chunk(se...
4
0
13
0
12
0
1
0
1
4
3
0
3
5
3
13
41
3
38
24
25
0
19
15
15
1
1
0
3
3,459
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerMaskedLMOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Base class for masked language models outputs.\n ') class LongformerMaskedLMOutput(ModelOutput): """ loss (`torch.FloatTe...
@dataclass @auto_docstring(custom_intro='\n Base class for masked language models outputs.\n ') class LongformerMaskedLMOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Masked language modeling (MLM) loss. logits (`torch.Float...
3
1
0
0
0
0
0
5.33
1
0
0
0
0
0
0
0
43
5
6
6
5
32
6
6
5
0
1
0
0
3,460
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerModel
from torch import nn from ...utils import ModelOutput, auto_docstring, logging import torch from typing import Optional, Union @auto_docstring class LongformerModel(LongformerPreTrainedModel): """ This class copied code from [`RobertaModel`] and overwrote standard self-attention with longformer self-attention ...
@auto_docstring class LongformerModel(LongformerPreTrainedModel): ''' This class copied code from [`RobertaModel`] and overwrote standard self-attention with longformer self-attention to provide the ability to process long sequences following the self-attention approach described in [Longformer: the Lon...
10
5
30
4
20
7
4
0.46
1
9
4
0
7
4
7
8
235
34
140
48
110
64
70
27
62
13
2
2
29
3,461
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerMultipleChoiceModelOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Base class for outputs of multiple choice Longformer models.\n ') class LongformerMultipleChoiceModelOutput(ModelOutput): """...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of multiple choice Longformer models.\n ') class LongformerMultipleChoiceModelOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided): Classification loss. logits (`to...
3
1
0
0
0
0
0
5.5
1
0
0
0
0
0
0
0
45
6
6
6
5
33
6
6
5
0
1
0
0
3,462
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerOutput
from torch import nn import torch class LongformerOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dr...
class LongformerOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
3,463
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerPooler
from torch import nn import torch class LongformerPooler(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: first_...
class LongformerPooler(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: pass
3
0
6
0
5
1
1
0.2
1
2
0
0
2
2
2
12
13
1
10
7
7
2
10
7
7
1
1
0
2
3,464
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerPreTrainedModel
from torch import nn from .configuration_longformer import LongformerConfig from ...utils import ModelOutput, auto_docstring, logging from ...modeling_utils import PreTrainedModel @auto_docstring class LongformerPreTrainedModel(PreTrainedModel): config: LongformerConfig base_model_prefix = 'longformer' sup...
@auto_docstring class LongformerPreTrainedModel(PreTrainedModel): def _init_weights(self, module): '''Initialize the weights''' pass
3
1
15
0
12
3
6
0.41
1
0
0
6
1
0
1
1
26
2
17
6
15
7
15
6
13
6
1
2
6
3,465
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerQuestionAnsweringModelOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Base class for outputs of question answering Longformer models.\n ') class LongformerQuestionAnsweringModelOutput(ModelOutput): ...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of question answering Longformer models.\n ') class LongformerQuestionAnsweringModelOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Total span extraction loss is ...
3
1
0
0
0
0
0
4.86
1
0
0
0
0
0
0
0
46
5
7
7
6
34
7
7
6
0
1
0
0
3,466
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerSelfAttention
from torch import nn import math import torch class LongformerSelfAttention(nn.Module): def __init__(self, config, layer_id): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError(f'The hidden size ({config.hidden_size}) is not a multiple of the n...
null
18
7
51
8
33
11
2
0.33
1
8
0
0
7
13
12
22
633
101
407
131
354
135
191
88
178
7
1
1
22
3,467
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerSelfOutput
from torch import nn import torch class LongformerSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Drop...
class LongformerSelfOutput(nn.Module): def __init__(self, config): pass def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: pass
3
0
5
0
5
0
1
0
1
2
0
0
2
3
2
12
12
1
11
6
8
0
11
6
8
1
1
0
2
3,468
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerSequenceClassifierOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Base class for outputs of sentence classification models.\n ') class LongformerSequenceClassifierOutput(ModelOutput): """ ...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of sentence classification models.\n ') class LongformerSequenceClassifierOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification (or regression if config....
3
1
0
0
0
0
0
5.33
1
0
0
0
0
0
0
0
43
5
6
6
5
32
6
6
5
0
1
0
0
3,469
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/modeling_longformer.py
transformers.models.longformer.modeling_longformer.LongformerTokenClassifierOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Base class for outputs of token classification models.\n ') class LongformerTokenClassifierOutput(ModelOutput): """ loss ...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of token classification models.\n ') class LongformerTokenClassifierOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification loss. logits (`torch.FloatT...
3
1
0
0
0
0
0
5.33
1
0
0
0
0
0
0
0
43
5
6
6
5
32
6
6
5
0
1
0
0
3,470
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/tokenization_longformer.py
transformers.models.longformer.tokenization_longformer.LongformerTokenizer
from ...tokenization_utils import AddedToken, PreTrainedTokenizer import os from typing import Optional import json import regex as re class LongformerTokenizer(PreTrainedTokenizer): """ Constructs a Longformer tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding. This tokenize...
class LongformerTokenizer(PreTrainedTokenizer): ''' Constructs a Longformer tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will be encoded differently whether...
15
8
18
2
13
4
3
0.61
1
11
0
0
13
9
13
102
325
52
171
71
136
105
122
46
108
9
3
3
39
3,471
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longformer/tokenization_longformer_fast.py
transformers.models.longformer.tokenization_longformer_fast.LongformerTokenizerFast
from typing import Optional from tokenizers import processors import json from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...tokenization_utils_base import AddedToken, BatchEncoding from .tokenization_longformer import LongformerTokenizer class LongformerTokenizerFast(PreTrainedTokenizerFast): ...
class LongformerTokenizerFast(PreTrainedTokenizerFast): ''' Construct a "fast" Longformer tokenizer (backed by HuggingFace's *tokenizers* library), derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like...
11
4
17
2
12
3
3
0.83
1
5
1
0
8
1
8
96
229
42
102
45
73
85
57
25
48
8
3
2
20
3,472
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/configuration_longt5.py
transformers.models.longt5.configuration_longt5.LongT5Config
from ...configuration_utils import PretrainedConfig class LongT5Config(PretrainedConfig): """ This is the configuration class to store the configuration of a [`LongT5Model`]. It is used to instantiate a LongT5 model according to the specified arguments, defining the model architecture. Instantiating a ...
class LongT5Config(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`LongT5Model`]. It is used to instantiate a LongT5 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar...
2
1
64
4
58
2
4
0.76
1
2
0
0
1
19
1
1
126
8
67
48
42
51
30
25
28
4
1
1
4
3,473
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/configuration_longt5.py
transformers.models.longt5.configuration_longt5.LongT5OnnxConfig
from ...onnx import OnnxSeq2SeqConfigWithPast from collections.abc import Mapping class LongT5OnnxConfig(OnnxSeq2SeqConfigWithPast): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: common_inputs = {'input_ids': {0: 'batch', 1: 'encoder_sequence'}, 'attention_mask': {0: 'batch', 1: 'enco...
class LongT5OnnxConfig(OnnxSeq2SeqConfigWithPast): @property def inputs(self) -> Mapping[str, Mapping[int, str]]: pass @property def default_onnx_opset(self) -> int: pass
5
0
10
1
9
0
2
0
1
2
0
0
2
0
2
2
23
3
20
6
15
0
14
4
11
3
1
1
4
3,474
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5Attention
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from typing import Any, Optional, Union from .configuration_longt5 import LongT5Config from ...utils.deprecation import deprecate_kwarg from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer import math from torch import nn i...
class LongT5Attention(nn.Module): def __init__(self, config: LongT5Config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): pass def prune_heads(self, heads): pass @staticmethod def _relative_position_bucket(relative_position, bidirectional=True, num_buckets=32, max_...
8
3
44
5
32
8
5
0.26
1
5
1
0
4
17
5
15
226
28
160
67
136
42
113
49
107
16
1
3
26
3,475
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5Block
from typing import Any, Optional, Union from ...modeling_layers import GradientCheckpointingLayer from ...utils.deprecation import deprecate_kwarg from torch import nn import torch class LongT5Block(GradientCheckpointingLayer): def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]...
class LongT5Block(GradientCheckpointingLayer): def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, attention_mask=None, position_bias=None,...
4
0
48
5
41
4
6
0.09
1
8
5
0
2
2
2
12
98
11
82
27
64
7
38
12
35
6
1
2
11
3,476
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5DenseActDense
from torch import nn from .configuration_longt5 import LongT5Config from ...activations import ACT2FN import torch class LongT5DenseActDense(nn.Module): def __init__(self, config: LongT5Config): super().__init__() self.wi = nn.Linear(config.d_model, config.d_ff, bias=False) self.wo = nn.Li...
class LongT5DenseActDense(nn.Module): def __init__(self, config: LongT5Config): pass def forward(self, hidden_states): pass
3
0
9
0
9
0
2
0
1
3
1
0
2
4
2
12
20
1
19
7
16
0
15
7
12
2
1
1
3
3,477
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5DenseGatedActDense
from torch import nn from .configuration_longt5 import LongT5Config from ...activations import ACT2FN class LongT5DenseGatedActDense(nn.Module): def __init__(self, config: LongT5Config): super().__init__() self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False) self.wi_1 = nn.Linear...
class LongT5DenseGatedActDense(nn.Module): def __init__(self, config: LongT5Config): pass def forward(self, hidden_states): pass
3
0
7
0
7
0
1
0
1
2
1
0
2
5
2
12
16
1
15
10
12
0
15
10
12
1
1
0
2
3,478
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5EncoderModel
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput from typing import Any, Optional, Union from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging from ....
@auto_docstring class LongT5EncoderModel(LongT5PreTrainedModel): def __init__(self, config: LongT5Config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings): pass def _tie_weights(self): pass def get_encoder(self): p...
10
2
10
1
6
3
1
0.38
1
5
3
0
7
2
7
10
79
14
47
25
28
18
28
15
20
2
2
1
10
3,479
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5ForConditionalGeneration
import warnings from torch.nn import CrossEntropyLoss from torch import nn from ...generation import GenerationMixin import copy import torch from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, S...
@auto_docstring(custom_intro='\n LONGT5 Model with a `language modeling` head on top.\n ') class LongT5ForConditionalGeneration(LongT5PreTrainedModel, GenerationMixin): def __init__(self, config: LongT5Config): pass def get_input_embeddings(self): pass def set_input_embeddings(self,...
10
1
18
2
12
3
3
0.24
2
8
4
0
11
5
11
14
212
37
141
52
108
34
79
32
67
14
2
2
28
3,480
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5LayerCrossAttention
from torch import nn from ...utils.deprecation import deprecate_kwarg from typing import Any, Optional, Union class LongT5LayerCrossAttention(nn.Module): def __init__(self, config, layer_idx: Optional[int]=None): super().__init__() self.EncDecAttention = LongT5Attention(config, has_relative_attent...
class LongT5LayerCrossAttention(nn.Module): def __init__(self, config, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, key_value_states, attention_mask=None, position_bias=None, layer_head_mask=Non...
4
0
17
0
17
1
1
0.03
1
4
2
0
2
3
2
12
36
1
35
22
20
1
12
10
9
1
1
0
2
3,481
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5LayerFF
from torch import nn from .configuration_longt5 import LongT5Config class LongT5LayerFF(nn.Module): def __init__(self, config: LongT5Config): super().__init__() if config.is_gated_act: self.DenseReluDense = LongT5DenseGatedActDense(config) else: self.DenseReluDense ...
class LongT5LayerFF(nn.Module): def __init__(self, config: LongT5Config): pass def forward(self, hidden_states): pass
3
0
7
1
7
0
2
0
1
5
4
0
2
3
2
12
16
2
14
7
11
0
13
7
10
2
1
1
3
3,482
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5LayerLocalSelfAttention
from torch import nn from typing import Any, Optional, Union class LongT5LayerLocalSelfAttention(nn.Module): """Local self attention used in encoder""" def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): super().__init__() self.LocalSelfAttention = Lon...
class LongT5LayerLocalSelfAttention(nn.Module): '''Local self attention used in encoder''' def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): pass def forward(self, hidden_states, attention_mask=None, position_bias=None, layer_head_mask=None, output_atte...
3
1
13
0
13
1
1
0.12
1
5
2
0
2
3
2
12
29
2
26
17
15
3
12
9
9
1
1
0
2
3,483
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5LayerNorm
from torch import nn import torch class LongT5LayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): """ Construct a layernorm module in the LongT5 style. No bias and no subtraction of mean. """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size...
class LongT5LayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): ''' Construct a layernorm module in the LongT5 style. No bias and no subtraction of mean. ''' pass def forward(self, hidden_states): pass
3
1
11
2
5
4
2
0.73
1
1
0
0
2
2
2
12
23
4
11
6
8
8
11
6
8
2
1
1
3
3,484
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5LayerSelfAttention
from torch import nn from typing import Any, Optional, Union from ...utils.deprecation import deprecate_kwarg class LongT5LayerSelfAttention(nn.Module): def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): super().__init__() self.SelfAttention = LongT5Atten...
class LongT5LayerSelfAttention(nn.Module): def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): pass @deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58') def forward(self, hidden_states, attention_mask=None, position_bias=None, lay...
4
0
16
0
16
1
1
0.03
1
4
2
0
2
3
2
12
34
1
33
19
20
1
12
9
9
1
1
0
2
3,485
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5LayerTransientGlobalSelfAttention
from torch import nn from typing import Any, Optional, Union class LongT5LayerTransientGlobalSelfAttention(nn.Module): """Transient-Global self attention used in encoder""" def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): super().__init__() self.Tra...
class LongT5LayerTransientGlobalSelfAttention(nn.Module): '''Transient-Global self attention used in encoder''' def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None): pass def forward(self, hidden_states, attention_mask=None, position_bias=None, layer_head_m...
3
1
14
0
14
1
1
0.11
1
5
2
0
2
3
2
12
31
2
28
17
17
3
12
9
9
1
1
0
2
3,486
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5LocalAttention
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer import math from torch import nn import torch from .configuration_longt5 import LongT5Config class LongT5LocalAttention(nn.Module): def __init__(self, config: LongT5Config, has_relative_attention_bias: bool=False) -> None: s...
class LongT5LocalAttention(nn.Module): def __init__(self, config: LongT5Config, has_relative_attention_bias: bool=False) -> None: pass def prune_heads(self, heads): pass @staticmethod def _relative_position_bucket(relative_position, bidirectional=True, num_buckets=32, max_distance=128...
9
4
27
3
18
6
2
0.35
1
5
1
0
4
18
5
15
190
25
124
54
108
43
93
46
85
7
1
3
17
3,487
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5Model
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput from typing import Any, Optional, Union from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_av...
@auto_docstring class LongT5Model(LongT5PreTrainedModel): def __init__(self, config: LongT5Config): pass def get_input_embeddings(self): pass def set_input_embeddings(self, new_embeddings): pass def _tie_weights(self): pass def get_encoder(self): pass ...
10
2
17
2
13
3
2
0.22
1
8
4
0
8
3
8
11
154
23
107
38
78
24
49
19
40
10
2
2
19
3,488
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5PreTrainedModel
from ...modeling_utils import PreTrainedModel from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging from .configuration_longt5 import LongT5Config import torch @auto_docstring class LongT5PreTrainedModel(PreTrainedModel): c...
@auto_docstring class LongT5PreTrainedModel(PreTrainedModel): @property def dummy_inputs(self): pass def _init_weights(self, module): '''Initialize the weights''' pass def _shift_right(self, input_ids): pass
6
1
27
1
22
4
6
0.25
1
10
9
4
3
0
3
3
100
8
75
21
70
19
60
20
56
14
1
3
19
3,489
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5Stack
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput from typing import Any, Optional, Union from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_av...
class LongT5Stack(LongT5PreTrainedModel): def __init__(self, config, embed_tokens=None): pass def set_input_embeddings(self, new_embeddings): pass def forward(self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, inputs_embeds=None, head_mask...
7
1
60
6
46
8
10
0.19
1
16
8
0
5
8
6
9
368
40
279
81
240
52
141
49
134
42
2
3
59
3,490
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/longt5/modeling_longt5.py
transformers.models.longt5.modeling_longt5.LongT5TransientGlobalAttention
from .configuration_longt5 import LongT5Config from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer import math from torch import nn import torch class LongT5TransientGlobalAttention(nn.Module): def __init__(self, config: LongT5Config, has_relative_attention_bias: bool=False) -> None:...
class LongT5TransientGlobalAttention(nn.Module): def __init__(self, config: LongT5Config, has_relative_attention_bias: bool=False) -> None: pass def prune_heads(self, heads): pass @staticmethod def _relative_position_bucket(relative_position, bidirectional=True, num_buckets=32, max_di...
10
4
32
4
21
8
3
0.37
1
7
2
0
5
20
6
16
261
33
167
70
150
62
127
62
118
10
1
3
22
3,491
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/configuration_luke.py
transformers.models.luke.configuration_luke.LukeConfig
from ...configuration_utils import PretrainedConfig class LukeConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`LukeModel`]. It is used to instantiate a LUKE model according to the specified arguments, defining the model architecture. Instantiating a configurat...
class LukeConfig(PretrainedConfig): ''' This is the configuration class to store the configuration of a [`LukeModel`]. It is used to instantiate a LUKE model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar confi...
2
2
42
1
40
1
1
1.5
1
1
0
0
1
16
1
1
116
11
42
41
18
63
20
19
18
1
1
0
1
3,492
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.BaseLukeModelOutput
from typing import Optional, Union from dataclasses import dataclass from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling import torch from ...utils import ModelOutput, auto_docstring, logging @dataclass @auto_docstring(custom_intro="\n Base class for model's outputs, with potential hidden st...
@dataclass @auto_docstring(custom_intro="\n Base class for model's outputs, with potential hidden states and attentions.\n ") class BaseLukeModelOutput(BaseModelOutput): ''' entity_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, entity_length, hidden_size)`): Sequence of entity hidde...
3
1
0
0
0
0
0
7
1
0
0
0
0
0
0
0
28
4
3
3
2
21
3
3
2
0
2
0
0
3,493
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.BaseLukeModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, logging from typing import Optional, Union from dataclasses import dataclass from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling import torch @dataclass @auto_docstring(custom_intro='\n Base class for outputs of the LUKE model.\n ') class ...
@dataclass @auto_docstring(custom_intro='\n Base class for outputs of the LUKE model.\n ') class BaseLukeModelOutputWithPooling(BaseModelOutputWithPooling): ''' pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): Last layer hidden-state of the first token of the sequence (cla...
3
1
0
0
0
0
0
7.67
1
0
0
0
0
0
0
0
28
2
3
3
2
23
3
3
2
0
2
0
0
3,494
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.EntityClassificationOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Outputs of entity classification models.\n ') class EntityClassificationOutput(ModelOutput): """ loss (`torch.FloatTensor...
@dataclass @auto_docstring(custom_intro='\n Outputs of entity classification models.\n ') class EntityClassificationOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification loss. logits (`torch.FloatTensor` of shape `(b...
3
1
0
0
0
0
0
3.33
1
0
0
0
0
0
0
0
28
2
6
6
5
20
6
6
5
0
1
0
0
3,495
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.EntityPairClassificationOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Outputs of entity pair classification models.\n ') class EntityPairClassificationOutput(ModelOutput): """ loss (`torch.Fl...
@dataclass @auto_docstring(custom_intro='\n Outputs of entity pair classification models.\n ') class EntityPairClassificationOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification loss. logits (`torch.FloatTensor` of ...
3
1
0
0
0
0
0
3.33
1
0
0
0
0
0
0
0
28
2
6
6
5
20
6
6
5
0
1
0
0
3,496
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.EntityPredictionHead
import torch from torch import nn class EntityPredictionHead(nn.Module): def __init__(self, config): super().__init__() self.config = config self.transform = EntityPredictionHeadTransform(config) self.decoder = nn.Linear(config.entity_emb_size, config.entity_vocab_size, bias=False)...
class EntityPredictionHead(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
6
1
5
0
1
0
1
2
1
0
2
4
2
12
13
2
11
7
8
0
11
7
8
1
1
0
2
3,497
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.EntityPredictionHeadTransform
from ...activations import ACT2FN, gelu from torch import nn class EntityPredictionHeadTransform(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.entity_emb_size) if isinstance(config.hidden_act, str): self.transform_a...
class EntityPredictionHeadTransform(nn.Module): def __init__(self, config): pass def forward(self, hidden_states): pass
3
0
7
0
7
0
2
0
1
2
0
0
2
3
2
12
15
1
14
6
11
0
13
6
10
2
1
1
3
3,498
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.EntitySpanClassificationOutput
from ...utils import ModelOutput, auto_docstring, logging from dataclasses import dataclass import torch from typing import Optional, Union @dataclass @auto_docstring(custom_intro='\n Outputs of entity span classification models.\n ') class EntitySpanClassificationOutput(ModelOutput): """ loss (`torch.Fl...
@dataclass @auto_docstring(custom_intro='\n Outputs of entity span classification models.\n ') class EntitySpanClassificationOutput(ModelOutput): ''' loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification loss. logits (`torch.FloatTensor` of ...
3
1
0
0
0
0
0
3.33
1
0
0
0
0
0
0
0
28
2
6
6
5
20
6
6
5
0
1
0
0
3,499
huggingface/pytorch-pretrained-BERT
huggingface_pytorch-pretrained-BERT/src/transformers/models/luke/modeling_luke.py
transformers.models.luke.modeling_luke.LukeAttention
import torch from torch import nn class LukeAttention(nn.Module): def __init__(self, config): super().__init__() self.self = LukeSelfAttention(config) self.output = LukeSelfOutput(config) self.pruned_heads = set() def prune_heads(self, heads): raise NotImplementedError...
class LukeAttention(nn.Module): def __init__(self, config): pass def prune_heads(self, heads): pass def forward(self, word_hidden_states, entity_hidden_states, attention_mask=None, head_mask=None, output_attentions=False): pass
4
0
14
1
12
0
2
0.03
1
5
2
0
3
3
3
13
45
6
38
22
27
1
23
15
19
3
1
1
5