MCPcopy Create free account

hub / github.com/FareedKhan-dev/train-llm-from-scratch / types & classes

Types & classes40 in github.com/FareedKhan-dev/train-llm-from-scratch

↓ 17 callersClassTransformer
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:12
↓ 7 callersClassModernTransformer
src/models/modern/model.py:43
↓ 6 callersClassMetricsLogger
src/post_training/logging_utils.py:18
↓ 6 callersClassModernConfig
src/models/modern/config.py:35
↓ 6 callersClassRequest
One continuation to score: its context tokens and its own tokens.
src/benchmarks/scoring.py:32
↓ 6 callersClassTransformerWithValueHead
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
↓ 5 callersClassRMSNorm
src/models/modern/norm.py:21
↓ 5 callersClassRewardModel
Wrap a :class:`Transformer` and add a scalar reward head (no ``lm_head`` used).
src/post_training/reward_model.py:33
↓ 4 callersClassExample
A context, the continuations to score after it, and the index of the right one.
src/benchmarks/tasks.py:33
↓ 3 callersClassConfigError
A configuration value is missing, has the wrong type, or is out of range.
config/post_training_config.py:39
↓ 3 callersClassDDPContext
src/post_training/distributed.py:24
↓ 3 callersClassMuon
Muon for parameter groups with ``use_muon=True``, AdamW for the others. Build the groups with :func:`muon_param_groups`, or pass your own li
src/optim/muon.py:69
↓ 2 callersClassBlock
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 callersClassGroupedQueryAttention
src/models/modern/attention.py:62
↓ 2 callersClassInt8Linear
A frozen ``nn.Linear`` whose weight is stored as int8 with one scale per output row.
src/inference/quantize.py:32
↓ 2 callersClassMLP
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 callersClassMoE
src/models/modern/moe.py:40
↓ 2 callersClassMultiHeadAttention
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:63
↓ 2 callersClassSwiGLU
src/models/modern/mlp.py:22
↓ 2 callersClass_TenTokens
Stands in for tiktoken (no download): every document is 10 tokens.
tests/test_data_tools.py:18
↓ 1 callersClassHead
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 callersClassKVCache
Preallocated keys and values for every layer. ``length`` counts the tokens stored.
src/models/modern/kv_cache.py:21
↓ 1 callersClassLoRALinear
A frozen ``nn.Linear`` plus a trainable low-rank update ``(alpha / r) * B @ A``.
src/models/lora.py:34
↓ 1 callersClassModernBlock
src/models/modern/block.py:25
↓ 1 callersClassMultiHeadLatentAttention
Multi-head latent attention, simplified from DeepSeek-V2/V3. Each token is compressed into a latent ``c`` of ``kv_latent_dim`` numbers; ever
src/models/modern/attention.py:110
↓ 1 callersClassRolloutBatch
Result of :func:`generate_with_logprobs`. Attributes: sequences: (B, P+G) prompt tokens followed by generated tokens. respons
src/post_training/rollout.py:46
↓ 1 callersClassScore
``loglik`` is the summed log-probability of the continuation; ``greedy`` says whether greedy decoding from the context would have produced exactly
src/benchmarks/scoring.py:40
↓ 1 callersClassSpeculativeStats
src/inference/speculative.py:37
↓ 1 callersClassStage
ui/stages.py:30
↓ 1 callersClassTask
src/benchmarks/tasks.py:42
↓ 1 callersClass_Response
tests/test_data_tools.py:53
ClassBPETokenizer
Byte-level BPE. Build one with :meth:`train` or :meth:`load`.
src/tokenizer/bpe.py:62
ClassBaseModelConfig
config/post_training_config.py:49
ClassDPOConfig
config/post_training_config.py:171
ClassGRPOConfig
config/post_training_config.py:227
ClassPPOConfig
config/post_training_config.py:199
ClassPretrainConfig
Pretrain the mid base model from scratch on the Pile HDF5 (mix in task text late).
config/post_training_config.py:95
ClassRewardConfig
config/post_training_config.py:150
ClassSFTConfig
config/post_training_config.py:122
ClassTokenizer
The tokenizer interface the scripts rely on (tiktoken.Encoding and BPETokenizer both fit).
src/tokenizer/__init__.py:25