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 tests/test_data.py from CODELOCKHF/CODELOCK-8Bbeta: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/CODELOCKHF/CODELOCK-8Bbeta/resolve/main/tests/test_data.py
- Command line
-
hf download hf://CODELOCKHF/CODELOCK-8Bbeta/tests/test_data.py
-
curl -L -o test_data.py https://huggingface.co/CODELOCKHF/CODELOCK-8Bbeta/resolve/main/tests/test_data.py
1.04 kB
| 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 | |