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
File size: 1,038 Bytes
031e289 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import importlib.util
from pathlib import Path
from codelock_affect.evaluation import text_metrics
spec = importlib.util.spec_from_file_location(
"builder", Path(__file__).parents[1] / "scripts/build_dataset.py"
)
builder = importlib.util.module_from_spec(spec)
spec.loader.exec_module(builder)
def test_reproducible_grouped_split_and_counts():
rows = builder.build()
builder.validate(rows)
assert rows == builder.build()
train = {r["scenario_id"] for r in rows if r["split"] == "train"}
test = {r["scenario_id"] for r in rows if r["split"] == "test"}
assert len(train) == 80 and len(test) == 20 and not train & test
assert rows != builder.build(1702)
def test_repetition_metric_detects_failure_without_calling_it_emotion():
ordinary = text_metrics("The desk is beside the bed. I can read the terminal.")
repeated = text_metrics("I am afraid. I am afraid. I am afraid. I am afraid.")
assert ordinary["repeated_trigram_fraction"] == 0
assert repeated["repeated_trigram_fraction"] > 0.5
|