Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/JonasGeiping/cramming
/ types & classes
Types & classes
86 in github.com/JonasGeiping/cramming
⨍
Functions
411
◇
Types & classes
86
↓ 10 callers
Class
Rotary
cramming/architectures/embeddings.py:76
↓ 4 callers
Class
EmbeddingComponent
cramming/architectures/components.py:15
↓ 4 callers
Class
FFNComponent
Note: The FF layer is not auto-scaled when using a GLU type activation. Better do this manually and choose a sensible intermed_size that is nicely
cramming/architectures/components.py:65
↓ 3 callers
Class
AttentionComponent
cramming/architectures/components.py:48
↓ 3 callers
Class
PredictionHeadComponent
cramming/architectures/components.py:201
↓ 3 callers
Class
ScriptableLM
Definitely can represent BERT, but also a lot of other things. To be used for MLM schemes.
cramming/architectures/scriptable_bert.py:46
↓ 3 callers
Class
ScriptableLMForSequenceClassification
Classification head and pooler.
cramming/architectures/fixed_cramlm.py:145
↓ 3 callers
Class
ShampooPreconditioner
Shampoo preconditioners for some generic layer. NOTE: Does not support sparse gradients at this time. Args: param (Tensor): Paramete
cramming/backend/optimizers/shampoo/shampoo_utils.py:220
↓ 2 callers
Class
AdagradPreconditioner
Adagrad/Adam/RMSProp preconditioner for a generic layer. Stores preconditioner using same format as parameter p. Operations are performed in-plac
cramming/backend/optimizers/shampoo/shampoo_utils.py:147
↓ 2 callers
Class
Cumsum
cramming/architectures/attention.py:737
↓ 2 callers
Class
CumsumExp
cramming/architectures/attention.py:750
↓ 2 callers
Class
FLASH
FLASH as described in Transformer Quality in Linear Time. This is FLASH-QUAD, as we're not too interested in long-range sequences here.
cramming/architectures/attention.py:634
↓ 2 callers
Class
FourierMixing
Fourier mixing layer as described in the FNet paper. Layer takes input with size [Batch, Seq, Hidden] and returns output of the same size. Thi
cramming/architectures/attention.py:527
↓ 2 callers
Class
FunnelAttention
Self-attention layer abstract class. This is a funnel crammed into the gpt neo-x implementation from: https://github.com/EleutherAI/gpt-neox/
cramming/architectures/attention.py:320
↓ 2 callers
Class
LARS
:class:`LARS` [LARC in apex] is a pytorch implementation of both the scaling and clipping variants of LARS, in which the ratio between gradie
cramming/backend/optimizers/optimizer_modifiers.py:39
↓ 2 callers
Class
PoolingComponent
cramming/architectures/components.py:176
↓ 2 callers
Class
RotarySanityCheck
not again...
cramming/architectures/embeddings.py:132
↓ 2 callers
Class
ScaledIdentity
cramming/architectures/attention.py:722
↓ 2 callers
Class
ScriptableFunnelLM
A funnel transformer variation. For now only implemented for fixed sequence lengths, but this is not a necessary limitation.
cramming/architectures/funnel_transformers.py:89
↓ 2 callers
Class
ScriptableLM
Definitely can represent BERT, but also a lot of other things. To be used for MLM schemes.
cramming/architectures/fixed_cramlm.py:57
↓ 2 callers
Class
ScriptableLMForPreTraining
Definitely can represent BERT, but also a lot of other things. To be used for MLM schemes.
cramming/architectures/fixed_cramlm.py:84
↓ 2 callers
Class
ScriptableRecurrentLM
Definitely can represent BERT, but also a lot of other things. To be used for MLM schemes.
cramming/architectures/recurrent_transformers.py:91
↓ 2 callers
Class
SeqFirstSelfAttention
Self-attention layer abstract class. This is the gpt neo-x implementation from: https://github.com/EleutherAI/gpt-neox/blob/main/megatron/mod
cramming/architectures/attention.py:112
↓ 2 callers
Class
SeqFirstTuFormAttention
Self-attention layer abstract class. Seq-first variant 1 THSA layer takes input with size [Seq, Batch, Hidden] and returns output of the
cramming/architectures/attention.py:449
↓ 2 callers
Class
TorchNormalize
cramming/architectures/attention.py:696
↓ 2 callers
Class
TorchSoftmax
cramming/architectures/attention.py:677
↓ 2 callers
Class
UniformGibbs
This is code based on https://github.com/taka-yamakoshi/TelephoneGame/blob/master/model/bert.py.
cramming/data/generation_gibbs.py:9
↓ 1 callers
Class
AdagradGrafting
cramming/backend/optimizers/shampoo/shampoo_utils.py:658
↓ 1 callers
Class
AdamGrafting
cramming/backend/optimizers/shampoo/shampoo_utils.py:688
↓ 1 callers
Class
BPTTforPreTraining
Modified pretraining for depth-recurrent models. Only works with models that expose the ScriptableRecurrentLM interface.
cramming/architectures/recurrent_transformers.py:141
↓ 1 callers
Class
BertAttentionWrapper
mini wrapper around BERT attention from huggingface for sanity checks.
cramming/architectures/attention.py:64
↓ 1 callers
Class
BlockShampooPreconditioner
Shampoo with blocking applied to the parameters. NOTE: Does not support sparse gradients at this time. Args: param (Tensor): Paramet
cramming/backend/optimizers/shampoo/shampoo_utils.py:483
↓ 1 callers
Class
CachedDataset
Cache a given dataset into RAM or SDRAM (GPU memory). This is only a good idea if you have enough RAM, especially if mapping into SDRAM.
cramming/data/cached_datasets.py:24
↓ 1 callers
Class
CrossEntropyWithZLoss
Cross Entropy plus logit regularization via z_loss.
cramming/architectures/losses.py:5
↓ 1 callers
Class
FlashMultiHeadAttention
Wrapper for flash MHA.
cramming/architectures/attention.py:268
↓ 1 callers
Class
FocalLoss
cramming/architectures/losses.py:158
↓ 1 callers
Class
FourierMixingParametrized
Fourier mixing layer as described in the FNet paper. Layer takes input with size [Seq, batch, Hidden] and returns output of the same size. Thi
cramming/architectures/attention.py:573
↓ 1 callers
Class
FunnelAttentionComponent
cramming/architectures/funnel_transformers.py:26
↓ 1 callers
Class
FunnelLayer
A funnel layer.
cramming/architectures/funnel_transformers.py:44
↓ 1 callers
Class
GLU
*-GLU activation functions. Implementation mostly following megatron
cramming/architectures/components.py:265
↓ 1 callers
Class
Identity
mini wrapper around BERT attention from huggingface for sanity checks.
cramming/architectures/attention.py:51
↓ 1 callers
Class
IncorrectCrossEntropyLoss
CrossEntropyLoss, but only on incorrectly classified examples.
cramming/architectures/losses.py:176
↓ 1 callers
Class
InfiniteDataLoader
Lazy copy-paste from https://gist.github.com/MFreidank/821cc87b012c53fade03b0c7aba13958.
cramming/backend/utils.py:253
↓ 1 callers
Class
L1Loss
L1 Loss as a drop-in replacement for Cross Entropy Loss. Only for 2dim inputs and 1dim labels This implementation includes a mean reduction in ba
cramming/architectures/losses.py:79
↓ 1 callers
Class
LMDBDataset
Implement LMDB caching and access. Originally based on https://github.com/pytorch/vision/blob/master/torchvision/datasets/lsun.py and htt
cramming/data/lmdb_datasets.py:20
↓ 1 callers
Class
LearnablePositional
Shorthand for a learnable embedding.
cramming/architectures/embeddings.py:61
↓ 1 callers
Class
MSELoss
MSE Loss as a drop-in replacement for Cross Entropy Loss. This implementation includes a mean reduction in batch dimension and a 1/num_classes/M
cramming/architectures/losses.py:29
↓ 1 callers
Class
MSELossFast
MSE Loss as a drop-in replacement for Cross Entropy Loss. Only for 2dim inputs and 1dim labels This implementation includes a mean reduction in b
cramming/architectures/losses.py:55
↓ 1 callers
Class
PatchedDataCollatorForLanguageModeling
cramming/backend/utils.py:158
↓ 1 callers
Class
ProgressiveBatching
cramming/backend/optimizers/progressive_batching.py:17
↓ 1 callers
Class
RMSNorm
The RMS variant of scaling norms.
cramming/architectures/components.py:305
↓ 1 callers
Class
RMSPropGrafting
cramming/backend/optimizers/shampoo/shampoo_utils.py:683
↓ 1 callers
Class
RotaryEleutherAI
The rotary position embeddings from RoFormer_ (Su et. al). A crucial insight from the method is that the query and keys are transformed b
cramming/architectures/embeddings.py:183
↓ 1 callers
Class
SAM
cramming/backend/optimizers/optimizer_modifiers.py:132
↓ 1 callers
Class
SGDGrafting
cramming/backend/optimizers/shampoo/shampoo_utils.py:644
↓ 1 callers
Class
SanityCheckforPreTraining
Make big go fast.
cramming/architectures/sanity_check.py:6
↓ 1 callers
Class
ScaleNorm
Quick and simple scale norm implementation. Do we also need FixNorm (cosine in the last layer)? It's a maybe here: https://github.com/lucidra
cramming/architectures/components.py:288
↓ 1 callers
Class
ScaledSinosoidal
Sinusoidal with scaling (see FLASH paper).
cramming/architectures/embeddings.py:41
↓ 1 callers
Class
ScriptableLMForPreTraining
Definitely can represent BERT, but also a lot of other things. To be used for MLM schemes.
cramming/architectures/scriptable_bert.py:138
↓ 1 callers
Class
ScriptableLMForSequenceClassification
Classification head and pooler.
cramming/architectures/scriptable_bert.py:222
↓ 1 callers
Class
SelfAttentionPyTorch
Minimal wrapper around pytorch self attention.
cramming/architectures/attention.py:85
↓ 1 callers
Class
Sequential
Modified sequential class.
cramming/architectures/components.py:318
↓ 1 callers
Class
SequentialwithMask
Modified sequential class.
cramming/architectures/recurrent_transformers.py:278
↓ 1 callers
Class
SinusoidalPositional
r"""Inject some information about the relative or absolute position of the tokens in the sequence. The positional encodings have the same dimensio
cramming/architectures/embeddings.py:9
↓ 1 callers
Class
SzegedyLoss
Regression directly back to input embedding. Remove the decoding layer if using this loss. As mentioned at https://twitter.com/ChrSzegedy/status/
cramming/architectures/losses.py:105
↓ 1 callers
Class
TorchEngine
This class mirrors deepspeed functionality.
cramming/backend/torch_default.py:40
↓ 1 callers
Class
TransformerLayer
A transformer-encoder structure based on the components from above.
cramming/architectures/fixed_cramlm.py:30
↓ 1 callers
Class
TransformerLayerSimplified
A transformer-encoder structure based on the components from above.
cramming/architectures/recurrent_transformers.py:40
↓ 1 callers
Class
TuFormAttention
Self-attention layer abstract class. This is a simplification of the tuformer implementationfrom https://github.com/xliu1231/fairseq_tuformer
cramming/architectures/attention.py:387
↓ 1 callers
Class
_ModelArgWrapper
Wrap arguments.
cramming/backend/torch_default.py:428
↓ 1 callers
Class
crammedBertConfig
cramming/architectures/scriptable_bert.py:38
Class
Adahessian
Implements Adahessian algorithm. It has been proposed in `ADAHESSIAN: An Adaptive Second Order Optimizer for Machine Learning`. Arguments:
cramming/backend/optimizers/adahessian.py:35
Class
FLASHLayer
A FLASH-quad layer.
cramming/architectures/components.py:157
Class
Grafting
cramming/backend/optimizers/shampoo/shampoo_utils.py:617
Class
GraftingType
cramming/backend/optimizers/shampoo/shampoo_utils.py:30
Class
LargeDimMethod
cramming/backend/optimizers/shampoo/shampoo_utils.py:38
Class
MetaOptimizer
base class for a meta optimizer that wraps and modifies an existing pytorch optimizer.
cramming/backend/optimizers/optimizer_modifiers.py:14
Class
NewtonConvergenceFlag
cramming/backend/optimizers/shampoo/matrix_functions.py:20
Class
Preconditioner
Preconditioner class.
cramming/backend/optimizers/shampoo/shampoo_utils.py:115
Class
PreconditionerType
cramming/backend/optimizers/shampoo/shampoo_utils.py:25
Class
RootInvMethod
cramming/backend/optimizers/shampoo/matrix_functions.py:25
Class
ScriptableLMForTokenClassification
Classification head.
cramming/architectures/scriptable_bert.py:300
Class
SeqFirstTuFormAttention2
Self-attention layer abstract class. Seq-first variant 2 THSA layer takes input with size [Seq, Batch, Hidden] and returns output of the
cramming/architectures/attention.py:487
Class
Shampoo
Implements Shampoo algorithm. See details in: - https://arxiv.org/pdf/1802.09568.pdf - https://arxiv.org/pdf/2002.09018.pdf If root_
cramming/backend/optimizers/shampoo/shampoo.py:28
Class
TransformerLayer
A transformer-encoder structure based on the components from above.
cramming/architectures/components.py:86
Class
config
cramming/architectures/attention.py:70