Path: blob/master/labml_nn/__init__.py
4910 views
"""1# [Annotated Research Paper Implementations: Transformers, StyleGAN, Stable Diffusion, DDPM/DDIM, LayerNorm, Nucleus Sampling and more](index.html)23This is a collection of simple PyTorch implementations of4neural networks and related algorithms.5[These implementations](https://github.com/labmlai/annotated_deep_learning_paper_implementations) are documented with explanations,6and the [website](index.html)7renders these as side-by-side formatted notes.8We believe these would help you understand these algorithms better.9101112We are actively maintaining this repo and adding new13implementations.14[](https://twitter.com/labmlai) for updates.1516## Translations1718### **[English (original)](https://nn.labml.ai)**19### **[Chinese (translated)](https://nn.labml.ai/zh/)**20### **[Japanese (translated)](https://nn.labml.ai/ja/)**2122## Paper Implementations2324#### ✨ [Transformers](transformers/index.html)2526* [JAX implementation](transformers/jax_transformer/index.html)27* [Multi-headed attention](transformers/mha.html)28* [Triton Flash Attention](transformers/flash/index.html)29* [Transformer building blocks](transformers/models.html)30* [Transformer XL](transformers/xl/index.html)31* [Relative multi-headed attention](transformers/xl/relative_mha.html)32* [Rotary Positional Embeddings (RoPE)](transformers/rope/index.html)33* [Attention with Linear Biases (ALiBi)](transformers/alibi/index.html)34* [RETRO](transformers/retro/index.html)35* [Compressive Transformer](transformers/compressive/index.html)36* [GPT Architecture](transformers/gpt/index.html)37* [GLU Variants](transformers/glu_variants/simple.html)38* [kNN-LM: Generalization through Memorization](transformers/knn/index.html)39* [Feedback Transformer](transformers/feedback/index.html)40* [Switch Transformer](transformers/switch/index.html)41* [Fast Weights Transformer](transformers/fast_weights/index.html)42* [FNet](transformers/fnet/index.html)43* [Attention Free Transformer](transformers/aft/index.html)44* [Masked Language Model](transformers/mlm/index.html)45* [MLP-Mixer: An all-MLP Architecture for Vision](transformers/mlp_mixer/index.html)46* [Pay Attention to MLPs (gMLP)](transformers/gmlp/index.html)47* [Vision Transformer (ViT)](transformers/vit/index.html)48* [Primer EZ](transformers/primer_ez/index.html)49* [Hourglass](transformers/hour_glass/index.html)5051#### ✨ [Low-Rank Adaptation (LoRA)](lora/index.html)5253#### ✨ [Eleuther GPT-NeoX](neox/index.html)54* [Generate on a 48GB GPU](neox/samples/generate.html)55* [Finetune on two 48GB GPUs](neox/samples/finetune.html)56* [LLM.int8()](neox/utils/llm_int8.html)5758#### ✨ [Diffusion models](diffusion/index.html)5960* [Denoising Diffusion Probabilistic Models (DDPM)](diffusion/ddpm/index.html)61* [Denoising Diffusion Implicit Models (DDIM)](diffusion/stable_diffusion/sampler/ddim.html)62* [Latent Diffusion Models](diffusion/stable_diffusion/latent_diffusion.html)63* [Stable Diffusion](diffusion/stable_diffusion/index.html)6465#### ✨ [Generative Adversarial Networks](gan/index.html)66* [Original GAN](gan/original/index.html)67* [GAN with deep convolutional network](gan/dcgan/index.html)68* [Cycle GAN](gan/cycle_gan/index.html)69* [Wasserstein GAN](gan/wasserstein/index.html)70* [Wasserstein GAN with Gradient Penalty](gan/wasserstein/gradient_penalty/index.html)71* [StyleGAN 2](gan/stylegan/index.html)7273#### ✨ [Recurrent Highway Networks](recurrent_highway_networks/index.html)7475#### ✨ [LSTM](lstm/index.html)7677#### ✨ [HyperNetworks - HyperLSTM](hypernetworks/hyper_lstm.html)7879#### ✨ [ResNet](resnet/index.html)8081#### ✨ [ConvMixer](conv_mixer/index.html)8283#### ✨ [Capsule Networks](capsule_networks/index.html)8485#### ✨ [U-Net](unet/index.html)8687#### ✨ [Sketch RNN](sketch_rnn/index.html)8889#### ✨ Graph Neural Networks9091* [Graph Attention Networks (GAT)](graphs/gat/index.html)92* [Graph Attention Networks v2 (GATv2)](graphs/gatv2/index.html)9394#### ✨ [Reinforcement Learning](rl/index.html)95* [Proximal Policy Optimization](rl/ppo/index.html) with96[Generalized Advantage Estimation](rl/ppo/gae.html)97* [Deep Q Networks](rl/dqn/index.html) with98with [Dueling Network](rl/dqn/model.html),99[Prioritized Replay](rl/dqn/replay_buffer.html)100and Double Q Network.101102#### ✨ [Counterfactual Regret Minimization (CFR)](cfr/index.html)103104Solving games with incomplete information such as poker with CFR.105106* [Kuhn Poker](cfr/kuhn/index.html)107108#### ✨ [Optimizers](optimizers/index.html)109* [Adam](optimizers/adam.html)110* [AMSGrad](optimizers/amsgrad.html)111* [Adam Optimizer with warmup](optimizers/adam_warmup.html)112* [Noam Optimizer](optimizers/noam.html)113* [Rectified Adam Optimizer](optimizers/radam.html)114* [AdaBelief Optimizer](optimizers/ada_belief.html)115* [Sophia-G Optimizer](optimizers/sophia.html)116117#### ✨ [Normalization Layers](normalization/index.html)118* [Batch Normalization](normalization/batch_norm/index.html)119* [Layer Normalization](normalization/layer_norm/index.html)120* [Instance Normalization](normalization/instance_norm/index.html)121* [Group Normalization](normalization/group_norm/index.html)122* [Weight Standardization](normalization/weight_standardization/index.html)123* [Batch-Channel Normalization](normalization/batch_channel_norm/index.html)124* [DeepNorm](normalization/deep_norm/index.html)125126#### ✨ [Distillation](distillation/index.html)127128#### ✨ [Adaptive Computation](adaptive_computation/index.html)129130* [PonderNet](adaptive_computation/ponder_net/index.html)131132#### ✨ [Uncertainty](uncertainty/index.html)133134* [Evidential Deep Learning to Quantify Classification Uncertainty](uncertainty/evidence/index.html)135136#### ✨ [Activations](activations/index.html)137138* [Fuzzy Tiling Activations](activations/fta/index.html)139140#### ✨ [Language Model Sampling Techniques](sampling/index.html)141* [Greedy Sampling](sampling/greedy.html)142* [Temperature Sampling](sampling/temperature.html)143* [Top-k Sampling](sampling/top_k.html)144* [Nucleus Sampling](sampling/nucleus.html)145146#### ✨ [Scalable Training/Inference](scaling/index.html)147* [Zero3 memory optimizations](scaling/zero3/index.html)148149### Installation150151```bash152pip install labml-nn153```154"""155156157