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
↓ 15 callers
Function
decide_shrink
SHIP iff ``ppl_final / ppl_original - 1 <= tolerance``. ``decide_ship`` (soup ship) would trivially reject every shrink because pruning alway
src/soup_cli/utils/shrink.py:78
↓ 15 callers
Function
detect_moe_model
Detect whether a model uses Mixture of Experts architecture. Checks model config for known MoE indicators.
src/soup_cli/utils/moe.py:39
↓ 15 callers
Function
estimate_logits_bytes
plan P5: logits, not weights, OOM you first on a small card. Measured (GATE 2), not derived: the loss path holds ``LOGITS_BYTES_PER_ELEMENT``
src/soup_cli/utils/layer_stream.py:555
↓ 15 callers
Function
ffd_bin_pack
First-Fit-Decreasing bin packing. Args: lengths: per-sample sequence lengths. max_len: maximum sum of lengths in any bin. Re
src/soup_cli/utils/multipack_sampler.py:85
↓ 15 callers
Method
get_metric_series
Per-row series of a single named metric for a run (v0.55.0). Used by ``soup eval against`` for run-vs-run paired-bootstrap CI. Return
src/soup_cli/experiment/tracker.py:315
↓ 15 callers
Function
init_state
Create the loop.yaml state file. Refuses to clobber unless ``force``.
src/soup_cli/utils/loop_state.py:274
↓ 15 callers
Function
load_branch
(name: str)
src/soup_cli/utils/adapter_branch.py:217
↓ 15 callers
Function
load_history
Read the most recent ``limit`` entries, newest first. Returns an empty list when the file does not exist. Malformed lines are skipped silentl
src/soup_cli/utils/advise_history.py:265
↓ 15 callers
Function
load_reward_fn
Load a reward function by name or from a custom Python file. Args: reward_fn_spec: Either a built-in name ('accuracy', 'format', 'verifia
src/soup_cli/trainer/rewards.py:496
↓ 15 callers
Function
merge_linear
Weighted average per layer over the intersection of names.
src/soup_cli/utils/adapter_merge.py:92
↓ 15 callers
Method
numel
(self)
tests/test_v0534.py:367
↓ 15 callers
Function
plan_blame
Build a leave-one-out ablation plan (v0.57.0). The plan splits the dataset into ``num_shards`` equal shards. ``feasible`` is False when the b
src/soup_cli/utils/blame.py:167
↓ 15 callers
Function
plan_consolidation
Build a `ConsolidationPlan`. Raises on missing shards or bad output.
src/soup_cli/utils/fsdp_consolidate.py:75
↓ 15 callers
Function
resolve_endpoint
Return the HF endpoint, validating ``HF_ENDPOINT`` when set. Strips one trailing slash, rejects non-HTTPS remotes (localhost HTTP is allowed
src/soup_cli/utils/hf.py:81
↓ 15 callers
Function
run_mix_optimizer
Run the BO loop over the validated plan. Args: plan: A :class:`MixOptimizationPlan` from :func:`build_optimization_plan`.
src/soup_cli/utils/data_mix.py:476
↓ 15 callers
Function
validate_steering_name
Validate an operator-supplied steering-vector name. Returns the value unchanged on success. Closed regex allowlist (alphanumeric + ``._-``, l
src/soup_cli/utils/steering.py:117
↓ 14 callers
Function
_deltas
(pairs, threshold=0.05)
tests/test_v07125.py:193
↓ 14 callers
Method
_load
(self, yaml_str)
tests/test_v07136.py:2214
↓ 14 callers
Function
_load_reward_fn
(source: str, tmp_path: Path)
tests/test_v07140.py:139
↓ 14 callers
Function
_make_app
()
tests/test_v0470_part_b.py:488
↓ 14 callers
Function
_requires_train_extra
()
tests/test_issue341_seed_and_fullft.py:269
↓ 14 callers
Function
_write_rollout_module
Write an importable rollout module; return the 'module:fn' spec.
tests/test_v07121.py:603
↓ 14 callers
Function
apply_post_lora_patches
Run post-LoRA surgical patches (v0.39.0 Part D, multi-trainer in v0.40.6). Currently: 3-D fused-MoE expert dropout strip. Architecture-detected v
src/soup_cli/utils/peft_wiring.py:38
↓ 14 callers
Function
build_airgap_bundle
Assemble the bundle. Returns the in-memory manifest. Raises ``ValueError`` on: - output / model_dir / dataset_dir outside cwd (containment)
src/soup_cli/utils/airgap_bundle.py:162
↓ 14 callers
Function
build_format_row
Factory: return the ``format_row`` function appropriate for ``data_cfg``. v0.53.2 #137: when ``training_cfg.reasoning_effort`` is set the gpt-oss
src/soup_cli/data/sft_format.py:33
↓ 14 callers
Function
build_interference_matrix
Build a full N×N interference matrix from per-pair losses. ``losses`` keys are ``(target_adapter, co_loaded_adapter)`` tuples and values are
src/soup_cli/utils/interference.py:195
↓ 14 callers
Function
compute_beta_at_step
Return β at ``step`` for the chosen schedule. Endpoint contract (matches HF lr_scheduler convention): step ≤ 0 → ``beta_start``
src/soup_cli/utils/dpo_variants.py:39
↓ 14 callers
Function
decide_quantization
Pick a quantization tier from model size vs available VRAM. v0.53.1 #82 — when ``prequantized`` is set (e.g. ``"gptq"`` / ``"awq"`` / ``"hqq:
src/soup_cli/autopilot/decisions.py:229
↓ 14 callers
Function
detect_device
Detect available device. Returns (device_string, human_name).
src/soup_cli/utils/gpu.py:97
↓ 14 callers
Function
diagnose
Return a list of findings, ordered by severity (critical first).
src/soup_cli/utils/why.py:181
↓ 14 callers
Method
get_train_dataloader
(self)
tests/test_v07119.py:202
↓ 14 callers
Function
greedy_semdedup
Greedy cosine near-duplicate removal over L2-normalized ``vectors``. Rows are visited in order. The first row of any near-duplicate cluster i
src/soup_cli/utils/semdedup.py:60
↓ 14 callers
Method
list
Return entries filtered by name/tag/base/task.
src/soup_cli/registry/store.py:332
↓ 14 callers
Function
load_advise_dataset
Load a JSONL dataset for advise, with cwd containment + symlink reject. Mirrors v0.53.7 #106 TOCTOU policy: ``os.lstat`` on the raw path BEFORE
src/soup_cli/utils/advise.py:147
↓ 14 callers
Function
migrate_axolotl
Parse an Axolotl YAML config and return a Soup config dict. Returns a dict suitable for config_to_yaml(). Includes a ``_warnings`` key with a
src/soup_cli/migrate/axolotl.py:40
↓ 14 callers
Function
mix_replay
Interleave a seeded sample of ``replay_rows`` into ``new_rows``. Interleaved, NOT appended. ``new + replay`` would put every replay row in on
src/soup_cli/utils/rehearsal.py:71
↓ 14 callers
Function
paired_bootstrap_ci
Paired-bootstrap (lower, upper, mean) of ``candidate - baseline``. Standard paired-sample bootstrap with replacement at the row level (preser
src/soup_cli/utils/eval_gate_hook.py:158
↓ 14 callers
Function
parse_sweep_yaml
Parse a sweep YAML payload.
src/soup_cli/utils/sweep_config.py:54
↓ 14 callers
Function
pick_draft_model
Pick a known-good draft model for the target. A draft the user trained themselves via ``soup draft distill`` (recorded in the local registry,
src/soup_cli/utils/spec_pairing.py:68
↓ 14 callers
Function
prepare_model_for_qat
Prepare a model for Quantization-Aware Training. Inserts fake quantization operators into the model so that forward passes simulate the effec
src/soup_cli/utils/qat.py:38
↓ 14 callers
Function
render_recipe_yaml
Render a ready-to-train ``soup.yaml`` for ``profile`` + ``base``. Returns the YAML *text*; callers handle write-out with their own containmen
src/soup_cli/utils/deploy_autopilot.py:190
↓ 14 callers
Function
resolve_report_to
Resolve the HF Trainer `report_to` value from CLI flags + --tracker. Mutual-exclusion: only one of (wandb, tensorboard, tracker) may be set.
src/soup_cli/utils/trackers.py:351
↓ 14 callers
Function
to_anthropic
Convert an OpenAI chat-completions payload to Anthropic Messages shape. - The (single) ``system`` message becomes the top-level ``system`` field.
src/soup_cli/utils/anthropic_messages.py:54
↓ 14 callers
Function
validate_battery_name
Validate a battery name. Case-insensitive; returns canonical form.
src/soup_cli/utils/behavior_battery.py:94
↓ 14 callers
Function
validate_judge_api_base
SSRF protection for judge API base URL.
src/soup_cli/eval/judge.py:129
↓ 14 callers
Function
validate_vision_grpo_compat
Schema-time gate for ``vision_grpo=True``. Rejects on: - task not in {'grpo', 'ppo'} (vision RL is only meaningful for RL); - modality !=
src/soup_cli/utils/prm.py:112
↓ 14 callers
Function
validate_webhook_url
SSRF-hardened webhook URL validator (returns the canonical URL). ``allow_private_hosts`` defaults to ``False`` — the safe webhook policy that
src/soup_cli/utils/webhooks.py:50
↓ 13 callers
Function
_build_streamed_cpu
(tmp_path, n_layers=2, tie=True, buffers=2)
tests/test_v07200.py:1015
↓ 13 callers
Function
_completions
(*contents)
tests/test_v07140.py:148
↓ 13 callers
Function
_create_test_app
Build a test FastAPI app via _create_app (lazy fastapi import).
tests/test_v0537.py:875
↓ 13 callers
Function
_fake_grpo_trainer
(beta=0.02)
tests/test_v07126.py:45
↓ 13 callers
Function
_make_adapter
Write a minimal LoRA-shaped adapter (safetensors + config).
tests/test_v0714.py:305
↓ 13 callers
Function
_make_files
(tmp_path, names)
tests/test_v0480_part_b.py:71
↓ 13 callers
Function
_make_model_dir
(tmp_path: Path, name: str = "model")
tests/test_v0600_part_f.py:24
↓ 13 callers
Function
_require_str
(args: dict, key: str)
src/soup_cli/mcp_server/registry.py:134
↓ 13 callers
Method
_rows
(self, tag, count)
tests/test_v07136.py:2376
↓ 13 callers
Method
_setup_dbs
(self, tmp_path, monkeypatch)
tests/test_registry.py:742
↓ 13 callers
Function
_tiny_attn_model
A tiny real-torch model with q/k/v/o projections + an MLP linear.
tests/test_v07121.py:107
↓ 13 callers
Function
_write_tiny_safetensors
Synthesize a 2-layer Llama-shaped model dir (numpy safetensors). No torch / no download — exercises the streaming scanner end-to-end.
tests/test_v07123.py:50
↓ 13 callers
Function
apply_ebft_loss
Energy-Based Fine-Tuning loss kernel (v0.53.2 #135). EBFT treats per-token logits as energies (lower = more probable) and penalises high-ener
src/soup_cli/utils/ebft_gdpo.py:298
↓ 13 callers
Function
attach_multipack_state
Stash the multipack sampler config on ``trainer``.
src/soup_cli/utils/multipack_trainer.py:266
↓ 13 callers
Function
build_crash_bundle
Build the bundle dict. Always returns; never raises.
src/soup_cli/utils/crash.py:185
↓ 13 callers
Function
build_forge_plan
Validate inputs and return an immutable plan.
src/soup_cli/utils/data_forge.py:279
↓ 13 callers
Function
build_reward_hack_callback
Build the live reward-hacking HF Trainer callback (v0.71.11 #235). Lifts the v0.70.0 ``NotImplementedError`` stub. Validates every input at t
src/soup_cli/utils/reward_hacking.py:589
↓ 13 callers
Function
build_rl_checkpoint_callback
Build the live mid-epoch RL checkpoint callback (v0.71.11 #238). Lifts the v0.70.0 ``NotImplementedError`` stub. ``output_dir`` is the traine
src/soup_cli/utils/rl_checkpoint.py:459
↓ 13 callers
Function
build_steering_vector
Fit a steering vector from contrastive pairs and persist it. Validates method + name FIRST (so a typo surfaces before the model load), then r
src/soup_cli/utils/steering.py:401
↓ 13 callers
Function
check_eos_in_labels
The #1 'model never stops generating' bug. MAJOR when >=50% of rows have at least one assistant turn whose trained span never trains an EOS/EO
src/soup_cli/utils/data_doctor.py:384
↓ 13 callers
Function
check_license_compat
Decide whether a list of licenses can be combined in one merged adapter. Decision rule: - Normalise + dedup the input. - If any license i
src/soup_cli/utils/license_matrix.py:139
↓ 13 callers
Function
classify_task
Classify the task using keyword + structural signals. Pure-Python, no ML. Returns one of ``TASK_CATEGORIES``. The goal string (when supplied
src/soup_cli/utils/advise.py:307
↓ 13 callers
Function
conformal_threshold
Return the alpha-quantile of the calibration scores. With ``alpha=0.1`` and a well-calibrated set of judge confidence scores in ``[0, 1]``, p
src/soup_cli/eval/calibrate.py:259
↓ 13 callers
Function
extract_license_from_adapter
Best-effort license auto-detection for an adapter / model directory (#187). Resolution order: ``adapter_config.json`` -> ``config.json`` -> ``REA
src/soup_cli/utils/license_matrix.py:350
↓ 13 callers
Function
extract_message_fields
Walk ``template``'s Jinja AST and return the set of message fields. Detects both attribute-style ``{{ m.role }}`` and subscript-style ``{{ m[
src/soup_cli/utils/jinja_analyzer.py:54
↓ 13 callers
Function
fake_torch
Patch ``torch.cuda`` in place; the resolver imports torch lazily.
tests/test_issue385_stream_dtype.py:59
↓ 13 callers
Function
gen
(prompt: str)
tests/test_v0716.py:505
↓ 13 callers
Function
generate_canaries
K unique canaries, deterministic in ``seed``.
src/soup_cli/utils/canary.py:104
↓ 13 callers
Function
get_bundle
Return the bundle metadata for `name`, or raise ValueError.
src/soup_cli/utils/demo_bundles.py:94
↓ 13 callers
Function
is_under
Return True when ``path`` resolves inside ``base``.
src/soup_cli/utils/paths.py:22
↓ 13 callers
Function
load_spec_file
Load a YAML/JSON spec from disk with cwd containment + size cap. Symlinks are rejected (TOCTOU defence, mirrors v0.45.0 Part E policy).
src/soup_cli/utils/agent_forge.py:467
↓ 13 callers
Function
make_cuda_probe_fn
Build a real CUDA ``probe_fn`` for :func:`pick_batch_size`. Returns a closure that, given a candidate batch size ``B``, runs ONE forward + ba
src/soup_cli/utils/batch_probe.py:296
↓ 13 callers
Method
named_modules
(self, prefix="")
tests/test_part_c.py:164
↓ 13 callers
Method
on_train_begin
(self, args: Any, state: Any, control: Any = None, **kwargs: Any)
src/soup_cli/utils/lisa.py:122
↓ 13 callers
Function
prepare_distill_dataset
Prepare a distillation dataset from prompt-heavy traces (v0.71.13 #226). For each prompt in ``plan.traces_path`` the teacher model is called once
src/soup_cli/utils/prompt_distill.py:217
↓ 13 callers
Function
private_key_from_pem
Parse a PEM string/bytes into an ed25519 private key. Rejects non-ed25519 keys (RSA / EC / etc.) with a clear ``ValueError`` so operators can
src/soup_cli/utils/signing.py:81
↓ 13 callers
Function
register_draft
Record ``target -> draft_dir`` so ``serve --auto-spec`` can find it. The target key is lower-cased to match ``spec_pairing.pick_draft_model``'s
src/soup_cli/utils/draft.py:378
↓ 13 callers
Function
render_soup_gate_workflow
Render the workflow YAML body. Deterministic, no I/O. Every path is validated to stay under the repo root and shell-quoted before it reaches
src/soup_cli/utils/ci_workflow.py:114
↓ 13 callers
Function
run_checklist_spec
Run all tests in ``spec`` against operator-supplied responses. ``evidence`` maps each test ``name`` to the list of responses (one per prompt)
src/soup_cli/utils/checklist_dsl.py:353
↓ 13 callers
Function
run_nightly_train
Harvest the latest DPO pairs and train them (v0.71.13 #229). The flow: read ``last_train_at`` from the SQLite ``state`` table; if a prior tra
src/soup_cli/utils/local_rl.py:497
↓ 13 callers
Function
search_recipes
Search recipes by keyword, task, or model size.
src/soup_cli/recipes/catalog.py:29
↓ 13 callers
Method
snapshot
Return a point-in-time copy of all metrics.
src/soup_cli/utils/metrics.py:91
↓ 13 callers
Function
synth_probe_baselines
Return {zero_shot, few_shot, rag} baseline scores in ``[-1.0, 1.0]``. When ``model`` is supplied (and torch + the model load succeed) this runs
src/soup_cli/utils/advise.py:899
↓ 13 callers
Function
tokenize_raft_example
Tokenise a composed RAFT example into a pre-tokenised training row. Returns ``{input_ids, attention_mask, labels, loss_weights}`` (python lis
src/soup_cli/utils/raft.py:193
↓ 13 callers
Function
validate_datasets
Validate dataset paths: containment + dedup + bounds. Args: raw: Sequence of dataset paths (relative or absolute). Returns:
src/soup_cli/utils/data_mix.py:189
↓ 13 callers
Function
validate_db_path
(path: object)
src/soup_cli/utils/local_rl.py:135
↓ 13 callers
Function
validate_edit_method
Normalise + validate an edit-method name (case-insensitive).
src/soup_cli/utils/knowledge_edit.py:91
↓ 13 callers
Function
wer
Word error rate — word-level edit distance / reference word count.
src/soup_cli/utils/asr_metrics.py:114
↓ 12 callers
Function
_auth_headers
Return auth headers with the current UI token.
tests/test_ui_chat.py:8
↓ 12 callers
Function
_auth_headers
Return auth headers with the current UI token.
tests/test_ui.py:10
↓ 12 callers
Method
_get_conn
(self)
src/soup_cli/experiment/tracker.py:124
↓ 12 callers
Function
_load_cov_corpus
Load a covariance corpus (JSONL or plain text) for ``--cov-corpus`` (#250). Each JSONL object contributes its ``text`` / ``prompt`` / ``content``
src/soup_cli/commands/edit.py:34
↓ 12 callers
Function
_make_adapter
(tmp_path, name, license_id=None)
tests/test_v0712.py:809
← previous
next →
201–300 of 20,206, ranked by callers