MCPcopy Create free account

hub / github.com/FareedKhan-dev/train-llm-from-scratch / functions

Functions252 in github.com/FareedKhan-dev/train-llm-from-scratch

↓ 1 callersFunctiontokenize_to_h5
(zst_paths: list[str], out_path: str, max_tokens: int | None)
scripts/prepare_pretrain_data.py:76
↓ 1 callersFunctionunique_output_path
Avoid overwriting an existing final model checkpoint.
scripts/train_transformer.py:277
↓ 1 callersFunctionverify_eval_benchmark
Prove the GSM8K scoring is correct independent of any model: a response containing the gold scores correct; a wrong number scores incorrect.
tests/verify_data_and_eval.py:105
↓ 1 callersFunctionverify_grpo_optimizes
()
tests/verify_rl_optimizes.py:36
↓ 1 callersFunctionverify_pile
()
tests/verify_data_and_eval.py:25
↓ 1 callersFunctionverify_ppo_optimizes
()
tests/verify_rl_optimizes.py:62
↓ 1 callersFunctionverify_preferences
()
tests/verify_data_and_eval.py:67
↓ 1 callersFunctionverify_rl_prompts_and_gold
Gold answers in the RL prompt files must match the GSM8K dataset's #### answer.
tests/verify_data_and_eval.py:82
↓ 1 callersFunctionverify_sft_mask_alignment
The critical SFT check: the loss_mask must be 1 EXACTLY on assistant-completion tokens and 0 on the prompt / role markers. We decode masked vs unm
tests/verify_data_and_eval.py:39
Method__init__
(self, transformer: Transformer)
src/post_training/reward_model.py:40
Method__init__
(self, transformer: Transformer)
src/post_training/value_head.py:26
Method__init__
( self, stage: str, log_dir: str, *, use_wandb: bool = False,
src/post_training/logging_utils.py:19
Method__init__
Initializes the multi-head attention module. Args: n_head (int): The number of parallel attention heads. n_e
src/models/attention.py:72
Method__init__
Initializes the Transformer block. Args: n_head (int): The number of attention heads. n_embed (int): The dim
src/models/transformer_block.py:18
Method__init__
Initializes the MLP module. Args: n_embed (int): The dimensionality of the input embedding.
src/models/mlp.py:16
Method__init__
Initializes the Transformer model. Args: n_head (int): Number of attention heads. n_embed (int): Embedding d
src/models/transformer.py:23
Functionactive_jobs
()
ui/jobs.py:151
Functionbarrier
(ctx: DDPContext)
src/post_training/distributed.py:93
Functioncheckpoint_step
Extract the step number from a checkpoint filename.
scripts/train_transformer.py:118
Methodcontext_length
(self)
src/post_training/reward_model.py:48
Methodcontext_length
(self)
src/post_training/value_head.py:42
Methodenabled
(self)
src/post_training/distributed.py:32
Functionextract_think
Return the content of the first ``<think>...</think>`` block, if any.
src/post_training/rewards/parsing.py:41
Methodforward
Scalar reward per sequence (B,). Args: idx: (B, T) token ids. seq_lengths: (B,) number of real (non-pad) tok
src/post_training/reward_model.py:56
Methodforward
(self, idx: torch.Tensor)
src/post_training/value_head.py:45
Methodforward
Forward pass through the attention head. Args: x (torch.Tensor): Input tensor of shape (B, T, C). Returns:
src/models/attention.py:35
Methodforward
Forward pass through the multi-head attention. Args: x (torch.Tensor): Input tensor of shape (B, T, C). Returns
src/models/attention.py:85
Methodforward
Forward pass through the Transformer block. Args: x (torch.Tensor): Input tensor. Returns: torch.Te
src/models/transformer_block.py:33
Methodforward
Forward pass through the MLP. Args: x (torch.Tensor): Input tensor of shape (B, T, C), where B is batch size,
src/models/mlp.py:28
Methodforward
Forward pass through the Transformer. Args: idx (torch.Tensor): Input token indices. targets (torch.Tensor,
src/models/transformer.py:90
Methodforward_embedding
Forward pass focusing on the embedding and attention parts. Args: x (torch.Tensor): Input tensor. Returns:
src/models/transformer_block.py:49
Methodforward_embedding
Forward pass focusing on the embedding and attention blocks. Args: idx (torch.Tensor): Input token indices. Ret
src/models/transformer.py:114
Functiongpu_busy
Return the job_id of a *running* GPU job, if any (for the launch guard).
ui/jobs.py:138
Functiongpu_status
Return a list of (idx, name, used_mb, total_mb, util) via nvidia-smi, or [].
ui/theme.py:49
Functionhero
(title: str, subtitle: str)
ui/theme.py:40
Methodis_main
(self)
src/post_training/distributed.py:28
Functionis_main_process
(ctx: DDPContext)
src/post_training/distributed.py:78
Functionlatest_log
(prefix: str)
ui/metrics.py:12
Functionlaunch
Start ``argv`` as a detached background job. ``kind`` is 'gpu' or 'cpu' (for the guard).
ui/jobs.py:82
Functionload_metrics
(path: str)
ui/metrics.py:17
Functionmasked_mean_per_row
Per-row (B,) mean of ``values`` (B,T) over masked positions.
src/post_training/utils.py:124
Functionmetric_columns
Numeric columns worth plotting (drop bookkeeping).
ui/metrics.py:32
Functionparse_config
Parse CLI overrides for a config dataclass. Returns ``(cfg, extras)`` where ``cfg`` is an instance of ``cfg_cls`` with any provided ``--
src/post_training/cli.py:29
Functionrender_chat
Render a list of ``{"role", "content"}`` messages to the plain-text chat format. This is purely for display/debugging; tokenization goes thr
src/post_training/chat_template.py:73
Functionreward_format
Pure format reward (no gold): 1.0 if exactly one well-formed answer block else 0.
src/post_training/rewards/verifiers.py:49
Functionsequence_entropy
Per-token predictive entropy ``(B, T-1)`` of ``model`` on ``sequences`` (for an optional PPO entropy bonus / diagnostics).
src/post_training/rollout.py:287
Functionsetup_page
(title: str, icon: str = "🧠")
ui/theme.py:35
Functionshard_indices
Return this rank's strided slice of ``range(num_items)`` for data sharding.
src/post_training/distributed.py:103
Functionstatus
Return 'running' | 'finished' | 'failed' | 'none'.
ui/jobs.py:100
Functionstatus_badge
(status: str)
ui/theme.py:44
Functionstop
Terminate a running job and all its workers (process group).
ui/jobs.py:113
Methodvalue_only
Per-token values without computing the (large) vocab logits -- used when scoring rollouts where only V(s_t) is needed.
src/post_training/value_head.py:52
← previous201–252 of 252, ranked by callers