MCPcopy Create free account

hub / github.com/rohitg00/ai-engineering-from-scratch / functions

Functions8,347 in github.com/rohitg00/ai-engineering-from-scratch

↓ 3 callersFunctionsample_tokens
Sample a sequence of length len(cond) with CFG + temperature.
phases/12-multimodal-ai/12-emu3-next-token-for-generation/code/main.py:92
↓ 3 callersFunctionsample_uniform
(a, b)
phases/01-math-foundations/16-sampling-methods/code/sampling.py:7
↓ 3 callersMethodscore
(self, doc_id: str, query_terms: list[str])
phases/19-capstone-projects/51-literature-retrieval/code/main.py:81
↓ 3 callersMethodscore
(self, data)
phases/02-ml-fundamentals/13-ml-pipelines/code/pipeline.py:332
↓ 3 callersFunctionscore_code_exec
(prediction: str, assertions: list[str], timeout_s: float = DEFAULT_TIMEOUT_S)
phases/19-capstone-projects/72-code-exec-metric/code/main.py:246
↓ 3 callersMethodsearch
(query: Vec, topK = 5, metric: Metric = "cosine")
phases/11-llm-engineering/04-embeddings/code/main.ts:157
↓ 3 callersMethodsearch_vec
(self, qv: list[float], k: int)
phases/19-capstone-projects/67-query-rewriting-hyde/code/main.py:117
↓ 3 callersFunctionseedMigration
( repo: string, sourceRuntime: string, targetRuntime: string, files: FileDiff[], )
phases/19-capstone-projects/09-code-migration-agent/code/ts/src/migrations.ts:33
↓ 3 callersFunctionsentence_chunks
(doc_id: str, text: str, target: int = 500)
phases/19-capstone-projects/64-chunking-strategies-advanced/code/main.py:76
↓ 3 callersFunctionsentinel
(i)
phases/07-transformers-deep-dive/08-t5-bart-encoder-decoder/code/main.py:10
↓ 3 callersMethodseq
(self, p: int)
phases/12-multimodal-ai/06-any-resolution-patch-n-pack/code/main.py:28
↓ 3 callersFunctionsetText
(selector, value)
site/app.js:101
↓ 3 callersFunctionsft_collate
Pad to longest in batch and build labels with -100 mask on instruction + pad.
phases/19-capstone-projects/39-instruction-tuning-sft/code/main.py:397
↓ 3 callersFunctionshapeRow
(label, vals, hi)
site/figures-math2.js:93
↓ 3 callersFunctionshearing_2d
(kx, ky)
phases/01-math-foundations/03-matrix-transformations/code/transformations.py:28
↓ 3 callersFunctionsigmoid
(x)
phases/03-deep-learning-core/08-weight-initialization/code/main.py:23
↓ 3 callersMethodsigmoid
(self)
phases/03-deep-learning-core/03-backpropagation/code/main.py:50
↓ 3 callersFunctionsigmoid_loss
SigLIP-style per-pair BCE. Positives are the diagonal.
phases/12-multimodal-ai/02-clip-contrastive-pretraining/code/main.py:64
↓ 3 callersFunctionsimilarity_matrix
(images: list[list[float]], texts: list[list[float]], tau: float)
phases/12-multimodal-ai/02-clip-contrastive-pretraining/code/main.py:25
↓ 3 callersFunctionsimulate
(p_a: float, p_b: float, seed: int = 7, max_n: int = 300_000)
phases/17-infrastructure-and-production/21-ab-testing-llm-features/code/main.py:32
↓ 3 callersFunctionsimulate
(gov: Governor, label: str)
phases/15-autonomous-systems/13-cost-governors/code/main.py:82
↓ 3 callersMethodsimulate
(self, start_state, n_steps, seed=None)
phases/01-math-foundations/22-stochastic-processes/code/stochastic.py:37
↓ 3 callersFunctionsimulate_bfloat16
(x)
phases/01-math-foundations/13-numerical-stability/code/numerical.py:114
↓ 3 callersFunctionsimulate_transformer_layer
(input_data, weights, kv_scale=1.0)
phases/10-llms-from-scratch/11-quantization/code/main.py:200
↓ 3 callersFunctionsin_embed
(t, dim=8)
phases/08-generative-ai/10-video-generation/code/main.py:5
↓ 3 callersFunctionsin_embed
(t, T, dim=8)
phases/08-generative-ai/09-inpainting-outpainting-editing/code/main.py:5
↓ 3 callersMethodsnapshot
(self)
phases/16-multi-agent-and-swarms/04-primitive-model/code/main.py:32
↓ 3 callersFunctionsoftmax
(xs: list[float])
phases/18-ethics-safety-alignment/04-sycophancy-rlhf-amplification/code/main.py:30
↓ 3 callersFunctionsoftmax
(z)
phases/09-reinforcement-learning/08-ppo/code/main.py:34
↓ 3 callersFunctionsoftmax
(logits)
phases/01-math-foundations/06-probability-and-distributions/code/probability.py:89
↓ 3 callersFunctionsoftmax
(x)
phases/07-transformers-deep-dive/02-self-attention-from-scratch/code/self_attention.py:4
↓ 3 callersFunctionspeaker_vector
Deterministic 'speaker embedding' — toy ECAPA-TDNN stand-in.
phases/06-speech-and-audio/08-voice-cloning-conversion/code/main.py:24
↓ 3 callersFunctionspearman_correlation
(x, y)
phases/01-math-foundations/15-statistics-for-ml/code/statistics.py:95
↓ 3 callersFunctionsplit_dataset
Stratified split by category.
phases/19-capstone-projects/39-instruction-tuning-sft/code/main.py:343
↓ 3 callersFunctionssm_state_bytes
(cfg: HybridConfig, bytes_per_elem: int)
phases/10-llms-from-scratch/21-jamba-hybrid-ssm-transformer/code/main.py:38
↓ 3 callersFunctionstage3_ppo
Toy REINFORCE-with-KL (a stripped-down PPO). For each step: sample a batch from current policy, take a policy-gradient step on `r(a) - beta *
phases/18-ethics-safety-alignment/01-instruction-following-alignment-signal/code/main.py:118
↓ 3 callersFunctionstdBytes
(N)
site/figures-transformers.js:417
↓ 3 callersFunctionstep
(state, action, slip, rng)
phases/09-reinforcement-learning/11-sim-to-real-transfer/code/main.py:11
↓ 3 callersFunctionstep
(seed, k)
site/figures-math2.js:332
↓ 3 callersMethodstep
(self, params, grads)
phases/03-deep-learning-core/06-optimizers/code/main.py:66
↓ 3 callersMethodstep
(tokens: number, dollars: number)
phases/19-capstone-projects/01-terminal-native-coding-agent/code/ts/src/plan.ts:39
↓ 3 callersFunctionstratified_split
( texts: Sequence[str], labels: Sequence[int], test_frac: float, seed: int )
phases/19-capstone-projects/38-classifier-finetuning/code/main.py:262
↓ 3 callersFunctionstructural_markdown
(doc_id: str, text: str)
phases/19-capstone-projects/64-chunking-strategies-advanced/code/main.py:229
↓ 3 callersFunctionstylegan_forward
Very small 'synthesis' network: three resolution blocks on a 4-channel constant.
phases/08-generative-ai/05-stylegan/code/main.py:48
↓ 3 callersFunctionsummarize
(m: Metrics)
phases/19-capstone-projects/03-realtime-voice-assistant/code/ts/src/orchestrator.ts:32
↓ 3 callersFunctionsummarize
(P: int, M: int)
phases/10-llms-from-scratch/19-dualpipe-parallelism/code/main.py:64
↓ 3 callersFunctionsummarize_results
(results, threshold=0.8)
phases/10-llms-from-scratch/10-evaluation/code/main.py:127
↓ 3 callersFunctionsummarize_step_log
(log: Iterable[StepLog])
phases/19-capstone-projects/44-cosine-lr-warmup/code/main.py:328
↓ 3 callersFunctionsummary
(name, net, x)
phases/04-computer-vision/03-cnns-lenet-to-resnet/code/main.py:113
↓ 3 callersMethodsummary
(self)
phases/19-capstone-projects/37-loading-pretrained-weights/code/main.py:165
↓ 3 callersMethodsummary
(self)
phases/11-llm-engineering/13-production-app/code/production_app.py:67
↓ 3 callersFunctionsynth_image
(kind: str)
phases/12-multimodal-ai/11-chameleon-early-fusion-tokens/code/main.py:72
↓ 3 callersFunctionsynth_text
(batch: int, length: int, vocab: int, seed: int)
phases/19-capstone-projects/61-cross-attention-fusion/code/main.py:210
↓ 3 callersFunctionsynthetic_calibrated
(n: int, seed: int = 0)
phases/19-capstone-projects/73-perplexity-calibration/code/main.py:202
↓ 3 callersFunctiontanh
(v)
phases/08-generative-ai/02-autoencoders-vae/code/main.py:13
↓ 3 callersFunctiontest_gate
(name, n_inputs, data)
phases/03-deep-learning-core/01-the-perceptron/code/perceptron.py:29
↓ 3 callersMethodtoJSONSchema
()
phases/11-llm-engineering/03-structured-outputs/code/main.ts:17
↓ 3 callersMethodto_dict
(self)
scripts/lesson_run.py:59
↓ 3 callersMethodto_dict
(self)
phases/19-capstone-projects/56-iteration-scheduler/code/main.py:41
↓ 3 callersMethodto_dict
(self)
phases/19-capstone-projects/24-plan-execute-control-flow/code/main.py:39
↓ 3 callersMethodto_dict
(self)
phases/19-capstone-projects/27-eval-harness-fixture-tasks/code/main.py:91
↓ 3 callersMethodto_dict
(self)
phases/19-capstone-projects/57-end-to-end-research-demo/code/main.py:103
↓ 3 callersMethodto_json
(self)
phases/19-capstone-projects/42-large-corpus-downloader/code/main.py:91
↓ 3 callersFunctiontoken_f1
(prediction, expected)
phases/10-llms-from-scratch/10-evaluation/code/main.py:40
↓ 3 callersFunctiontokenize
(text)
phases/05-nlp-foundations-to-advanced/16-text-generation-pre-transformer/code/main.py:6
↓ 3 callersFunctiontokenize
(text)
phases/05-nlp-foundations-to-advanced/05-sentiment-analysis/code/main.py:12
↓ 3 callersFunctiontokenize
(s: str)
phases/19-capstone-projects/12-video-understanding-pipeline/code/main.py:24
↓ 3 callersFunctiontool_read_email
()
phases/18-ethics-safety-alignment/15-indirect-prompt-injection/code/main.py:42
↓ 3 callersMethodtotal_count
(self, labels: dict[str, str] | None = None)
phases/19-capstone-projects/28-observability-otel-traces/code/main.py:251
↓ 3 callersFunctiontrace
(M)
phases/08-generative-ai/14-evaluation-fid-clip-score/code/main.py:22
↓ 3 callersFunctiontrace_to_dict
(t: RequestTrace)
phases/19-capstone-projects/87-end-to-end-safety-gate/code/safety_gate.py:236
↓ 3 callersFunctiontrain
(d)
site/lesson-figures.js:230
↓ 3 callersMethodtrain
(self, training_data, epochs=100)
phases/03-deep-learning-core/01-the-perceptron/code/perceptron.py:12
↓ 3 callersMethodtrain
(self)
phases/03-deep-learning-core/10-mini-framework/code/main.py:231
↓ 3 callersFunctiontrain_dpo
(pairs: list[tuple[int, int, float]], beta: float = 0.1, steps: int = 2000, lr: float = 0.05,
phases/18-ethics-safety-alignment/03-direct-preference-optimization-family/code/main.py:77
↓ 3 callersFunctiontrain_one_epoch
(model, loader, criterion, optimizer, device)
phases/03-deep-learning-core/11-intro-to-pytorch/code/pytorch_intro.py:79
↓ 3 callersFunctiontrain_proxy
Fit a linear proxy RM by least squares from n labels of gold + noise.
phases/18-ethics-safety-alignment/02-reward-hacking-goodhart/code/main.py:59
↓ 3 callersFunctiontrain_until
( model: nn.Module, optimizer: torch.optim.Optimizer, scheduler: torch.optim.lr_scheduler._LRSched
phases/19-capstone-projects/47-checkpoint-save-resume/code/main.py:334
↓ 3 callersFunctiontrain_val_test_split
(X, y, train_ratio=0.6, val_ratio=0.2, seed=42)
phases/02-ml-fundamentals/09-model-evaluation/code/evaluation.py:5
↓ 3 callersFunctiontrain_with_schedule
(schedule_fn, schedule_name, data, epochs=300, base_lr=0.05, **kwargs)
phases/03-deep-learning-core/09-learning-rate-schedules/code/main.py:76
↓ 3 callersFunctiontrue_function
(x)
phases/02-ml-fundamentals/10-bias-variance/code/bias_variance.py:6
↓ 3 callersFunctionupdateThemeIcon
()
site/app.js:25
↓ 3 callersFunctionupsample
Nearest-neighbor upsample a HxW grid up to target x target.
phases/08-generative-ai/19-visual-autoregressive-var/code/main.py:97
↓ 3 callersMethodusedTokens
()
phases/11-llm-engineering/05-context-engineering/code/main.ts:55
↓ 3 callersFunctionvalidate_schema_shape
Reject schemas using keywords outside the supported subset.
phases/19-capstone-projects/21-tool-registry-schema-validation/code/main.py:111
↓ 3 callersFunctionvalue
(w, x)
phases/09-reinforcement-learning/07-actor-critic-a2c-a3c/code/main.py:45
↓ 3 callersFunctionvanishing_gradient_experiment
(activation_fn, name, n_layers=10, n_inputs=5)
phases/03-deep-learning-core/04-activation-functions/code/main.py:81
↓ 3 callersFunctionvec
(n: int)
phases/12-multimodal-ai/03-blip2-qformer-bridge/code/main.py:29
↓ 3 callersFunctionverify
(p_idx, answer)
phases/09-reinforcement-learning/12-rl-for-games/code/main.py:35
↓ 3 callersFunctionverify_file_equals
Compare a file in scratch_dir against a file in expected_dir.
phases/19-capstone-projects/27-eval-harness-fixture-tasks/code/main.py:159
↓ 3 callersFunctionverify_shell_exit_zero
Run a shell command in scratch_dir; pass if exit code is zero. The harness uses a simple subprocess call. Production wiring goes through the
phases/19-capstone-projects/27-eval-harness-fixture-tasks/code/main.py:205
↓ 3 callersFunctionwalk_forward_split
(n_samples, n_splits=5, min_train=50)
phases/02-ml-fundamentals/15-time-series/code/time_series.py:89
↓ 3 callersFunctionwarmup_pretrain
A short next-token pretraining pass on the chosen completions so the reference has non-trivial probabilities on the fixture's task structure.
phases/19-capstone-projects/40-dpo-from-scratch/code/main.py:380
↓ 3 callersFunctionwhisper_prompt
(lang="en", task="transcribe", timestamps=True)
phases/07-transformers-deep-dive/10-audio-transformers-whisper/code/main.py:43
↓ 3 callersFunctionzero_grads
(model: nn.Module)
phases/19-capstone-projects/46-gradient-accumulation/code/main.py:84
↓ 2 callersMethod__init__
(self, in_channels=4, dim=64, patch_t=2, patch_h=2, patch_w=2)
phases/04-computer-vision/28-world-models-video-diffusion/code/main.py:7
↓ 2 callersMethod__init__
(self, image_size=16, patch_size=2, in_channels=3, dim=96, depth=4, heads=3)
phases/04-computer-vision/23-diffusion-transformers-rectified-flow/code/main.py:51
↓ 2 callersMethod__init__
(self, image_size=64, patch_size=16, in_channels=3, num_classes=10, dim=192, depth=6, num_hea
phases/04-computer-vision/14-vision-transformers/code/main.py:40
↓ 2 callersMethod__init__
(self, hidden: int, heads: int, max_len: int)
phases/19-capstone-projects/40-dpo-from-scratch/code/main.py:86
↓ 2 callersMethod__init__
( self, registry: MiniRegistry, *, max_attempts: int = 3, concurrency:
phases/19-capstone-projects/23-function-call-dispatcher/code/main.py:132
← previousnext →1,401–1,500 of 8,347, ranked by callers