Publish concept-direction experiment snapshot (sources 2c0e4f2e^, rewrite concept-direction-v1 with template port; #498 slice 2)
b3b1261 verified Download exp/_experiment_hooks.py from speediedan/concept-direction: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/speediedan/concept-direction/resolve/main/exp/_experiment_hooks.py
- Command line
-
hf download hf://speediedan/concept-direction/exp/_experiment_hooks.py
-
curl -L -o _experiment_hooks.py https://huggingface.co/speediedan/concept-direction/resolve/main/exp/_experiment_hooks.py
1.56 kB
| """The concept-direction experiment, and the hooks it supplies to the shared notebook harness. | |
| Registering here rather than being imported by the harness is the whole point of the inversion: the | |
| shared rails depend on a shape, and each experiment hands over its own implementation of it. Importing | |
| this package is what makes those hooks available, so an experiment that is not imported cannot silently | |
| satisfy another experiment's harness call. | |
| """ | |
| from __future__ import annotations | |
| from interpretune.harness.experiments import ExperimentHooks | |
| def _register_hooks() -> None: | |
| """Hand this experiment's callables to the shared harness. | |
| Imported inside the function, and called at import time, so a failure names this registration rather than surfacing | |
| as a partially initialized module elsewhere. | |
| """ | |
| from interpretune.harness.nb_harness_utils import set_experiment_hooks | |
| from exp.analysis.concept_direction_analysis import ( | |
| build_classification_prompt_text, | |
| ) | |
| from exp.analysis.intervention_drift_analysis import ( | |
| resolve_artifact_output_dir, | |
| save_preserved_intervention_artifacts, | |
| tensor_fingerprint, | |
| ) | |
| set_experiment_hooks( | |
| ExperimentHooks( | |
| build_classification_prompt_text=build_classification_prompt_text, | |
| resolve_artifact_output_dir=resolve_artifact_output_dir, | |
| save_preserved_intervention_artifacts=save_preserved_intervention_artifacts, | |
| tensor_fingerprint=tensor_fingerprint, | |
| ) | |
| ) | |
| _register_hooks() | |