mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 18:44:41 +01:00
Maintainer decisions for epic #223 (2026-10-15): - Q1: `leace` is a deprecated alias of the Fisher LDA direction. It keeps its numerical behaviour, warns once per public resolution with a DeprecationWarning naming `fisher_lda` and `leace_exact`, and will be removed in a future minor release. - Q4: a collateral FAIL blocks both the model card and any Hub push of modified weights or adapters on every path (pipeline, export_run, both CLIs, Concept Lab, the Hub UI and tourney uploads), checked before any network call. `--allow-collateral-fail REASON` (and the matching API argument and UI field) overrides the block and stamps the FAIL and reason into the card, checkpoint metadata and provenance. Local save and export are never blocked. - Q5: research-tier packs no longer carry publication or local-export restrictions; the tier is provenance only and Q4 applies to every pack. - Steering defaults are removal-first: `steer` defaults to alpha -1 and the default dose ladder is non-positive. Positive doses stay available explicitly; `project` keeps its positive removal strength. - Q3 (gate modes) and Q7 (dense only, follow-up #310) are unchanged and documented. Refs #223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
"""Available direction methods and their canonical identifiers."""
|
|
|
|
import warnings
|
|
|
|
DIRECTION_METHODS = {
|
|
"diff_means": "diff_means",
|
|
"svd": "svd",
|
|
"fisher_lda": "fisher_lda",
|
|
"leace": "fisher_lda",
|
|
"leace_exact": "leace_exact",
|
|
}
|
|
|
|
LEACE_ALIAS_NOTICE = (
|
|
"leace is a deprecated alias for the Fisher LDA direction (fisher_lda); "
|
|
"exact erasure is leace_exact. The leace alias will be removed in a future minor release. "
|
|
"The pipeline uses the leace_exact removal direction, not the full affine eraser."
|
|
)
|
|
|
|
|
|
def available_direction_methods() -> tuple[str, ...]:
|
|
"""Return available CLI/API ids, including compatibility aliases."""
|
|
return tuple(DIRECTION_METHODS)
|
|
|
|
|
|
def effective_direction_method(
|
|
requested: str, *, warn_alias: bool = True, stacklevel: int = 2,
|
|
) -> str:
|
|
"""Resolve an id, warning at public entry points only for the legacy alias.
|
|
|
|
Internal validation and repeated resolution pass ``warn_alias=False`` so a
|
|
single user selection does not produce warnings for every layer or fold.
|
|
"""
|
|
if requested == "leace" and warn_alias:
|
|
warnings.warn(LEACE_ALIAS_NOTICE, DeprecationWarning, stacklevel=stacklevel)
|
|
if requested == "som":
|
|
raise ValueError(
|
|
"direction method 'som' is not available: "
|
|
"obliteratus.analysis.som_directions is not shipped; "
|
|
f"choose from {', '.join(available_direction_methods())}."
|
|
)
|
|
try:
|
|
return DIRECTION_METHODS[requested]
|
|
except KeyError:
|
|
raise ValueError(
|
|
f"Unknown direction method {requested!r}. "
|
|
f"Choose from: {', '.join(available_direction_methods())}"
|
|
) from None
|