Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/AnswerDotAI/ModernBERT
/ types & classes
Types & classes
136 in github.com/AnswerDotAI/ModernBERT
⨍
Functions
560
◇
Types & classes
136
↳
Endpoints
2
↓ 8 callers
Class
DataSplitConstants
src/convert_dataset.py:66
↓ 4 callers
Class
GreedyBestFitSequencePacker
src/sequence_packer.py:378
↓ 4 callers
Class
StableAdamW
StableAdamW optimizer. An AdamW-Adafactor hybrid with learning rate update clipping. This version is modified to only run foreach which has the o
src/optimizer.py:30
↓ 4 callers
Class
WarmupStableDecayScheduler
r""" Args: t_warmup (str | Time): Warmup time. t_max (str | Time): The duration of this scheduler. Default = ``"1dur"``. a
src/scheduler.py:87
↓ 3 callers
Class
BertModel
Overall BERT model. Args: config: a BertConfig class instance with the configuration to build a new model Inputs: `input_ids
src/bert_layers/model.py:130
↓ 3 callers
Class
FlexBertModel
Overall BERT model. Args: config: a BertConfig class instance with the configuration to build a new model Inputs: `input_ids
src/bert_layers/model.py:880
↓ 3 callers
Class
MaskedLMOutput
Base class for masked language models outputs. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` i
src/bert_layers/model.py:786
↓ 3 callers
Class
TileMode
src/bert_layers/initialization.py:166
↓ 3 callers
Class
UnpaddedRotaryEmbedding
The rotary position embeddings applied directly to unpadded sequences.
src/bert_layers/rotary.py:158
↓ 2 callers
Class
DatasetConstants
src/convert_dataset.py:74
↓ 2 callers
Class
FlexBertPoolingHead
src/bert_layers/model.py:748
↓ 2 callers
Class
MaskedLMOutputZLoss
Base class for masked language models outputs. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` i
src/bert_layers/model.py:821
↓ 2 callers
Class
Schedule
src/scheduler.py:43
↓ 2 callers
Class
SynthTextDirectory
tests/test_utils.py:14
↓ 1 callers
Class
AblationDirContext
tests/test_eval.py:20
↓ 1 callers
Class
BatchSizeWarmupScheduler
src/sequence_packer.py:20
↓ 1 callers
Class
BertAlibiEmbeddings
Construct the embeddings for words, ignoring position. There are no positional embeddings since we use ALiBi and token_type embeddings.
src/bert_layers/embeddings.py:24
↓ 1 callers
Class
BertAlibiEncoder
A stack of BERT layers providing the backbone of Mosaic BERT. This module is modeled after the Hugging Face BERT's :class:`~transformers.model.be
src/bert_layers/layers.py:73
↓ 1 callers
Class
BertAlibiLayer
Composes the Mosaic BERT attention and FFN blocks into a single layer.
src/bert_layers/layers.py:33
↓ 1 callers
Class
BertAlibiUnpadAttention
Chains attention, Dropout, and LayerNorm for Mosaic BERT.
src/bert_layers/attention.py:204
↓ 1 callers
Class
BertAlibiUnpadSelfAttention
Performs multi-headed self attention on a batch of unpadded sequences. If Flash Attention 2 is installed, this module uses Flash Attention to gre
src/bert_layers/attention.py:60
↓ 1 callers
Class
BertLMPredictionHead
src/bert_layers/model.py:250
↓ 1 callers
Class
BertOnlyMLMHead
src/bert_layers/model.py:265
↓ 1 callers
Class
BertPooler
src/bert_layers/layers.py:226
↓ 1 callers
Class
BertPredictionHeadTransform
src/bert_layers/layers.py:241
↓ 1 callers
Class
BertResidualGLU
Applies the FFN at the end of each Mosaic BERT layer. Compared to the default BERT architecture, this block replaces :class:`~transformers.model.
src/bert_layers/mlp.py:25
↓ 1 callers
Class
BertSelfOutput
Computes the output of the attention layer. This module is modeled after the Hugging Face BERT's :class:`~transformers.model.bert.modeling_be
src/bert_layers/attention.py:180
↓ 1 callers
Class
BufferedIterable
src/sequence_packer.py:479
↓ 1 callers
Class
BufferedIterator
src/sequence_packer.py:492
↓ 1 callers
Class
ClassInstantier
src/bert_layers/activation.py:13
↓ 1 callers
Class
ConcatTokensDataset
An IterableDataset that returns token samples for MDSWriter. Returns dicts of {'tokens': bytes} To use data created by this class and writte
src/convert_dataset.py:158
↓ 1 callers
Class
ConcatenatedSequenceCollatorWrapper
Collator wrapper to add sequence_id to batch.
src/text_data.py:255
↓ 1 callers
Class
CosineInverseSqrtScheduler
r"""Decays the learning rate according to a cosine decay followed by an inverse square root decay, with optional warmup and cooldown. Specificall
src/scheduler.py:140
↓ 1 callers
Class
DataloaderSpeedMonitor
Measure how long it takes to return a batch from the dataloader.
src/callbacks/dataloader_speed.py:11
↓ 1 callers
Class
DistributedSamplerPCG64DXSM
src/text_data.py:46
↓ 1 callers
Class
EfficientCrossEntropy
Torchmetric that grabs the precomputed ce_loss value from the model outputs
src/flex_bert.py:83
↓ 1 callers
Class
EfficientHuggingFaceModel
src/flex_bert.py:144
↓ 1 callers
Class
EfficientZLoss
Torchmetric that grabs the precomputed z_loss value from the model outputs
src/flex_bert.py:114
↓ 1 callers
Class
FALanguageCrossEntropy
Torchmetric that computes cross entropy on language modeling outputs using flash_attn's Cross Entropy. Adds metric state variables: sum_l
src/flex_bert.py:54
↓ 1 callers
Class
FlexBertCompiledSansPositionEmbeddings
Construct the embeddings from token embeddings without any positional embeddings.
src/bert_layers/embeddings.py:161
↓ 1 callers
Class
FlexBertConfig
src/bert_layers/configuration_bert.py:42
↓ 1 callers
Class
FlexBertForMaskedLM
src/bert_layers/model.py:1001
↓ 1 callers
Class
FlexBertForSequenceClassification
Bert Model transformer with a sequence classification/regression head. This head is just a linear layer on top of the pooled output. Used for,
src/bert_layers/model.py:1249
↓ 1 callers
Class
FlexBertPredictionHead
src/bert_layers/model.py:726
↓ 1 callers
Class
FlexBertRopeSchedule
src/algorithms/rope_schedule.py:32
↓ 1 callers
Class
GlueDirContext
tests/test_glue.py:20
↓ 1 callers
Class
LogGradNorm
Logs the precomputed L1 and L2 gradient norms from StableAdamW
src/callbacks/log_grad_norm.py:24
↓ 1 callers
Class
NoConcatDataset
An IterableDataset that returns text samples for MDSWriter. Returns dicts of {'text': bytes}
src/convert_dataset.py:143
↓ 1 callers
Class
NoStreamingDataset
A dataset class that can read data with raw mds-format (mosaic streaming-format without compression) from local. In comparison with `Streamin
src/text_data.py:447
↓ 1 callers
Class
OneMinusSqrtScheduler
Decays the learning rate according to a 1 - sqrt function, without an initial warmup phase. The learning rate decays from 1 to alpha_f accord
src/scheduler.py:264
↓ 1 callers
Class
PackingEfficency
Records the packing efficiency for each batch.
src/callbacks/packing_efficiency.py:10
↓ 1 callers
Class
ScheduledGarbageCollector
Disable automatic garbage collection and collect garbage at interval. Args: batch_interval (int): Number of batches between calls to gc.c
src/callbacks/scheduled_gc.py:22
↓ 1 callers
Class
StreamingTextDataset
Generic text dataset using MosaicML's StreamingDataset. Args: tokenizer (Tokenizer): HuggingFace tokenizer to tokenize sample
src/text_data.py:99
↓ 1 callers
Class
SuperGlueDirContext
tests/test_superglue.py:20
↓ 1 callers
Class
TileLinear
src/bert_layers/initialization.py:381
Class
ApplyRotaryEmbUnpad
src/bert_layers/rotary.py:14
Class
BertConfig
src/bert_layers/configuration_bert.py:9
Class
BertForMaskedLM
src/bert_layers/model.py:300
Class
BertForMultipleChoice
Bert Model with a multiple choice classification head on top (a linear layer on top of the pooled output and a softmax) e.g. for RocStories/S
src/bert_layers/model.py:583
Class
BertForNextSentencePrediction
src/bert_layers/model.py:453
Class
BertForPreTraining
src/bert_layers/model.py:290
Class
BertForQuestionAnswering
Bert Model with a span classification head. This is used for extractive question-answering tasks like SQuAD (a linear layers on top of the hi
src/bert_layers/model.py:710
Class
BertForSequenceClassification
Bert Model transformer with a sequence classification/regression head. This head is just a linear layer on top of the pooled output. Used for,
src/bert_layers/model.py:458
Class
BertForTokenClassification
src/bert_layers/model.py:705
Class
BertLMHeadModel
src/bert_layers/model.py:295
Class
BertOnlyNSPHead
src/bert_layers/model.py:275
Class
BoolQJob
BoolQ.
src/evals/superglue_jobs.py:29
Class
CBJob
CB.
src/evals/superglue_jobs.py:119
Class
CBMetric
src/evals/superglue_jobs.py:104
Class
COLAJob
COLA.
src/evals/glue_jobs.py:255
Class
COPAJob
COPA.
src/evals/superglue_jobs.py:195
Class
ClassificationJob
src/evals/finetuning_jobs.py:224
Class
ConcatMode
src/convert_dataset.py:22
Class
EurlexJob
Eurlex multi-label classification.
src/evals/misc_jobs.py:149
Class
EurlexMultilabelF1Score
src/evals/misc_jobs.py:144
Class
FineTuneJob
Encapsulates a fine-tuning job. Tasks should subclass FineTuneJob and implement the get_trainer() method. Args: name (str, optio
src/evals/finetuning_jobs.py:99
Class
FlexBertAbsoluteEmbeddings
Construct the embeddings with absolute positional embeddings.
src/bert_layers/embeddings.py:123
Class
FlexBertAttentionBase
A FlexBERT attention base class for type hints.
src/bert_layers/attention.py:247
Class
FlexBertCompileUnpadPreNormLayer
Composes the FlexBERT attention and MLP blocks into a single layer using pre-normalization.
src/bert_layers/layers.py:282
Class
FlexBertEmbeddingsBase
A FlexBERT embeddings base class for type hints.
src/bert_layers/embeddings.py:106
Class
FlexBertEncoderBase
A FlexBERT base class for type hints.
src/bert_layers/layers.py:596
Class
FlexBertForMultipleChoice
Bert Model with a multiple choice classification head on top (a linear layer on top of the pooled output and a softmax) e.g. for RocStories/S
src/bert_layers/model.py:1380
Class
FlexBertGLU
Applies the GLU at the end of each FlexBERT layer. Compared to the default BERT architecture, this block replaces :class:`~transformers.model.ber
src/bert_layers/mlp.py:131
Class
FlexBertLayerBase
A FlexBERT Layer base class for type hints.
src/bert_layers/layers.py:258
Class
FlexBertMLP
Applies the MLP at the end of each FlexBERT layer. Compared to the default BERT architecture, this block replaces :class:`~transformers.model.ber
src/bert_layers/mlp.py:91
Class
FlexBertMLPBase
A FlexBERT MLP base class for type hints.
src/bert_layers/mlp.py:73
Class
FlexBertPaddedAttention
Performs multi-headed self attention on a batch of padded sequences. This module supports two attention implementations: 1. Flash Attention 2
src/bert_layers/attention.py:585
Class
FlexBertPaddedEncoder
A stack of BERT layers providing the backbone of FlexBERT. This module is modeled after the Hugging Face BERT's :class:`~transformers.model.bert.
src/bert_layers/layers.py:665
Class
FlexBertPaddedParallelAttention
Performs multi-headed self attention on a batch of padded sequences. This module supports two attention implementations: 1. Flash Attention 2
src/bert_layers/attention.py:1413
Class
FlexBertPaddedParallelPreNormLayer
Composes the FlexBERT attention and MLP blocks into a single layer using pre-normalization.
src/bert_layers/layers.py:449
Class
FlexBertPaddedPostNormLayer
Composes the FlexBERT attention and MLP blocks into a single layer using post-normalization.
src/bert_layers/layers.py:531
Class
FlexBertPaddedPreNormLayer
Composes the FlexBERT attention and MLP blocks into a single layer using pre-normalization.
src/bert_layers/layers.py:415
Class
FlexBertPaddedRopeAttention
Performs multi-headed self attention on a batch of padded sequences. This module supports two attention implementations: 1. Flash Attention 2
src/bert_layers/attention.py:934
Class
FlexBertPaddedRopeParallelAttention
Performs multi-headed self attention on a batch of padded sequences. This module supports two attention implementations: 1. Flash Attention 2
src/bert_layers/attention.py:1265
Class
FlexBertParallelGLU
Applies the GLU at the end of each FlexBERT layer using intermediate_ff computed in parallel of the attention. Compared to the default BERT archi
src/bert_layers/mlp.py:166
Class
FlexBertPreTrainedModel
An abstract class to handle custom weights initialization of modules
src/bert_layers/model.py:863
Class
FlexBertSansPositionEmbeddings
Construct the embeddings from token embeddings without any positional embeddings.
src/bert_layers/embeddings.py:183
Class
FlexBertUnpadAttention
Performs multi-headed self attention on a batch of unpadded sequences. If Flash Attention 2 is installed, this module uses Flash Attention to imp
src/bert_layers/attention.py:276
Class
FlexBertUnpadEncoder
A stack of BERT layers providing the backbone of FlexBERT. This module is modeled after the Hugging Face BERT's :class:`~transformers.model.bert.
src/bert_layers/layers.py:613
Class
FlexBertUnpadParallelAttention
Computes the output of the multi-headed self parallel attention on a batch of unpadded sequences If Flash Attention 2 is installed, this module u
src/bert_layers/attention.py:435
next →
1–100 of 136, ranked by callers