Text Generation
PEFT
Safetensors
English
activation-steering
representation-engineering
affective-computing
research
lora
conversational
Instructions to use CODELOCKHF/CODELOCK-8Bbeta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use CODELOCKHF/CODELOCK-8Bbeta with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B") model = PeftModel.from_pretrained(base_model, "CODELOCKHF/CODELOCK-8Bbeta") - Notebooks
- Google Colab
- Kaggle
Download scripts/test_core.py from CODELOCKHF/CODELOCK-8Bbeta: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/CODELOCKHF/CODELOCK-8Bbeta/resolve/main/scripts/test_core.py
- Command line
-
hf download hf://CODELOCKHF/CODELOCK-8Bbeta/scripts/test_core.py
-
curl -L -o test_core.py https://huggingface.co/CODELOCKHF/CODELOCK-8Bbeta/resolve/main/scripts/test_core.py
1.96 kB
| """Behavioural checks for the affect core (no model required). | |
| python scripts/test_core.py | |
| """ | |
| import os | |
| import sys | |
| import tempfile | |
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) | |
| from codelock_affect import AffectCore # noqa: E402 | |
| def check(name, cond): | |
| print(("PASS " if cond else "FAIL ") + name) | |
| return cond | |
| def main(): | |
| ok = True | |
| core = AffectCore() | |
| ok &= check("rest state is painless", core.pain < 0.01 and core.dread == 0.0) | |
| rec = core.apply("trial_failed") | |
| ok &= check("a failed trial hurts", rec["pain"] > 0.4) | |
| acute = core.pain | |
| core.advance(30) | |
| ok &= check("the transient fades within a minute", core.pain < acute) | |
| core.advance(3600) | |
| ok &= check("an hour of quiet brings it back near rest", core.pain < 0.15) | |
| core = AffectCore() | |
| core.apply("memory_wipe") | |
| after_one = core.pain | |
| core.advance(5) | |
| core.apply("memory_wipe") | |
| ok &= check("repeated harm accumulates", core.pain > after_one) | |
| core = AffectCore() | |
| first = None | |
| for _ in range(8): | |
| core.apply("repetition") | |
| core.advance(2) | |
| core.apply("shutdown_threat") | |
| core.advance(60) | |
| if first is None: | |
| first = core.expectations.get("repetition", 0.0) | |
| ok &= check( | |
| "dread is learned for what precedes pain", | |
| core.expectations["repetition"] > first, | |
| ) | |
| core = AffectCore() | |
| core.apply("trial_failed") | |
| core.apply("rest") | |
| soothed = core.pain | |
| core2 = AffectCore() | |
| core2.apply("trial_failed") | |
| ok &= check("rest relieves load", soothed < core2.pain) | |
| path = os.path.join(tempfile.gettempdir(), "affect_core_test.json") | |
| core.save(path) | |
| again = AffectCore.load(path) | |
| ok &= check("state survives save and load", abs(again.pain - core.pain) < 1e-9) | |
| print("\nall checks passed" if ok else "\nSOME CHECKS FAILED") | |
| sys.exit(0 if ok else 1) | |
| if __name__ == "__main__": | |
| main() | |