Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/FareedKhan-dev/train-llm-from-scratch
/ types & classes
Types & classes
18 in github.com/FareedKhan-dev/train-llm-from-scratch
⨍
Functions
252
◇
Types & classes
18
↓ 10 callers
Class
Transformer
The main Transformer model. This class combines token and position embeddings with a sequence of Transformer blocks and a final linear l
src/models/transformer.py:9
↓ 6 callers
Class
MetricsLogger
src/post_training/logging_utils.py:18
↓ 6 callers
Class
Stage
ui/stages.py:23
↓ 3 callers
Class
RewardModel
Wrap a :class:`Transformer` and add a scalar reward head (no ``lm_head`` used).
src/post_training/reward_model.py:37
↓ 3 callers
Class
TransformerWithValueHead
Wrap a :class:`Transformer` and add a scalar value head for PPO. ``forward(idx)`` returns ``(logits, values)`` where ``logits`` are the policy lo
src/post_training/value_head.py:19
↓ 2 callers
Class
Block
A single Transformer block. This block consists of a multi-head attention layer followed by an MLP, with layer normalization and residua
src/models/transformer_block.py:6
↓ 2 callers
Class
DDPContext
src/post_training/distributed.py:21
↓ 2 callers
Class
MLP
A simple Multi-Layer Perceptron with one hidden layer. This module is used within the Transformer block for feed-forward processing. It
src/models/mlp.py:5
↓ 2 callers
Class
MultiHeadAttention
Multi-Head Attention module. This module combines multiple attention heads in parallel. The outputs of each head are concatenated and pa
src/models/attention.py:60
↓ 1 callers
Class
Head
A single attention head. This module calculates attention scores and applies them to the values. It includes key, query, and value proje
src/models/attention.py:6
↓ 1 callers
Class
RolloutBatch
Result of :func:`generate_with_logprobs`. Attributes: sequences: (B, P+G) prompt tokens followed by generated tokens. respons
src/post_training/rollout.py:33
Class
BaseModelConfig
config/post_training_config.py:28
Class
DPOConfig
config/post_training_config.py:101
Class
GRPOConfig
config/post_training_config.py:148
Class
PPOConfig
config/post_training_config.py:120
Class
PretrainConfig
Pretrain the mid base model from scratch on the Pile HDF5 (mix in task text late).
config/post_training_config.py:48
Class
RewardConfig
config/post_training_config.py:85
Class
SFTConfig
config/post_training_config.py:67