Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/MakazhanAlpamys/Soup
/ functions
Functions
20,206 in github.com/MakazhanAlpamys/Soup
⨍
Functions
20,206
◇
Types & classes
3,423
↳
Endpoints
121
↓ 8 callers
Function
fit_position_bias
Estimate the judge's preference for the first slot. Returns a coefficient in ``[-1, 1]``: - 0.0 → no position bias (judge always agrees with
src/soup_cli/eval/calibrate.py:201
↓ 8 callers
Function
freeze_model_layers
Freeze the bottom layers of a model. Args: model: A PyTorch model with named_parameters(). freeze_layers: Freeze the first N laye
src/soup_cli/utils/freeze.py:29
↓ 8 callers
Method
generate
(self, **kwargs)
tests/test_v0536.py:404
↓ 8 callers
Function
get_auth_token
Return the current auth token (for printing at startup).
src/soup_cli/ui/app.py:56
↓ 8 callers
Function
get_hf_api
Return a configured ``HfApi`` instance. Lazy-imports ``huggingface_hub`` so the rest of the CLI works without the optional dependency. Raises
src/soup_cli/utils/hf.py:174
↓ 8 callers
Method
get_run
(self, run_id)
tests/test_v0480_part_a.py:520
↓ 8 callers
Function
infer_chat_template
Map a Soup config format to an Ollama template name. Returns template name (key into OLLAMA_TEMPLATES) or None if unknown.
src/soup_cli/utils/ollama.py:144
↓ 8 callers
Function
interleave_orpheus_codes
Interleave the 3 SNAC codebooks into Orpheus token indices. ``coarse``/``medium``/``fine`` are the per-frame code sequences at the SNAC 1/2/4
src/soup_cli/utils/tts_codec.py:91
↓ 8 callers
Function
kl_divergence
KL(P || Q) over discrete distributions derived from logits. Both inputs must be the same length and contain finite floats. Returns a non-nega
src/soup_cli/eval/calibrate.py:62
↓ 8 callers
Method
list_runs
Return list of runs ordered by created_at desc.
src/soup_cli/experiment/tracker.py:271
↓ 8 callers
Function
load_mix_recipe
Load + validate a previously-written mix recipe. Used by ``soup data mix --apply <recipe.yaml>`` to splice the recommended mixture into a tar
src/soup_cli/utils/data_mix.py:699
↓ 8 callers
Function
load_pretokenized_dataset
Load a pre-tokenized Arrow dataset directory. Verifies cwd containment, rejects symlinks at the target path (TOCTOU — mirrors v0.33.0 #22 / v
src/soup_cli/utils/data_pipeline.py:506
↓ 8 callers
Function
load_probes
Load a probe JSONL file with one ``{prompt: str}`` row per line. Cwd-contained + symlink-rejected + size-capped. Skips malformed rows silentl
src/soup_cli/utils/edit_diff.py:103
↓ 8 callers
Function
load_recipe_yaml
Load a recipe YAML from a path under cwd.
src/soup_cli/utils/recipe_dag.py:199
↓ 8 callers
Function
load_sae_weights
Load a safetensors SAE checkpoint with cwd-containment + symlink reject. Returns a dict with at least ``W_enc`` (encoder matrix). Other keys
src/soup_cli/utils/sae_diff.py:337
↓ 8 callers
Function
load_suite
Load and validate an eval suite from disk.
src/soup_cli/eval/gate.py:106
↓ 8 callers
Function
math_verify_reward
RLVR math reward: compare extracted numeric answer to expected. Security: never uses ``eval()``. Only numeric literals that match a strict re
src/soup_cli/trainer/rewards.py:259
↓ 8 callers
Function
nccl_bandwidth_check
Compare measured bandwidth against the reference table. Returns a dict with `expected`, `measured`, `ratio`, and `status`. - status="OK"
src/soup_cli/utils/profiling_v0_43.py:173
↓ 8 callers
Method
on_epoch_end
Run the eval gate, if configured.
src/soup_cli/monitoring/callback.py:289
↓ 8 callers
Function
pack_entry
Pack a registry entry as a ``.can`` tarball. Args: entry_id: registry entry id (full id or prefix). out_path: destination ``.can`
src/soup_cli/cans/pack.py:29
↓ 8 callers
Function
pairwise_compare
Return 0 (A preferred), 1 (B preferred), or -1 (tie / disagreement). When ``swap`` is True the pair is judged in BOTH orders (A,B and B,A) and a
src/soup_cli/eval/judge.py:389
↓ 8 callers
Function
parse_checklist_spec
Parse a dict (from YAML) into a frozen ``CheckListSpec``.
src/soup_cli/utils/checklist_dsl.py:216
↓ 8 callers
Function
parse_history_jsonl
Validate and normalise a sequence of curriculum-history rows. Used by ``soup runs curriculum-curve <run_id>`` to load the JSONL written by th
src/soup_cli/utils/curriculum_dynamic.py:404
↓ 8 callers
Function
parse_json_array
Parse a JSON array from LLM output, handling markdown code blocks. Handles: - Clean JSON arrays - Markdown code fences (```json ... ```)
src/soup_cli/data/providers/_utils.py:6
↓ 8 callers
Function
percentile
Linear-interpolated percentile. `pct` is in [0, 100]. Returns None on empty input. Rejects non-finite samples and bool.
src/soup_cli/utils/tail_latency.py:44
↓ 8 callers
Function
prepare_hf_resume
Pull the latest checkpoint branch from HF into ``output_dir``. Returns the local path of the checkpoint directory, or None if there's nothing
src/soup_cli/monitoring/hf_push.py:267
↓ 8 callers
Function
prune_empty_param_groups
Drop parameter groups that hold no parameters. Returns how many went. HF's ``create_optimizer`` always emits two groups — decay and no-decay.
src/soup_cli/utils/deepspeed.py:300
↓ 8 callers
Function
prune_model_layers
Drop decoder layers ``[start, start + block_size)`` in place. Slices ``model.model.layers`` and patches ``config.num_hidden_layers``. The fir
src/soup_cli/utils/shrink.py:188
↓ 8 callers
Function
read_num_experts
Probe ``config.json`` for the expert count (None when absent). Checks ``text_config.num_local_experts`` (HF Llama4TextConfig), then top-level
src/soup_cli/utils/delinearize_llama4.py:186
↓ 8 callers
Function
refuse_if_data_parallel
Refuse layer streaming when HF Trainer would wrap the model in DataParallel. ``TrainingArguments`` sets ``_n_gpu = torch.cuda.device_count()`` fo
src/soup_cli/trainer/stream_setup.py:71
↓ 8 callers
Function
register_plugin
Register a plugin. Idempotent for an identical spec; rejects re-registration with a different version or plugin object.
src/soup_cli/plugins/__init__.py:137
↓ 8 callers
Function
render_custom_template_dir
Render a custom Space template directory. Returns a dict mapping in-repo filename → rendered content. ``{MODEL_REPO}`` placeholder is replace
src/soup_cli/utils/hf_space.py:92
↓ 8 callers
Function
render_install_plan
Render a reproducible install plan from a lock (v0.71.1 #209). Two formats: - ``"uv-pip"`` — a commented header (python / platform / CUDA) f
src/soup_cli/utils/env_lock.py:345
↓ 8 callers
Function
render_mix_recipe_yaml
Render an applied-mixture recipe snippet for human review. Produces a YAML fragment suitable for splicing into ``soup.yaml`` under ``data:``.
src/soup_cli/utils/data_mix.py:594
↓ 8 callers
Function
render_ship_panel
Rich ``Panel`` for the terminal — a one-screen verdict card.
src/soup_cli/utils/ship_verdict.py:544
↓ 8 callers
Function
resolve_gradient_checkpointing
Resolve a gradient_checkpointing setting into TrainingArguments kwargs. Only returns keys that HuggingFace's ``TrainingArguments`` actually accep
src/soup_cli/utils/gradient_ckpt.py:60
↓ 8 callers
Function
resolve_k
Pick the cluster count. An explicit int is honoured (clamped to ``[1, n_rows]``). ``"auto"`` uses the standard sqrt heuristic, capped at :dat
src/soup_cli/utils/topics.py:50
↓ 8 callers
Function
resolve_replay_count
How many replay rows to add so replay is ``ratio`` of the FINAL set. Solving ``n_replay / (n_new + n_replay) = r`` gives ``n_replay = r/(1-r)
src/soup_cli/utils/rehearsal.py:57
↓ 8 callers
Function
resolve_snapshot_path
Return realpath of `<cwd>/<base_dir>/<run_id>.snapshot.pickle`. Rejects values that escape cwd. Mirrors v0.34.0 `resolve_trace_path`.
src/soup_cli/utils/profiling_v0_43.py:55
↓ 8 callers
Function
resolve_trace_path
Compute the full Chrome trace path under ``output_dir/profiles``. Validation of ``run_id`` rejects path separators, null bytes, and bare pare
src/soup_cli/utils/profiling.py:63
↓ 8 callers
Function
rotate_if_needed
Rotate ``<path>`` -> ``<path>.1`` when file size exceeds ``cap_bytes``. Symlink at the backup path is rejected via direct ``os.lstat`` (no lexist
src/soup_cli/utils/audit_log.py:131
↓ 8 callers
Function
run_bisect
Find the first failing checkpoint via binary search. ``eval_fn(checkpoint_id)`` MUST return ``True`` when the checkpoint passes (no regressio
src/soup_cli/utils/adapter_bisect.py:174
↓ 8 callers
Function
run_ra_dit
Chain the two RA-DIT stages: retriever → auto-link → generator. Args: retriever_config: Path (under cwd) to the stage-1 embedding recipe.
src/soup_cli/utils/ra_dit_run.py:292
↓ 8 callers
Method
save_checkpoint
Write a checkpoint for ``step``; returns the directory path. Pure of HF Trainer state — exercised directly by tests with a tiny peft
src/soup_cli/utils/rl_checkpoint.py:299
↓ 8 callers
Function
save_governor
Persist a governor's state to ``store``.
src/soup_cli/utils/edit_governor.py:564
↓ 8 callers
Function
score_memorization
Score memorization on a sample of training rows. Each row must contain a ``text`` (or ``content`` / ``prompt``) string field. Rows lacking te
src/soup_cli/utils/diagnose/memorization.py:70
↓ 8 callers
Function
score_mode_collapse
Score 1.0 - mean pairwise overlap across K completions per prompt.
src/soup_cli/utils/diagnose/mode_collapse.py:45
↓ 8 callers
Method
set_active_user
Select the active user for the decode hook. Returns ``True`` if known. The selection is request-local (stored in a ``ContextVar``) so a
src/soup_cli/utils/vector_bank.py:415
↓ 8 callers
Function
sign_payload
Sign ``payload`` with an ed25519 private key; return a hex signature.
src/soup_cli/utils/signing.py:125
↓ 8 callers
Function
smooth_signal
Smooth a scalar signal. ``none`` → new; ``ema`` → windowed EMA (alpha = ``_EMA_ALPHA`` = 0.5) folded over the RETAINED window (oldest→newest) then
src/soup_cli/utils/reward_hack_control.py:157
↓ 8 callers
Function
snapshot_env
Capture the current Python/CUDA/package versions as an ``EnvLock``.
src/soup_cli/utils/env_lock.py:214
↓ 8 callers
Function
split_steps
Split a completion into reasoning steps (newline heuristic, v1). Drops empty / whitespace-only lines, strips each line, truncates each step t
src/soup_cli/utils/prm_reward.py:64
↓ 8 callers
Method
start
(self)
src/soup_cli/utils/data_mix.py:342
↓ 8 callers
Method
stats
(self)
src/soup_cli/utils/layer_stream_runtime.py:1418
↓ 8 callers
Function
trigger_path
Return the absolute trigger-file path for `output_dir`. Path containment: the resolved trigger path must stay under cwd to prevent a crafted
src/soup_cli/utils/checkpoint_trigger.py:18
↓ 8 callers
Function
validate_anthropic_payload
Raise if the Anthropic payload is malformed.
src/soup_cli/utils/anthropic_messages.py:187
↓ 8 callers
Function
validate_benchmark_name
Normalise + validate a benchmark name (case-insensitive).
src/soup_cli/utils/unlearning_eval.py:81
↓ 8 callers
Function
validate_benchmark_name
Validate a capability-benchmark name. Returns canonical form.
src/soup_cli/utils/capability_suite.py:116
↓ 8 callers
Function
validate_distill_strategy
Return canonical lowercase strategy name.
src/soup_cli/utils/prompt_distill.py:43
↓ 8 callers
Function
validate_distributed_curriculum
Cross-validator for the distributed footgun. v0.53.5 #114: :class:`monitoring.curriculum_callback.DynamicCurriculumCallback` wires the ``all_
src/soup_cli/utils/curriculum_dynamic.py:299
↓ 8 callers
Function
validate_fsdp2_compile_config
Validate FSDP2 + ``torch.compile`` combination. Args: use_compile: Whether ``training.use_fsdp2_compile`` is enabled. fsdp_preset
src/soup_cli/utils/fsdp.py:157
↓ 8 callers
Function
validate_generations
(value: object)
src/soup_cli/utils/cmaes_merge.py:89
↓ 8 callers
Function
validate_license_override_reason
Sanity-check the ``--license-override <reason>`` payload. Defends against `--license-override y` style placeholder bypasses: the reason must
src/soup_cli/utils/license_matrix.py:370
↓ 8 callers
Function
validate_max_iters
Return ``value`` when an in-bounds positive int. Rejects bool / non-int / <=0 / > ``MAX_COMPILE_ITERS``.
src/soup_cli/utils/prompt_compile.py:100
↓ 8 callers
Function
validate_nvfp4_compat
Schema-time gate for ``nvfp4=True``. NVFP4 is Blackwell-only and CUDA-only; the *runtime* SM-capability check fires at trainer-construction t
src/soup_cli/utils/advanced_precision.py:141
↓ 8 callers
Function
validate_optimizer_name
Schema-load-time validator for ``training.optimizer``. Returns the normalised name (lower-cased) on success, raises ValueError with an action
src/soup_cli/utils/optimizer_zoo.py:96
↓ 8 callers
Function
validate_pretrain_anchor_weight
Validate the pretrain-anchor loss coefficient. Range [0.0, 1.0]. 0.0 = no anchor; small positive (e.g. 0.1) adds the SFT-on-pretrain term as
src/soup_cli/utils/minillm.py:91
↓ 8 callers
Function
validate_rounds
Validate the ``rounds`` count: int in [1, 100], bool rejected.
src/soup_cli/utils/iterative_dpo.py:40
↓ 8 callers
Function
validate_save_every_steps
Bool-rejecting + bounded validator for save_every_steps. Range: ``[1, _MAX_SAVE_EVERY_STEPS=10_000_000]``.
src/soup_cli/utils/rl_checkpoint.py:49
↓ 8 callers
Function
validate_spec_path
Validate an OpenAPI / MCP / GraphQL spec path (json / yaml / yml only).
src/soup_cli/utils/compile_tools.py:61
↓ 8 callers
Function
validate_tracker_name
Validate and lowercase a `report_to` tracker name. Returns the canonical lower-cased name. Raises ValueError on invalid input. Mirrors v0.41.
src/soup_cli/utils/trackers.py:42
↓ 8 callers
Function
validate_unlearn_compat
Schema-time gate for ``task='unlearn'``. Rejects: - non-string / bool args (defence-in-depth, mirrors v0.52.0 ``validate_classifier_com
src/soup_cli/utils/unlearning.py:145
↓ 8 callers
Function
write_mix_recipe
Atomically write the rendered recipe to ``output_path``. Containment + TOCTOU symlink rejection mirrors v0.46.0 Part A ``write_recipe`` and v
src/soup_cli/utils/data_mix.py:638
↓ 8 callers
Function
write_vscode_launch
Write `<cwd>/<target_dir>/launch.json`. Returns the absolute path written. Raises ValueError on containment violation. Raises FileExistsE
src/soup_cli/utils/vscode_setup.py:57
↓ 7 callers
Method
_build_judge_or_reward
Resolve the OnlineDPO reward signal: judge OR reward_model. Precedence: the test seam, then the judge URL, then a reward model. The s
src/soup_cli/trainer/online_dpo.py:418
↓ 7 callers
Function
_build_template_prompt
Build generation prompt from a domain template.
src/soup_cli/commands/generate.py:607
↓ 7 callers
Method
_candidate
(self, name: str, score: float = 0.95)
tests/test_trainer_coverage_v035.py:490
↓ 7 callers
Function
_cfg
(**training)
tests/test_issue349_measured_fit.py:52
↓ 7 callers
Method
_chat
(self, tag, count)
tests/test_v07136.py:2530
↓ 7 callers
Function
_clean
ANSI-strip + collapse whitespace. Rich colourises flag names (``--card`` -> ESC-split fragments) and wraps at the CI terminal's narrow width,
tests/test_v07135.py:27
↓ 7 callers
Function
_collect_prompts
Collect prompts from file and/or CLI arguments.
src/soup_cli/commands/diff.py:185
↓ 7 callers
Method
_composed
(self)
tests/test_v07110.py:179
↓ 7 callers
Function
_compute_metrics
Compute comparison metrics between two responses.
src/soup_cli/commands/diff.py:323
↓ 7 callers
Method
_dataset
(self, tmp_path, count=10)
tests/test_v07136.py:1790
↓ 7 callers
Method
_exposures
Build exposures landing on EXACT percentiles via 100 controls.
tests/test_v07136.py:1630
↓ 7 callers
Function
_fake_llama
Build a tiny Llama-shaped nn.Module with mlp.down_proj per layer.
tests/test_v0719.py:439
↓ 7 callers
Function
_fire_on_save
Drive one ``on_save`` the way HF's CallbackHandler does. ``args`` / ``state`` are the two attributes the callback reads, so a SimpleNamespace
tests/test_v07300.py:600
↓ 7 callers
Function
_generate_combinations
Generate parameter combinations based on strategy.
src/soup_cli/commands/sweep.py:227
↓ 7 callers
Function
_generate_response
Generate a response from the model.
src/soup_cli/commands/serve.py:1443
↓ 7 callers
Function
_is_transposed_proj
Return True for a GPT-2 ``Conv1D`` down-projection. transformers' ``Conv1D`` stores a transposed weight (``[in, out]`` rather than nn.Linear'
src/soup_cli/utils/edit_kernels.py:56
↓ 7 callers
Function
_kl_callback
(tmp_path, buffer, *, task="grpo", signals=("info_rm",), policy=None)
tests/test_v07126.py:893
↓ 7 callers
Function
_load_calibration_texts
Load calibration texts from JSONL file.
src/soup_cli/commands/export.py:846
↓ 7 callers
Function
_load_draft_model
Load a smaller draft model for speculative decoding.
src/soup_cli/commands/serve.py:1390
↓ 7 callers
Function
_load_evidence
Load an evidence JSON (cwd-contained, symlink-rejected, size-capped). Opens with ``O_NOFOLLOW`` (where available) and fstats the open fd so a
src/soup_cli/commands/diagnose.py:82
↓ 7 callers
Function
_lora
(target_modules)
tests/test_issue392_mlx_target_keys.py:26
↓ 7 callers
Method
_make_mock_model
Create a mock model with named_parameters.
tests/test_freeze_training.py:97
↓ 7 callers
Method
_make_mock_model_and_tokenizer
Create mock model and tokenizer for testing _generate.
tests/test_infer.py:278
↓ 7 callers
Function
_measure_noise_floor
Re-run the BASE model ``runs`` times and return the measured spread. Greedy decoding is not deterministic on GPU: measured on an H100, the same
src/soup_cli/commands/ship.py:701
↓ 7 callers
Function
_parse_bounds
Return ((floor_major, floor_minor), (ceiling_major, ceiling_minor)).
tests/test_requires_python_bound.py:36
↓ 7 callers
Method
_plan
(predicted, available)
tests/test_issue349_measured_fit.py:178
← previous
next →
701–800 of 20,206, ranked by callers