MCPcopy Create free account

hub / github.com/MakazhanAlpamys/Soup / functions

Functions20,206 in github.com/MakazhanAlpamys/Soup

↓ 9 callersFunctionrolling_kl
Compute KL(p || q) over the union of token vocabularies. Laplace-smoothed: missing tokens in q get ``_EPS`` so divergence stays finite even o
src/soup_cli/utils/drift_alarm.py:141
↓ 9 callersFunctionroute
Decide which adapter serves a request given its fingerprint key. Deterministic: the same ``(policy, request_key)`` always returns the same bu
src/soup_cli/utils/canary_router.py:83
↓ 9 callersFunctionrun_evolve
Evolve ``seeds`` for ``rounds`` rounds; return valid ``EvolvedRow``s. Each round evolves every currently-live instruction; invalid evolutions
src/soup_cli/utils/evolve.py:86
↓ 9 callersFunctionrun_lint
Run the preference-data linter over a sample of ``raw_rows``. ``fmt='auto'`` detects dpo vs. kto from the first row. Any other non-dpo/kto fo
src/soup_cli/utils/data_lint.py:405
↓ 9 callersFunctionsample_uncertain_rows
Read JSONL, pick top-uncertainty rows, write out, return summary.
src/soup_cli/utils/active_sampler.py:233
↓ 9 callersFunctionscan_adapter_weights
Pure-function scan over an in-memory weights map. Returns a ``ScanReport`` with per-layer findings and an overall verdict (``OK`` / ``WARN``
src/soup_cli/utils/adapter_scan.py:381
↓ 9 callersFunctionscore_echo_signal
Mean repetition score across a batch of trajectories. Higher = more trajectory degeneration = closer to echo trap. Returns 0.0 on empty input
src/soup_cli/utils/echo_trap.py:145
↓ 9 callersFunctionshape_reward_fn
Wrap a reward fn to subtract a bounded penalty on a gamed proxy. The inner fn is called exactly once (verbatim) and its reward is reduced by
src/soup_cli/utils/reward_hack_control.py:285
↓ 9 callersFunctionshould_enable_hf_gradient_checkpointing
Whether HF's own gradient checkpointing should be switched on. ``StreamedDecoderLayer`` already wraps every layer in ``checkpoint(use_reentra
src/soup_cli/utils/layer_stream.py:477
↓ 9 callersFunctionsplit_markdown_by_headings
Split markdown ``text`` on ATX headings into section records. Each output record has three keys: ``section`` (heading text, or ``None`` for p
src/soup_cli/utils/data_pipeline.py:715
↓ 9 callersFunctionstrip_reasoning
Strip reasoning-trace blocks from `text` per `parser`. Returns `text` unchanged when `parser` is `None`/empty, when the parser is unknown (de
src/soup_cli/utils/reasoning_parser.py:64
↓ 9 callersFunctionvalidate_bank_name
Canonical kebab-case bank name (case-insensitive).
src/soup_cli/utils/vector_bank.py:75
↓ 9 callersFunctionvalidate_budget
Validate ``budget`` is a positive int within sane bounds. Mirrors v0.41.0 / v0.62.0 numeric validator policy: bool-first rejection, non-int -
src/soup_cli/utils/active_sampler.py:74
↓ 9 callersFunctionvalidate_collection_slug
Validate a HuggingFace collection slug (``owner/slug-hash``).
src/soup_cli/utils/hf.py:160
↓ 9 callersFunctionvalidate_grace_codebook_size
Validate the codebook entry count. Bool-rejected (bool is a subclass of int), positive-int only, capped at :data:`MAX_CODEBOOK_SIZE` so a mis
src/soup_cli/utils/grace_codebook.py:45
↓ 9 callersFunctionvalidate_local_rl_backend
(name: object)
src/soup_cli/utils/local_rl.py:61
↓ 9 callersFunctionvalidate_pack_base
Validate a base name; returns canonical entry from BUNDLED_PACKS.
src/soup_cli/utils/probe_pack.py:193
↓ 9 callersFunctionvalidate_qat_config
Validate QAT configuration and return warnings/errors. Args: quantization: The quantization setting (4bit, 8bit, none). backend:
src/soup_cli/utils/qat.py:59
↓ 9 callersFunctionvalidate_sae_repo
Validate a SAE repo id against the closed allowlist. Case-insensitive: returns the canonical (lower-case) entry that matches.
src/soup_cli/utils/sae_diff.py:128
↓ 9 callersFunctionvalidate_scaling_vector
Per-user scaling vector — non-empty, finite, ≤MAX_VECTOR_DIM.
src/soup_cli/utils/vector_bank.py:115
↓ 9 callersFunctionvalidate_test_kind
Validate a CheckList test kind. Case-insensitive.
src/soup_cli/utils/checklist_dsl.py:56
↓ 9 callersFunctionvalidate_tool_optimizer
(name: object)
src/soup_cli/utils/compile_tools.py:39
↓ 9 callersFunctionvalidate_trainer_plugin_list
Validate a list of trainer-plugin names. Returns canonical names.
src/soup_cli/utils/trainer_plugins.py:106
↓ 9 callersFunctionvalidate_uld_projection_dim
Validate a projection dimensionality (vocab size). Bounds: ``[1, _MAX_VOCAB_SIZE=262144]``. Bool rejected per project bool-as-int policy.
src/soup_cli/utils/uld.py:131
↓ 9 callersFunctionwrite_dataset
Write rows as JSONL under cwd; returns realpath written. Atomic via staged-tempfile + ``os.replace`` (matches v0.43.0 Part D ``copy_bundle_to
src/soup_cli/utils/agent_forge.py:512
↓ 9 callersFunctionwrite_iteration
Persist ``record`` under ``<base_dir>/<iteration_id>/iteration.json``.
src/soup_cli/utils/loop_iteration.py:136
↓ 9 callersMethodzero_
(self)
tests/test_v0534.py:356
↓ 8 callersMethod__init__
(self, frames: int = 2)
tests/test_v07122.py:1105
↓ 8 callersFunction_apply_pattern
Run a pre-resolved pattern against ``text``; hot-path inner loop. Centralised so the per-prompt scoring path in ``_refusal_rate`` avoids a re
src/soup_cli/utils/diagnose/refusal.py:175
↓ 8 callersFunction_build_app
(**overrides)
tests/test_v0536.py:263
↓ 8 callersMethod_cfg
(self, dim=4, size=10)
tests/test_v0719.py:651
↓ 8 callersMethod_entry
(self, config)
tests/test_v07135.py:780
↓ 8 callersFunction_fake_lm
Tiny module shaped like a decoder LM: embed + N layers + norm + head.
tests/test_v07134.py:709
↓ 8 callersFunction_hf_trainer
(model, tmp_path)
tests/test_issue336_deepspeed_lora.py:307
↓ 8 callersFunction_label_index
( raw: object, label_names: List[str] | None, num_labels: int )
src/soup_cli/trainer/classifier.py:146
↓ 8 callersFunction_leg2_scores
Compute leg-2 ``(base_scores, tuned_scores)`` maps over the general suite. Bundled suite names (v0.71.38 — the MCQ/arithmetic *and* the behaviour
src/soup_cli/commands/ship.py:624
↓ 8 callersFunction_make
( name: str, description: str, runtime: str, quant: str, peft: str, spec_decoding: boo
src/soup_cli/utils/deploy_autopilot.py:61
↓ 8 callersFunction_make_adapter
(directory, base, tensors, r=8, alpha=16, extra_config=None)
tests/test_issue305_mixed_rank_arithmetic.py:362
↓ 8 callersFunction_make_bank
(dim=8, users=("alice", "bob"))
tests/test_v07112.py:492
↓ 8 callersFunction_make_base_class
Return a fresh base class for ``make_multipack_trainer_class`` whose instances expose ``train_dataset`` / ``data_collator`` / ``args`` and the
tests/test_v07119.py:177
↓ 8 callersFunction_make_cache_fake_lm
Prefix-sum LM with an explicit past_key_values cache. The last-token logits depend on the FULL prefix (cumulative embedding sum), so a correc
tests/test_v07122.py:65
↓ 8 callersFunction_make_cached_mole_model
Adapter-switching fake with an explicit per-call KV cache. PREFIX-DEPENDENT logits (mirrors the minillm ``_CacheFakeLM`` prefix-sum design):
tests/test_v07122.py:330
↓ 8 callersFunction_make_fake_llama
Build a fake Llama-shaped causal LM (nn.Module) for block-expansion tests.
tests/test_v07112.py:194
↓ 8 callersFunction_make_fake_lm
(vocab: int = 10, hidden: int = 6, seed: int = 0)
tests/test_v07118.py:26
↓ 8 callersFunction_make_model_dir
(tmp_path, *, with_receipt=False)
tests/test_v0713.py:661
↓ 8 callersFunction_merge_adapter
Merge LoRA adapter with base model.
src/soup_cli/commands/export.py:377
↓ 8 callersFunction_opt_str
(args: dict, key: str)
src/soup_cli/mcp_server/registry.py:143
↓ 8 callersFunction_parse_value
Parse a string value into the appropriate Python type.
src/soup_cli/commands/sweep.py:205
↓ 8 callersMethod_patch_tracker
(self, monkeypatch, runs)
tests/test_v07115.py:280
↓ 8 callersFunction_plain
Strip ANSI escape codes for keyword substring assertions.
tests/test_v0539.py:26
↓ 8 callersFunction_prepare_ppo_dataset
Convert dataset rows to PPO format. PPO expects each row to have a 'prompt_text' field (string for tokenization) and optionally an 'answer' f
src/soup_cli/trainer/ppo.py:804
↓ 8 callersMethod_prompts
(self, tmp_path)
tests/test_v07133.py:1563
↓ 8 callersFunction_report
(tmp_path)
tests/test_v0480_part_b.py:481
↓ 8 callersFunction_resolve_checkpoint
Resolve the checkpoint path from --resume argument. If resume == "auto", find the latest checkpoint in the output directory. Otherwise, treat
src/soup_cli/commands/train.py:1946
↓ 8 callersFunction_resolve_model_source
Return ``("local", path)`` or ``("hf", repo_id)`` for ``--model``. Falls through to HF when the local path doesn't exist *and* the value look
src/soup_cli/commands/infer.py:36
↓ 8 callersMethod_rollout
(self, student, teacher, *, use_cache, steps=4)
tests/test_v07122.py:222
↓ 8 callersFunction_roundtrip
(server, tool_name, args)
tests/test_v07128.py:571
↓ 8 callersMethod_rows
(self)
tests/test_v0550.py:245
↓ 8 callersFunction_run_pid
(policy, signals, beta0=None)
tests/test_v07126.py:1196
↓ 8 callersMethod_run_stream_vram_probe
Measure one real step and let THAT decide, not the formula (#349). Raises when the measured peak does not fit. The streaming runtime is
src/soup_cli/trainer/stream_setup.py:620
↓ 8 callersMethod_runner
(self)
tests/test_v07140.py:374
↓ 8 callersFunction_sample_statement
()
tests/test_v0713.py:383
↓ 8 callersFunction_spec
(name, *, allow_mutating, allow_execute=False)
tests/test_v07128.py:471
↓ 8 callersFunction_src
(rel: str)
tests/test_code_review_high.py:207
↓ 8 callersFunction_strip_ansi
Remove ANSI escape codes from Rich-formatted output.
tests/test_inference_advanced.py:14
↓ 8 callersFunction_tiny_causal_lm
A 2-layer Llama built from config — small enough for CPU CI, real enough that HF's decay/no-decay split behaves exactly as it does at 8B.
tests/test_issue336_deepspeed_lora.py:281
↓ 8 callersMethod_vecs
(self, rows)
tests/test_v07136.py:261
↓ 8 callersMethod_write
(self, tmp_path, rows)
tests/test_v07136.py:1031
↓ 8 callersFunction_write_jsonl
Write a list of dicts as JSONL.
src/soup_cli/commands/data.py:680
↓ 8 callersFunction_write_jsonl
(path, rows)
tests/test_v07128.py:119
↓ 8 callersFunction_write_jsonl
(path: Path, rows: list)
tests/test_v0470_part_b.py:493
↓ 8 callersFunction_write_safetensors
Helper: write adapter_model.safetensors + minimal adapter_config.json.
tests/test_v0570_part_a.py:204
↓ 8 callersFunction_write_wav
Write a tiny PCM16 sine WAV using only the stdlib.
tests/test_v07122.py:896
↓ 8 callersFunction_yaml_rejects
Assert ``load_config_from_string`` rejects ``yaml`` naming ``keyword``.
tests/test_v07112.py:24
↓ 8 callersFunctionapi
(path, opts = {})
src/soup_cli/ui/static/app.js:185
↓ 8 callersFunctionapply_nvfp4
Quantise ``model`` with torchao's NVFP4 scheme (Blackwell-only). Live since v0.71.21 (#141). Routes through the same ``torchao.quantization.N
src/soup_cli/utils/advanced_precision.py:305
↓ 8 callersFunctionapply_unfrozen_parameters
Freeze every parameter, then unfreeze those matching ``patterns``. This is the Spectrum (#266) targeted-training mechanism: full fine-tuning
src/soup_cli/utils/freeze.py:76
↓ 8 callersFunctionattach_rl_callbacks
Attach the v0.71.11 live RL callbacks; return how many were attached. Wires (when their schema fields are set): - reward-hacking detector (#2
src/soup_cli/utils/peft_wiring.py:359
↓ 8 callersFunctionattach_weighted_preference_combine
v0.53.11 #68 — wrap inner trainer's ``compute_loss`` for TRUE weighted blend. Replaces the v0.40.1 primary-loss approximation with a per-batch
src/soup_cli/utils/preference_combine.py:204
↓ 8 callersFunctionbuild_compile_prefix_callback
Return a ``CompilePrefixCallback`` for ``output_dir``.
src/soup_cli/utils/peft_wiring.py:668
↓ 8 callersFunctionbuild_multipack_sampler_for_lengths
Build a :class:`MultipackBatchSampler` from per-sample token lengths. Args: lengths: token counts for each sample in the (already tokeniz
src/soup_cli/utils/multipack.py:39
↓ 8 callersFunctionbuild_phone_url
Build the URL that a phone scans. Restrictions: - scheme must be 'http' or 'https' - plain http only allowed on loopback hosts (LAN expos
src/soup_cli/utils/qr_url.py:44
↓ 8 callersFunctioncheck_lock_drift
Compare two locks field-by-field. Returns a ``LockDrift`` report. Only the four content-bearing SHA fields + base_model name affect drift det
src/soup_cli/utils/soup_lock.py:202
↓ 8 callersFunctionchunk_document
Split text into chunks no larger than ``max_chunk_chars``. Splits on paragraph boundaries first; falls back to hard slice when a paragraph al
src/soup_cli/utils/data_forge.py:169
↓ 8 callersFunctionclassify_crash
Return a short tag describing the failure mode, or 'other'.
src/soup_cli/utils/crash.py:76
↓ 8 callersFunctioncode_exec_reward
RLVR code reward: execute completion code, compare output to expected. Security: runs every completion in a subprocess sandbox with a 5s timeout
src/soup_cli/trainer/rewards.py:378
↓ 8 callersFunctioncohens_d
Standardized mean difference (pooled std) between two samples. Degenerate cases (fewer than 2 points in either sample, or zero pooled varianc
src/soup_cli/utils/data_lint.py:161
↓ 8 callersMethodcompute
Aggregate entries by model, computing per-benchmark scores.
src/soup_cli/eval/leaderboard.py:28
↓ 8 callersFunctioncompute_cache_key
Build a deterministic cache key from the input tuple. Callers should pass FULL SHA-256 hex strings (64 chars) for the two digest inputs. The
src/soup_cli/utils/deploy_measure.py:67
↓ 8 callersFunctioncompute_contrast_probe
Derive a calibrated linear probe from two labelled activation sets. ``positive`` / ``negative`` are ``[N, D]`` activation matrices (one row p
src/soup_cli/utils/probe_kernel.py:75
↓ 8 callersFunctioncompute_interference
Relative loss change on A's domain when B is co-loaded. Returns ``(loss_a_with_b - loss_a_alone) / loss_a_alone``. Baseline loss must be > 0
src/soup_cli/utils/interference.py:157
↓ 8 callersMethodcompute_loss
(self, model, inputs, return_outputs=False, **kwargs)
tests/test_v07111.py:743
↓ 8 callersFunctioncompute_priv_leak
Privacy score ∈ ``[0, 1]`` from membership-inference AUC. AUC ≈ 0.5 → no leak → score 1.0. AUC ≥ 0.9 or ≤ 0.1 → full leak → score 0.0. Symmet
src/soup_cli/utils/unlearning_eval.py:204
↓ 8 callersMethodcompute_signal
Compute the aggregate echo signal from a buffer snapshot. Returns ``None`` when no completions are available.
src/soup_cli/utils/echo_trap.py:366
↓ 8 callersFunctionencode_activations
Sparse-ReLU encoder: ``ReLU(activations @ w_enc + b_enc)``. Parameters ---------- activations : ``[N_tokens, D_model]`` numpy array of mo
src/soup_cli/utils/sae_diff.py:159
↓ 8 callersFunctionendpoint_to_rows
Synthesise ``examples_per_endpoint`` rows for one endpoint. A row is one user-question / assistant-tool-call pair. We do NOT make network cal
src/soup_cli/utils/agent_forge.py:400
↓ 8 callersFunctionestimate_model_memory
Estimate model weight memory in GB. Args: model_params_b: Model size in billions of parameters. quantization: '4bit', '8bit', or
src/soup_cli/utils/profiler.py:83
↓ 8 callersFunctionexport_bitnet_gguf
Export a BitNet model as a TQ1_0 (1.58-bit ternary) GGUF (v0.71.20 #134). Two-stage llama.cpp pipeline (reuses the v0.53.1 gguf machinery): 1
src/soup_cli/utils/bitnet.py:183
↓ 8 callersFunctionextract_pref_text
Flatten a chosen/rejected/completion field to plain text. DPO chosen/rejected may legitimately be message LISTS (conversational DPO) rather t
src/soup_cli/utils/data_lint.py:141
↓ 8 callersFunctionfind_optimal_lr
Pick the LR with the steepest negative gradient before divergence. Edge case: when the smoothed loss is monotonically increasing from the sta
src/soup_cli/utils/lr_finder.py:62
← previousnext →601–700 of 20,206, ranked by callers