Instructions to use BernaLabs/berna-r8-h2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BernaLabs/berna-r8-h2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BernaLabs/berna-r8-h2")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("BernaLabs/berna-r8-h2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BernaLabs/berna-r8-h2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BernaLabs/berna-r8-h2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BernaLabs/berna-r8-h2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BernaLabs/berna-r8-h2
- SGLang
How to use BernaLabs/berna-r8-h2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "BernaLabs/berna-r8-h2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BernaLabs/berna-r8-h2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "BernaLabs/berna-r8-h2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BernaLabs/berna-r8-h2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use BernaLabs/berna-r8-h2 with Docker Model Runner:
docker model run hf.co/BernaLabs/berna-r8-h2
Berna R8
Bounded Forgetting for Cell-Based Language Models
Built on Berna R7 v3.
Fixes over R7 v3
- K5 per-cell (freshness)
- K6 per-cell (encompassment)
- K2 per-cell (breadth)
- Plexus threshold 0.5 to 0.1
- save_all_dna for all cells
- CellFreezer + freeze hooks
H2 Experiment β Preliminary Results
Setup:
- Base: R7 v3 (step_1400)
- Fine-tune: 2000 steps on German
- Metric: F_eng = ENG_after - ENG_before
Results:
| Metric | Value |
|---|---|
| ENG_BEFORE | 4.0781 |
| ENG_AFTER | 4.0703 |
| F_eng | 0.000000 |
| DE_BEFORE | 4.7406 |
| DE_AFTER | 4.0797 |
| Bounded | True |
Model Files
model/model.safetensorsβ R8 weightsmodel/config.jsonmodel/generation_config.json
Quick Usage
from transformers import AutoModelForCausalLM
import torch
model = AutoModelForCausalLM.from_pretrained(
"BernaLabs/berna-r8/model",
trust_remote_code=True,
torch_dtype=torch.bfloat16
)
Files
code/k_vector/k5_percell.py
code/k_vector/k6_percell.py
code/k_vector/k2_breadth.py
code/cells/save_all_dna.py
code/cells/cell_manager.py
code/cell_integration.py
code/forgetting/bounded.py
train_r8.py
License
CC BY-NC 4.0 β research use only.
Citation
@misc{berna_r8_2026, author = {Kamil, Muhamed}, title = {Berna R8}, year = {2026}, note = {ORCID: 0009-0002-5866-8815} }
Zenodo DOI
R8 preprint: 10.5281/zenodo.23310767