MCPcopy Create free account

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

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

Method_init_weights
(self, module: nn.Module)
src/models/modern/model.py:71
Function_lambada
(doc: dict[str, Any])
src/benchmarks/tasks.py:59
Function_modern
()
tests/test_lora.py:18
Methodacceptance_rate
(self)
src/inference/speculative.py:44
Functionactive_jobs
()
ui/jobs.py:175
Functionattention_masks
()
docs/diagrams/make_plots.py:182
Functionbarrier
(ctx: DDPContext)
src/post_training/distributed.py:103
Functioncfg
()
tests/test_checkpoint_io.py:38
Functioncheckpoint_step
Extract the step number from a checkpoint filename.
scripts/train_transformer.py:175
Methodcontext_length
(self)
src/post_training/reward_model.py:44
Methodcontext_length
(self)
src/post_training/value_head.py:38
Functioncount_parameters
(model: nn.Module)
src/models/factory.py:59
Functiondata
(tmp_path_factory: pytest.TempPathFactory)
tests/test_pipeline_e2e.py:38
Methodenabled
(self)
src/post_training/distributed.py:35
Methodencode_ordinary
(self, text: str)
src/tokenizer/__init__.py:34
Methodeot_token
(self)
src/tokenizer/__init__.py:32
Methodeot_token
(self)
src/tokenizer/bpe.py:99
Functionextract_think
Return the content of the first ``<think>...</think>`` block, if any.
src/post_training/rewards/parsing.py:46
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:52
Methodforward
(self, idx: torch.Tensor)
src/post_training/value_head.py:41
Methodforward
(self, x: Float[Tensor, "*batch in_features"])
src/inference/quantize.py:50
Methodforward
Forward pass through the attention head. Args: x (torch.Tensor): Input tensor of shape (B, T, C). Returns:
src/models/attention.py:38
Methodforward
Forward pass through the multi-head attention. Args: x (torch.Tensor): Input tensor of shape (B, T, C). Returns
src/models/attention.py:88
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:95
Methodforward
(self, x: Float[Tensor, "*batch d_in"])
src/models/lora.py:59
Methodforward
( self, x: Float[Tensor, "batch seq embed"], cos: Float[Tensor, "seq half"], s
src/models/modern/block.py:39
Methodforward
(self, x: Float[Tensor, "batch seq embed"])
src/models/modern/moe.py:51
Methodforward
(self, x: Float[Tensor, "*batch dim"])
src/models/modern/norm.py:27
Methodforward
( self, x: Float[Tensor, "batch seq embed"], cos: Float[Tensor, "seq half"], s
src/models/modern/attention.py:77
Methodforward
( self, x: Float[Tensor, "batch seq embed"], cos: Float[Tensor, "seq half"], s
src/models/modern/attention.py:139
Methodforward
(self, x: Float[Tensor, "*batch embed"])
src/models/modern/mlp.py:29
Methodforward
( self, idx: Int[Tensor, "batch seq"], targets: Int[Tensor, "batch seq"] | None = None )
src/models/modern/model.py:100
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. Runs every block normally except the last one, which returns its MLP hi
src/models/transformer.py:119
Methodgenerate
Sample ``max_new_tokens`` tokens after ``idx``. With the cache, the prompt is processed once ("prefill") and every later step feeds
src/models/modern/model.py:130
Functiongenerate_text
Generates text using a pre-trained Transformer model. Args: model_path (str): Path to the saved model checkpoint. input_text
scripts/generate_text.py:56
Functiongpu_busy
Return the job_id of a *running* GPU job, if any (for the launch guard).
ui/jobs.py:162
Functiongpu_status
Return a list of (idx, name, used_mb, total_mb, util) via nvidia-smi, or [].
ui/theme.py:49
Methodhead_dim
(self)
src/models/modern/config.py:83
Functionhero
(title: str, subtitle: str)
ui/theme.py:40
Methodhidden_dim
(self)
src/models/modern/config.py:91
Functionhook
(module: nn.Module, args: tuple[torch.Tensor, ...])
tests/test_inference.py:48
Methodin_features
(self)
src/models/lora.py:52
Methodis_main
(self)
src/post_training/distributed.py:31
Functionis_main_process
(ctx: DDPContext)
src/post_training/distributed.py:88
Functionkv_cache_memory
()
docs/diagrams/make_plots.py:154
Methodkv_heads
(self)
src/models/modern/config.py:87
Methodlatent_dim
(self)
src/models/modern/config.py:95
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:96
Functionload_metrics
(path: str)
ui/metrics.py:17
Functionlogits
(ids: torch.Tensor)
tests/test_benchmarks.py:86
Functionlr_schedules
()
docs/diagrams/make_plots.py:91
Functionmetric_columns
Numeric columns worth plotting (drop bookkeeping).
ui/metrics.py:32
Methodmla_rope_dim
(self)
src/models/modern/config.py:99
Functionmuon_singular_values
()
docs/diagrams/make_plots.py:217
Methodn_vocab
(self)
src/tokenizer/__init__.py:29
Methodn_vocab
(self)
src/tokenizer/bpe.py:95
Methodneed
(cond: bool, msg: str)
src/models/modern/config.py:64
Methodout_features
(self)
src/models/lora.py:56
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:44
Functionrecording
(*args: Any, **kwargs: Any)
tests/test_resume_data_order.py:86
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
Functionrope
()
docs/diagrams/make_plots.py:109
Methodrope_table_dim
Width of the cos/sin tables: the full head for GQA, the decoupled part for MLA.
src/models/modern/config.py:103
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:282
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:113
Functionstatus
Return 'running' | 'finished' | 'failed' | 'none'.
ui/jobs.py:113
Functionstatus_badge
(status: str)
ui/theme.py:44
Functionstop
Terminate a running job and all its workers (process group).
ui/jobs.py:126
Functiontest_a_failed_or_short_download_leaves_nothing_behind
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/test_data_tools.py:73
Functiontest_a_perfect_draft_is_always_accepted
()
tests/test_inference.py:60
Functiontest_a_seed_fixes_the_order_whatever_else_uses_numpy
(tmp_path: Path)
tests/test_resume_data_order.py:42
Functiontest_a_shape_mismatch_is_caught_at_the_call
()
tests/test_type_checks.py:16
Functiontest_a_wrong_dtype_is_caught_at_the_call
()
tests/test_type_checks.py:23
Functiontest_accumulated_gradient_equals_the_full_batch_gradient
()
tests/test_sft_accumulation.py:30
Functiontest_an_empty_context_is_refused
()
tests/test_benchmarks.py:69
Functiontest_auto_returns_a_usable_device
()
tests/test_device.py:13
Functiontest_autocast_is_a_no_op_on_cpu
()
tests/test_device.py:28
Functiontest_bad_rank_or_skip_is_an_error
(tmp_path: Path)
tests/test_resume_data_order.py:73
Functiontest_batching_and_padding_change_nothing
()
tests/test_benchmarks.py:62
Functiontest_both_optimizers_train_a_tiny_model
(name: str)
tests/test_optim.py:70
Functiontest_build_model_picks_the_architecture
()
tests/test_factory.py:22
Functiontest_cached_and_uncached_generation_agree
(name: str)
tests/test_modern_model.py:244
Functiontest_causal_masks_are_not_saved_and_old_checkpoints_with_them_still_load
Every classic head used to save its (context x context) mask: ~1.6 GiB in the 400M config.
tests/test_checkpoint_io.py:116
Functiontest_causality
Changing a token must not change the predictions for earlier positions.
tests/test_modern_model.py:60
Functiontest_choice_tasks_report_acc_and_length_normalized_acc_norm
()
tests/test_benchmarks.py:81
Functiontest_cli_style_overrides_build_a_modern_model
()
tests/test_factory.py:31
Functiontest_cli_values_are_converted_like_json
(monkeypatch: pytest.MonkeyPatch)
tests/test_config.py:108
Functiontest_coerce_accepts_sensible_spellings
(value: Any, annotation: Any, expected: Any)
tests/test_config.py:85
Functiontest_coerce_rejects_the_rest
(value: Any, annotation: Any)
tests/test_config.py:90
Functiontest_collate_pads_both_sides_to_one_length
()
tests/test_preference_truncation.py:85
Functiontest_comment_keys_are_ignored
(tmp_path: Path)
tests/test_config.py:65
Functiontest_compiled_model_checkpoint_round_trip
The exact failure from issue #36: save a compiled model, load it into a bare one.
tests/test_checkpoint_io.py:69
Functiontest_config_validation
()
tests/test_modern_model.py:258
Functiontest_ddp_wrap_lets_moe_experts_skip_a_step
(tmp_path: Path)
tests/test_ddp_moe.py:16
← previousnext →401–500 of 604, ranked by callers