Text Generation
Transformers
Safetensors
Norwegian
Norwegian Bokmål
Norwegian Nynorsk
gemma3_text
conversational
instruct
borealis
norwegian
norwegian-bokmal
norwegian-nynorsk
open
text-generation-inference
🇪🇺 Region: EU
Instructions to use NbAiLab/borealis-open-270m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NbAiLab/borealis-open-270m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NbAiLab/borealis-open-270m") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NbAiLab/borealis-open-270m") model = AutoModelForCausalLM.from_pretrained("NbAiLab/borealis-open-270m") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use NbAiLab/borealis-open-270m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NbAiLab/borealis-open-270m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NbAiLab/borealis-open-270m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/NbAiLab/borealis-open-270m
- SGLang
How to use NbAiLab/borealis-open-270m 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 "NbAiLab/borealis-open-270m" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NbAiLab/borealis-open-270m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "NbAiLab/borealis-open-270m" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NbAiLab/borealis-open-270m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use NbAiLab/borealis-open-270m with Docker Model Runner:
docker model run hf.co/NbAiLab/borealis-open-270m
Commit ·
d93b95c
0
Parent(s):
Squash Borealis release history
Browse files- .gitattributes +40 -0
- LICENSE_FAQ.pdf +3 -0
- Model_Documentation_Form.pdf +3 -0
- README.md +246 -0
- added_tokens.json +3 -0
- borealis.png +3 -0
- borealis_evals_202605.png +3 -0
- chat_template.jinja +47 -0
- config.json +62 -0
- generation_config.json +14 -0
- model.safetensors +3 -0
- signing/SHA256SUMS +8 -0
- signing/SHA256SUMS.sig +0 -0
- signing/ca-chain.pem +72 -0
- signing/cert.pem +39 -0
- signing/verify.sh +98 -0
- special_tokens_map.json +33 -0
- tokenizer.json +3 -0
- tokenizer.model +3 -0
- tokenizer_config.json +0 -0
- tokenizer_config_broken_maybe.json +26 -0
.gitattributes
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
LICENSE_FAQ.pdf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
borealis.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
Model_Documentation_Form.pdf filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
borealis_evals_202605.png filter=lfs diff=lfs merge=lfs -text
|
LICENSE_FAQ.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b4a87118b0b0c1e2d5a06b27bb4b56517d4d62b2b74860f77b8ac2d601224840
|
| 3 |
+
size 140945
|
Model_Documentation_Form.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:03a21e1ab6c7fa44780d6af2604d1a871514a8e485575f85f40f67cd59488908
|
| 3 |
+
size 324025
|
README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
datasets:
|
| 4 |
+
- NbAiLab/aurora-sft-open
|
| 5 |
+
language:
|
| 6 |
+
- 'no'
|
| 7 |
+
- nb
|
| 8 |
+
- nn
|
| 9 |
+
base_model:
|
| 10 |
+
- google/gemma-3-270m-it
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
library_name: transformers
|
| 13 |
+
tags:
|
| 14 |
+
- conversational
|
| 15 |
+
- instruct
|
| 16 |
+
- borealis
|
| 17 |
+
- gemma3_text
|
| 18 |
+
- norwegian
|
| 19 |
+
- norwegian-bokmal
|
| 20 |
+
- norwegian-nynorsk
|
| 21 |
+
- open
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
|
| 26 |
+
# Borealis Open 270M
|
| 27 |
+
|
| 28 |
+
## Model Summary
|
| 29 |
+
|
| 30 |
+
**NbAiLab/borealis-open-270m** is a **270M-parameter** instruction-tuned **open release** model in the Borealis family from the National Library of Norway (Nasjonalbiblioteket, NB).
|
| 31 |
+
|
| 32 |
+
This is the first Borealis release to incorporate data made available under the agreement between rights-holder organizations in Norway and the Norwegian government. To date, only a limited subset of the material has been used, specifically to teach the model how to generate news article titles and ingress texts. Models with the suffix `-open`, do not include any material from the agreement.
|
| 33 |
+
|
| 34 |
+
All Borealis released models are based on the **Gemma 3** family. This model is based on [google/gemma-3-270m-it](https://huggingface.co/google/gemma-3-270m-it), and fine-tuned for Norwegian-centric instruction following.
|
| 35 |
+
|
| 36 |
+
### Sizes
|
| 37 |
+
|
| 38 |
+
| Size | Full release | Open release |
|
| 39 |
+
|---:|---|---|
|
| 40 |
+
| 27B | [NbAiLab/borealis-27b](https://huggingface.co/NbAiLab/borealis-27b) | [NbAiLab/borealis-open-27b](https://huggingface.co/NbAiLab/borealis-open-27b) |
|
| 41 |
+
| 12B | [NbAiLab/borealis-12b](https://huggingface.co/NbAiLab/borealis-12b) | [NbAiLab/borealis-open-12b](https://huggingface.co/NbAiLab/borealis-open-12b) |
|
| 42 |
+
| 4B | [NbAiLab/borealis-4b](https://huggingface.co/NbAiLab/borealis-4b) | [NbAiLab/borealis-open-4b](https://huggingface.co/NbAiLab/borealis-open-4b) |
|
| 43 |
+
| 1B | [NbAiLab/borealis-1b](https://huggingface.co/NbAiLab/borealis-1b) | [NbAiLab/borealis-open-1b](https://huggingface.co/NbAiLab/borealis-open-1b) |
|
| 44 |
+
| 270M | [NbAiLab/borealis-270m](https://huggingface.co/NbAiLab/borealis-270m) | [NbAiLab/borealis-open-270m](https://huggingface.co/NbAiLab/borealis-open-270m) |
|
| 45 |
+
|
| 46 |
+
## Training Data
|
| 47 |
+
|
| 48 |
+
Supervised fine-tuning (SFT) uses instruction data prepared by the National Library of Norway for Norwegian-centric assistant behavior, writing, summarization, question answering, and related tasks.
|
| 49 |
+
|
| 50 |
+
The SFT dataset for this model is [NbAiLab/aurora-sft-open](https://huggingface.co/datasets/NbAiLab/aurora-sft-open). [NbAiLab/aurora-sft-open](https://huggingface.co/datasets/NbAiLab/aurora-sft-open) is the open version of the SFT dataset. The only difference between [NbAiLab/aurora-sft-open](https://huggingface.co/datasets/NbAiLab/aurora-sft-open) and [NbAiLab/aurora-sft](https://huggingface.co/datasets/NbAiLab/aurora-sft) is the addition of 10k tasks derived from copyright-protected newspapers material.
|
| 51 |
+
|
| 52 |
+
## Evaluation
|
| 53 |
+
|
| 54 |
+
<figure>
|
| 55 |
+
<img src="./borealis_evals_202605.png" alt="Borealis evaluation results">
|
| 56 |
+
<figcaption>Borealis evaluation results on selected tasks (best score among {0-5}-shot).</figcaption>
|
| 57 |
+
</figure>
|
| 58 |
+
|
| 59 |
+
We evaluate Borealis with NorEval, MMLU-English, and nb-gpt-bench, our own evaluation suite, which will be published and described in an upcoming paper. The full Borealis models include around 10k newspaper-derived tasks from the abovementioned agreement and show a slight performance increase in some key metrics compared with the open variants. We hope to further increase the difference by incorporating proper pre-training on the newspaper material.
|
| 60 |
+
|
| 61 |
+
## Safety and Alignment
|
| 62 |
+
|
| 63 |
+
The Borealis family of models are aligned for safety using prompt baking and weighted merging of SFT and aligned models. The goal of this process is to balance model quality, usefulness, and safer behavior.
|
| 64 |
+
|
| 65 |
+
As with all generative models, outputs can still be incorrect, biased, harmful, or inappropriate. Do not use the model for safety-critical or high-stakes applications without additional evaluation and safeguards.
|
| 66 |
+
|
| 67 |
+
### Prompt Baking
|
| 68 |
+
|
| 69 |
+
To align the Borealis models, we employ *prompt baking*, a procedure that distills the behavior induced by a system prompt directly into the model weights using [`bakery`](https://github.com/marksverdhei/bakery). Specifically, we train a LoRA adapter to minimize the KL-divergence between two model distributions: Borealis conditioned on the system prompt, and the same base model augmented with the LoRA adapter but evaluated without the system prompt in context. This objective encourages the adapter to reproduce the behavioral effects of the prompt without requiring the prompt to be present at inference time.
|
| 70 |
+
|
| 71 |
+
To reduce degradation on downstream tasks and preserve general model utility, we merge the resulting prompt adapter into the base model using a scaling factor of `0.25`, which we found to provide the best empirical trade-off.
|
| 72 |
+
|
| 73 |
+
## Intended Use
|
| 74 |
+
|
| 75 |
+
- Norwegian-centric assistant-style tasks, including drafting, summarization, Q&A, and light reasoning (this is not a reasoning model).
|
| 76 |
+
- Assessment and improvement of Norwegian writing style and quality.
|
| 77 |
+
- Evaluation of behavior and language coverage for Norwegian, Bokmål, and Nynorsk.
|
| 78 |
+
|
| 79 |
+
## Usage
|
| 80 |
+
|
| 81 |
+
This repository contains the Transformers/safetensors version of the model. The
|
| 82 |
+
examples below use `NbAiLab/borealis-open-270m` as the model id; replace it with
|
| 83 |
+
another Borealis repo id if needed.
|
| 84 |
+
|
| 85 |
+
### Transformers
|
| 86 |
+
|
| 87 |
+
Use the regular causal language-model interface:
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
import torch
|
| 91 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 92 |
+
|
| 93 |
+
model_id = "NbAiLab/borealis-open-270m"
|
| 94 |
+
|
| 95 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 96 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 97 |
+
model_id,
|
| 98 |
+
device_map="auto",
|
| 99 |
+
torch_dtype=torch.bfloat16,
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
messages = [
|
| 103 |
+
{
|
| 104 |
+
"role": "user",
|
| 105 |
+
"content": "Skriv et kort sammendrag av hva Nasjonalbiblioteket gjør.",
|
| 106 |
+
}
|
| 107 |
+
]
|
| 108 |
+
|
| 109 |
+
inputs = tokenizer.apply_chat_template(
|
| 110 |
+
messages,
|
| 111 |
+
add_generation_prompt=True,
|
| 112 |
+
return_tensors="pt",
|
| 113 |
+
return_dict=True,
|
| 114 |
+
).to(model.device)
|
| 115 |
+
|
| 116 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 117 |
+
new_tokens = outputs[0, inputs["input_ids"].shape[-1]:]
|
| 118 |
+
print(tokenizer.decode(new_tokens, skip_special_tokens=True))
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
### vLLM
|
| 122 |
+
|
| 123 |
+
Serve the model with vLLM's OpenAI-compatible server:
|
| 124 |
+
|
| 125 |
+
```bash
|
| 126 |
+
vllm serve NbAiLab/borealis-open-270m --served-model-name borealis-open-270m
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
Then call the local chat completions endpoint:
|
| 130 |
+
|
| 131 |
+
```bash
|
| 132 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 133 |
+
-H "Content-Type: application/json" \
|
| 134 |
+
-d '{
|
| 135 |
+
"model": "borealis-open-270m",
|
| 136 |
+
"messages": [
|
| 137 |
+
{
|
| 138 |
+
"role": "user",
|
| 139 |
+
"content": "Skriv tre korte punkter om norsk språkteknologi."
|
| 140 |
+
}
|
| 141 |
+
],
|
| 142 |
+
"max_tokens": 256
|
| 143 |
+
}'
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
Large models may require tensor parallelism or reduced memory settings depending
|
| 147 |
+
on the available GPU memory.
|
| 148 |
+
|
| 149 |
+
### llama.cpp
|
| 150 |
+
|
| 151 |
+
llama.cpp uses GGUF files, not the safetensors files in this repository. When
|
| 152 |
+
the planned GGUF companion repository is available, you can run it directly from
|
| 153 |
+
the Hub:
|
| 154 |
+
|
| 155 |
+
```bash
|
| 156 |
+
llama-server -hf NbAiLab/borealis-open-270m-gguf --port 8080
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
Or download a GGUF file and run it locally:
|
| 160 |
+
|
| 161 |
+
```bash
|
| 162 |
+
llama-cli -m borealis-open-270m.gguf \
|
| 163 |
+
-p "Skriv et kort sammendrag av hva Nasjonalbiblioteket gjør." \
|
| 164 |
+
-n 256
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
### Ollama
|
| 168 |
+
|
| 169 |
+
Ollama also requires a GGUF model. Once the GGUF companion repository is
|
| 170 |
+
available, you can run it from Hugging Face:
|
| 171 |
+
|
| 172 |
+
```bash
|
| 173 |
+
ollama run hf.co/NbAiLab/borealis-open-270m-gguf
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
For a local GGUF file, create a minimal `Modelfile`:
|
| 177 |
+
|
| 178 |
+
```text
|
| 179 |
+
FROM ./borealis-open-270m.gguf
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
Then create and run the local Ollama model:
|
| 183 |
+
|
| 184 |
+
```bash
|
| 185 |
+
ollama create borealis-open-270m -f Modelfile
|
| 186 |
+
ollama run borealis-open-270m "Skriv tre korte punkter om norsk språkteknologi."
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
## Limitations
|
| 190 |
+
|
| 191 |
+
- The model may hallucinate or produce incorrect information.
|
| 192 |
+
- Safety alignment reduces but does not eliminate harmful or inappropriate outputs.
|
| 193 |
+
- Performance outside Norwegian and English use cases has not been fully characterized.
|
| 194 |
+
|
| 195 |
+
## EU AI Act
|
| 196 |
+
|
| 197 |
+
The model is a fine-tune of Gemma 3. Using Gemma 3 27B as a conservative upper-bound reference, the original Gemma 3 27B training compute is estimated at approximately 2.1-2.3 x 10^24 FLOPs, based on the disclosed 14T training-token budget and the 27B parameter scale. The fine-tuning run used approximately 3.4 x 10^20 FLOPs, or about 0.015% of the estimated original training compute. This is substantially below the European Commission's indicative one-third threshold for treating a downstream modification as a significant modification that would make the modifier the provider of the modified General Purpose AI (GPAI) model.
|
| 198 |
+
|
| 199 |
+
On that basis, the fine-tuning activity is preliminarily assessed as not constituting a substantial modification for the purpose of becoming the provider of a new modified GPAI model under the compute-based criterion. However, the resulting model remains derived from a generative general-purpose AI model and may still be subject to downstream AI-system obligations under the EU AI Act.
|
| 200 |
+
|
| 201 |
+
For additional model-level documentation, see the [Model Documentation Form](./Model_Documentation_Form.pdf).
|
| 202 |
+
|
| 203 |
+
## License
|
| 204 |
+
|
| 205 |
+
The license of this model is an adaptation of the Apache 2.0 license with additional use-based restrictions. In particular, users of the model are required to refrain from intentionally using the model to recreate data the model has been trained on. The license also requires users not to use the model or its output to provide end-user services whose primary purpose is to give access to licensed press publications in the training data.
|
| 206 |
+
|
| 207 |
+
For more information, see the [LICENSE](./LICENSE) and the [License FAQ](./LICENSE_FAQ.pdf).
|
| 208 |
+
|
| 209 |
+
## Authenticity
|
| 210 |
+
|
| 211 |
+
This model release is signed by the National Library of Norway. The signed manifest in `signing/SHA256SUMS` covers the model-runtime artifacts, including model weights, configuration, tokenizer files, and chat template.
|
| 212 |
+
|
| 213 |
+
To verify model authenticity and file integrity after downloading the repository, run:
|
| 214 |
+
|
| 215 |
+
```bash
|
| 216 |
+
bash signing/verify.sh
|
| 217 |
+
```
|
| 218 |
+
|
| 219 |
+
For more verification instructions, see [ai.nb.no/verify](https://ai.nb.no/verify).
|
| 220 |
+
|
| 221 |
+
## Weights
|
| 222 |
+
|
| 223 |
+
This repository contains the Transformers (safetensors) release of **NbAiLab/borealis-open-270m**.
|
| 224 |
+
|
| 225 |
+
Companion formats:
|
| 226 |
+
- GGUF: [NbAiLab/borealis-open-270m-gguf](https://huggingface.co/NbAiLab/borealis-open-270m-gguf)
|
| 227 |
+
- MLX: [NbAiLab/borealis-open-270m-mlx](https://huggingface.co/NbAiLab/borealis-open-270m-mlx)
|
| 228 |
+
- MLX 8-bit: [NbAiLab/borealis-open-270m-mlx-8bits](https://huggingface.co/NbAiLab/borealis-open-270m-mlx-8bits)
|
| 229 |
+
|
| 230 |
+
## Citation and Contributors
|
| 231 |
+
|
| 232 |
+
The Borealis family of models is a joint effort of multiple teams at the National Library of Norway. Led by Javier de la Rosa ([@versae](https://huggingface.co/versae)), key contributors include (in alphabetical order) Rolv-Arild Braaten, Magnus Breder Birkenes, Lucas Charpentier, Pawel Cyrta, Tita Enstad, Markus Sverdvik Heiervang, Arne Martinus Lindstad, Marthe Løken Midtgaard, Marie Roald, Marie Røsok, Thea Tollersrud, and Angelina Zanardi. Olaus Ingskog Bergstrøm contributed with legal advice. And Yngvil Beyer, Svein Arne Brygfjeld, and Wilfred Østgulen helped with strategic oversight.
|
| 233 |
+
|
| 234 |
+
A tecnical report will be released soon.
|
| 235 |
+
|
| 236 |
+
## Acknowledgements
|
| 237 |
+
|
| 238 |
+
Thanks to the Gemma team at Google for releasing Gemma 3, and to everyone contributing to the Norwegian language technology ecosystem.
|
| 239 |
+
|
| 240 |
+
## Disclaimer
|
| 241 |
+
|
| 242 |
+
The models published in this repository are intended for a generalist purpose and are available to third parties. These models may have bias and/or any other undesirable distortions. When third parties, deploy or provide systems and/or services to other parties using any of these models (or using systems based on these models) or become users of the models, they should note that it is their responsibility to mitigate the risks arising from their use and, in any event, to comply with applicable regulations, including regulations regarding the use of artificial intelligence. In no event shall the owner of the models (The National Library of Norway) be liable for any results arising from the use made by third parties of these models.
|
| 243 |
+
|
| 244 |
+
## Contact
|
| 245 |
+
|
| 246 |
+
For feedback, technical concerns, or collaboration inquiries, please contact <a rel="noopener nofollow" href="mailto:ailab@nb.no">ailab@nb.no</a>.
|
added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<image_soft_token>": 262144
|
| 3 |
+
}
|
borealis.png
ADDED
|
Git LFS Details
|
borealis_evals_202605.png
ADDED
|
Git LFS Details
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ bos_token }}
|
| 2 |
+
{%- if messages[0]['role'] == 'system' -%}
|
| 3 |
+
{%- if messages[0]['content'] is string -%}
|
| 4 |
+
{%- set first_user_prefix = messages[0]['content'] + '
|
| 5 |
+
|
| 6 |
+
' -%}
|
| 7 |
+
{%- else -%}
|
| 8 |
+
{%- set first_user_prefix = messages[0]['content'][0]['text'] + '
|
| 9 |
+
|
| 10 |
+
' -%}
|
| 11 |
+
{%- endif -%}
|
| 12 |
+
{%- set loop_messages = messages[1:] -%}
|
| 13 |
+
{%- else -%}
|
| 14 |
+
{%- set first_user_prefix = "" -%}
|
| 15 |
+
{%- set loop_messages = messages -%}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{%- for message in loop_messages -%}
|
| 18 |
+
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
|
| 19 |
+
{{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
|
| 20 |
+
{%- endif -%}
|
| 21 |
+
{%- if (message['role'] == 'assistant') -%}
|
| 22 |
+
{%- set role = "model" -%}
|
| 23 |
+
{%- else -%}
|
| 24 |
+
{%- set role = message['role'] -%}
|
| 25 |
+
{%- endif -%}
|
| 26 |
+
{{ '<start_of_turn>' + role + '
|
| 27 |
+
' + (first_user_prefix if loop.first else "") }}
|
| 28 |
+
{%- if message['content'] is string -%}
|
| 29 |
+
{{ message['content'] | trim }}
|
| 30 |
+
{%- elif message['content'] is iterable -%}
|
| 31 |
+
{%- for item in message['content'] -%}
|
| 32 |
+
{%- if item['type'] == 'image' -%}
|
| 33 |
+
{{ '<start_of_image>' }}
|
| 34 |
+
{%- elif item['type'] == 'text' -%}
|
| 35 |
+
{{ item['text'] | trim }}
|
| 36 |
+
{%- endif -%}
|
| 37 |
+
{%- endfor -%}
|
| 38 |
+
{%- else -%}
|
| 39 |
+
{{ raise_exception("Invalid content type") }}
|
| 40 |
+
{%- endif -%}
|
| 41 |
+
{{ '<end_of_turn>
|
| 42 |
+
' }}
|
| 43 |
+
{%- endfor -%}
|
| 44 |
+
{%- if add_generation_prompt -%}
|
| 45 |
+
{{'<start_of_turn>model
|
| 46 |
+
'}}
|
| 47 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_sliding_window_pattern": 6,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"Gemma3ForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"attn_logit_softcapping": null,
|
| 9 |
+
"bos_token_id": 2,
|
| 10 |
+
"dtype": "bfloat16",
|
| 11 |
+
"eos_token_id": 106,
|
| 12 |
+
"final_logit_softcapping": null,
|
| 13 |
+
"head_dim": 256,
|
| 14 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 15 |
+
"hidden_size": 640,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 2048,
|
| 18 |
+
"layer_types": [
|
| 19 |
+
"sliding_attention",
|
| 20 |
+
"sliding_attention",
|
| 21 |
+
"sliding_attention",
|
| 22 |
+
"sliding_attention",
|
| 23 |
+
"sliding_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"sliding_attention",
|
| 26 |
+
"sliding_attention",
|
| 27 |
+
"sliding_attention",
|
| 28 |
+
"sliding_attention",
|
| 29 |
+
"sliding_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"sliding_attention",
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"sliding_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"sliding_attention",
|
| 36 |
+
"full_attention"
|
| 37 |
+
],
|
| 38 |
+
"max_position_embeddings": 32768,
|
| 39 |
+
"model_type": "gemma3_text",
|
| 40 |
+
"num_attention_heads": 4,
|
| 41 |
+
"num_hidden_layers": 18,
|
| 42 |
+
"num_key_value_heads": 1,
|
| 43 |
+
"pad_token_id": 0,
|
| 44 |
+
"query_pre_attn_scalar": 256,
|
| 45 |
+
"rms_norm_eps": 1e-06,
|
| 46 |
+
"rope_parameters": {
|
| 47 |
+
"full_attention": {
|
| 48 |
+
"rope_theta": 1000000.0,
|
| 49 |
+
"rope_type": "default"
|
| 50 |
+
},
|
| 51 |
+
"sliding_attention": {
|
| 52 |
+
"rope_theta": 10000.0,
|
| 53 |
+
"rope_type": "default"
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"sliding_window": 512,
|
| 57 |
+
"tie_word_embeddings": true,
|
| 58 |
+
"transformers_version": "5.8.0",
|
| 59 |
+
"use_bidirectional_attention": false,
|
| 60 |
+
"use_cache": false,
|
| 61 |
+
"vocab_size": 262144
|
| 62 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 2,
|
| 3 |
+
"cache_implementation": "hybrid",
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
106,
|
| 7 |
+
1,
|
| 8 |
+
106
|
| 9 |
+
],
|
| 10 |
+
"pad_token_id": 0,
|
| 11 |
+
"top_k": 64,
|
| 12 |
+
"top_p": 0.95,
|
| 13 |
+
"transformers_version": "5.8.0"
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aefc7ddc1c8e111cba74d2bb7e4e2dba419359c2f7629b6a4d8d6335223b5730
|
| 3 |
+
size 536223056
|
signing/SHA256SUMS
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
7de1c58e208eda46e9c7f86397df37ec49883aeece39fb961e0a6b24088dd3c4 chat_template.jinja
|
| 2 |
+
6831ac336664e1164a8f08cfc311f5810b7db3cbbdce2313308c444c6d66269e config.json
|
| 3 |
+
d658664f05444ad13f0b7f1298cea34e5b745583f0c720d74531c49549fa1fa1 generation_config.json
|
| 4 |
+
aefc7ddc1c8e111cba74d2bb7e4e2dba419359c2f7629b6a4d8d6335223b5730 model.safetensors
|
| 5 |
+
2f7b0adf4fb469770bb1490e3e35df87b1dc578246c5e7e6fc76ecf33213a397 special_tokens_map.json
|
| 6 |
+
daab2354f8a74e70d70b4d1f804939b68a8c9624dd06cb7858e52dd8970e9726 tokenizer.json
|
| 7 |
+
1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c tokenizer.model
|
| 8 |
+
d0b7277c7eacd89f34918fa9e9bf1e51ee3d1d0859ba6fd29e7253de4a814cee tokenizer_config.json
|
signing/SHA256SUMS.sig
ADDED
|
Binary file (512 Bytes). View file
|
|
|
signing/ca-chain.pem
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-----BEGIN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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#
|
| 3 |
+
# Verify the integrity and authenticity of this model release.
|
| 4 |
+
#
|
| 5 |
+
# Usage: bash signing/verify.sh
|
| 6 |
+
#
|
| 7 |
+
# This script verifies:
|
| 8 |
+
# 1. The signing certificate is issued by a trusted CA
|
| 9 |
+
# 2. The SHA256SUMS manifest was signed by Nasjonalbiblioteket
|
| 10 |
+
# 3. All file checksums match the manifest
|
| 11 |
+
#
|
| 12 |
+
|
| 13 |
+
set -euo pipefail
|
| 14 |
+
|
| 15 |
+
RED='\033[0;31m'
|
| 16 |
+
GREEN='\033[0;32m'
|
| 17 |
+
NC='\033[0m'
|
| 18 |
+
|
| 19 |
+
pass() { echo -e "${GREEN}[PASS]${NC} $*"; }
|
| 20 |
+
fail() { echo -e "${RED}[FAIL]${NC} $*" >&2; }
|
| 21 |
+
|
| 22 |
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
| 23 |
+
MODEL_DIR="$(dirname "$SCRIPT_DIR")"
|
| 24 |
+
SIGNING_DIR="$SCRIPT_DIR"
|
| 25 |
+
|
| 26 |
+
cd "$MODEL_DIR"
|
| 27 |
+
|
| 28 |
+
errors=0
|
| 29 |
+
|
| 30 |
+
# Check required files exist
|
| 31 |
+
for f in "$SIGNING_DIR/SHA256SUMS" "$SIGNING_DIR/SHA256SUMS.sig" \
|
| 32 |
+
"$SIGNING_DIR/cert.pem" "$SIGNING_DIR/ca-chain.pem"; do
|
| 33 |
+
if [[ ! -f "$f" ]]; then
|
| 34 |
+
fail "Missing file: $f"
|
| 35 |
+
errors=$((errors + 1))
|
| 36 |
+
fi
|
| 37 |
+
done
|
| 38 |
+
|
| 39 |
+
if [[ $errors -gt 0 ]]; then
|
| 40 |
+
echo ""
|
| 41 |
+
fail "Required signing files are missing. Cannot verify."
|
| 42 |
+
exit 1
|
| 43 |
+
fi
|
| 44 |
+
|
| 45 |
+
echo "=== Nasjonalbiblioteket Model Verification ==="
|
| 46 |
+
echo ""
|
| 47 |
+
|
| 48 |
+
# Show certificate info
|
| 49 |
+
echo "Certificate subject:"
|
| 50 |
+
openssl x509 -in "$SIGNING_DIR/cert.pem" -subject -noout 2>/dev/null | sed 's/^subject=/ /'
|
| 51 |
+
echo "Certificate issuer:"
|
| 52 |
+
openssl x509 -in "$SIGNING_DIR/cert.pem" -issuer -noout 2>/dev/null | sed 's/^issuer=/ /'
|
| 53 |
+
echo "Certificate fingerprint (SHA-256):"
|
| 54 |
+
openssl x509 -in "$SIGNING_DIR/cert.pem" -fingerprint -sha256 -noout 2>/dev/null | sed 's/^.*=/ /'
|
| 55 |
+
echo ""
|
| 56 |
+
|
| 57 |
+
# 1. Verify certificate chain
|
| 58 |
+
echo "--- Step 1: Verify certificate chain ---"
|
| 59 |
+
if openssl verify -CAfile "$SIGNING_DIR/ca-chain.pem" "$SIGNING_DIR/cert.pem" > /dev/null 2>&1; then
|
| 60 |
+
pass "Certificate chain is valid."
|
| 61 |
+
else
|
| 62 |
+
fail "Certificate chain verification failed!"
|
| 63 |
+
errors=$((errors + 1))
|
| 64 |
+
fi
|
| 65 |
+
|
| 66 |
+
# 2. Verify signature
|
| 67 |
+
echo "--- Step 2: Verify manifest signature ---"
|
| 68 |
+
PUBKEY=$(mktemp)
|
| 69 |
+
trap "rm -f '$PUBKEY'" EXIT
|
| 70 |
+
openssl x509 -in "$SIGNING_DIR/cert.pem" -pubkey -noout > "$PUBKEY" 2>/dev/null
|
| 71 |
+
|
| 72 |
+
if openssl dgst -sha256 -verify "$PUBKEY" \
|
| 73 |
+
-signature "$SIGNING_DIR/SHA256SUMS.sig" \
|
| 74 |
+
"$SIGNING_DIR/SHA256SUMS" > /dev/null 2>&1; then
|
| 75 |
+
pass "Manifest signature is valid."
|
| 76 |
+
else
|
| 77 |
+
fail "Manifest signature verification failed!"
|
| 78 |
+
errors=$((errors + 1))
|
| 79 |
+
fi
|
| 80 |
+
|
| 81 |
+
# 3. Verify file checksums
|
| 82 |
+
echo "--- Step 3: Verify file checksums ---"
|
| 83 |
+
if sha256sum -c "$SIGNING_DIR/SHA256SUMS" 2>/dev/null; then
|
| 84 |
+
pass "All file checksums match."
|
| 85 |
+
else
|
| 86 |
+
fail "One or more file checksums do not match!"
|
| 87 |
+
errors=$((errors + 1))
|
| 88 |
+
fi
|
| 89 |
+
|
| 90 |
+
# Summary
|
| 91 |
+
echo ""
|
| 92 |
+
if [[ $errors -eq 0 ]]; then
|
| 93 |
+
echo -e "${GREEN}✅ Verification successful. All files are authentic and unmodified.${NC}"
|
| 94 |
+
exit 0
|
| 95 |
+
else
|
| 96 |
+
echo -e "${RED}❌ Verification failed with $errors error(s).${NC}"
|
| 97 |
+
exit 1
|
| 98 |
+
fi
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"boi_token": "<start_of_image>",
|
| 3 |
+
"bos_token": {
|
| 4 |
+
"content": "<bos>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false
|
| 9 |
+
},
|
| 10 |
+
"eoi_token": "<end_of_image>",
|
| 11 |
+
"eos_token": {
|
| 12 |
+
"content": "<eos>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false
|
| 17 |
+
},
|
| 18 |
+
"image_token": "<image_soft_token>",
|
| 19 |
+
"pad_token": {
|
| 20 |
+
"content": "<pad>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false
|
| 25 |
+
},
|
| 26 |
+
"unk_token": {
|
| 27 |
+
"content": "<unk>",
|
| 28 |
+
"lstrip": false,
|
| 29 |
+
"normalized": false,
|
| 30 |
+
"rstrip": false,
|
| 31 |
+
"single_word": false
|
| 32 |
+
}
|
| 33 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:daab2354f8a74e70d70b4d1f804939b68a8c9624dd06cb7858e52dd8970e9726
|
| 3 |
+
size 33384567
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
|
| 3 |
+
size 4689074
|
tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config_broken_maybe.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"boi_token": "<start_of_image>",
|
| 4 |
+
"bos_token": "<bos>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eoi_token": "<end_of_image>",
|
| 7 |
+
"eos_token": "<end_of_turn>",
|
| 8 |
+
"image_token": "<image_soft_token>",
|
| 9 |
+
"is_local": false,
|
| 10 |
+
"local_files_only": false,
|
| 11 |
+
"mask_token": "<mask>",
|
| 12 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 13 |
+
"model_specific_special_tokens": {
|
| 14 |
+
"boi_token": "<start_of_image>",
|
| 15 |
+
"eoi_token": "<end_of_image>",
|
| 16 |
+
"image_token": "<image_soft_token>"
|
| 17 |
+
},
|
| 18 |
+
"pad_token": "<pad>",
|
| 19 |
+
"padding_side": "right",
|
| 20 |
+
"sp_model_kwargs": null,
|
| 21 |
+
"spaces_between_special_tokens": false,
|
| 22 |
+
"split_special_tokens": false,
|
| 23 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 24 |
+
"unk_token": "<unk>",
|
| 25 |
+
"use_default_system_prompt": false
|
| 26 |
+
}
|