Image-Text-to-Text
GGUF
Norwegian
Norwegian Bokmål
Norwegian Nynorsk
conversational
instruct
borealis
gemma3
quantized
norwegian
norwegian-bokmal
norwegian-nynorsk
full-release
🇪🇺 Region: EU
Instructions to use NbAiLab/borealis-4b-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use NbAiLab/borealis-4b-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="NbAiLab/borealis-4b-gguf", filename="borealis-4b-BF16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use NbAiLab/borealis-4b-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf NbAiLab/borealis-4b-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf NbAiLab/borealis-4b-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf NbAiLab/borealis-4b-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf NbAiLab/borealis-4b-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf NbAiLab/borealis-4b-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf NbAiLab/borealis-4b-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf NbAiLab/borealis-4b-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf NbAiLab/borealis-4b-gguf:Q4_K_M
Use Docker
docker model run hf.co/NbAiLab/borealis-4b-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use NbAiLab/borealis-4b-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NbAiLab/borealis-4b-gguf" # 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-4b-gguf", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/NbAiLab/borealis-4b-gguf:Q4_K_M
- Ollama
How to use NbAiLab/borealis-4b-gguf with Ollama:
ollama run hf.co/NbAiLab/borealis-4b-gguf:Q4_K_M
- Unsloth Studio
How to use NbAiLab/borealis-4b-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NbAiLab/borealis-4b-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NbAiLab/borealis-4b-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for NbAiLab/borealis-4b-gguf to start chatting
- Atomic Chat new
- Docker Model Runner
How to use NbAiLab/borealis-4b-gguf with Docker Model Runner:
docker model run hf.co/NbAiLab/borealis-4b-gguf:Q4_K_M
- Lemonade
How to use NbAiLab/borealis-4b-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull NbAiLab/borealis-4b-gguf:Q4_K_M
Run and chat with the model
lemonade run user.borealis-4b-gguf-Q4_K_M
List all available models
lemonade list
Commit ·
c5611e7
0
Parent(s):
Squash Borealis release history
Browse files- .gitattributes +47 -0
- LICENSE +180 -0
- LICENSE_FAQ.pdf +3 -0
- Model_Documentation_Form.pdf +3 -0
- README.md +185 -0
- borealis-4b-BF16.gguf +3 -0
- borealis-4b-Q2_K.gguf +3 -0
- borealis-4b-Q3_K_M.gguf +3 -0
- borealis-4b-Q4_K_M.gguf +3 -0
- borealis-4b-Q5_K_M.gguf +3 -0
- borealis-4b-Q6_K.gguf +3 -0
- borealis-4b-Q8_0.gguf +3 -0
- borealis.png +3 -0
- borealis_evals_202605.png +3 -0
- mmproj_borealis-4b-BF16.gguf +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
.gitattributes
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
mmproj_borealis-4b-BF16.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
LICENSE_FAQ.pdf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
borealis-4b-BF16.gguf filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
borealis-4b-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
borealis-4b-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
borealis-4b-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
borealis-4b-Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
borealis.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
borealis_evals_202605.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
Model_Documentation_Form.pdf filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
borealis-4b-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
borealis-4b-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
NB-License
|
| 2 |
+
Version 1.0, June 2026
|
| 3 |
+
https://ai.nb.no/license/
|
| 4 |
+
|
| 5 |
+
This license (henceforth: NB-license) establishes terms and conditions for use
|
| 6 |
+
of Borealis models with the following copyright notice: Borealis Copyright 2026
|
| 7 |
+
Nasjonalbiblioteket.
|
| 8 |
+
|
| 9 |
+
This model is a fine-tuned derivative of Gemma 3, licensed under the Gemma Terms
|
| 10 |
+
of Use. The original model is available from Google at
|
| 11 |
+
https://deepmind.google/models/gemma/gemma-3/. Modifications, fine-tuning, and
|
| 12 |
+
subsequent derivative works are distributed under the NB-license. The original
|
| 13 |
+
Gemma Terms of Use notices, disclaimers, attribution, and use restrictions
|
| 14 |
+
remain fully intact and are provided at https://ai.google.dev/gemma/terms. The
|
| 15 |
+
additional usage restrictions apply only to our derivative work.
|
| 16 |
+
|
| 17 |
+
1. Definitions.
|
| 18 |
+
|
| 19 |
+
- "License" means the terms and conditions for use, reproduction, and
|
| 20 |
+
Distribution as defined in this document.
|
| 21 |
+
|
| 22 |
+
- "Licensor" means the copyright owner or entity authorized by the copyright
|
| 23 |
+
owner that is granting the License, including the persons or entities that may
|
| 24 |
+
have rights in the Model and/or distributing the Model.
|
| 25 |
+
|
| 26 |
+
- "You" (or "Your") means an individual or Legal Entity exercising permissions
|
| 27 |
+
granted by this License and/or making use of the Model for whichever purpose and
|
| 28 |
+
in any field of use, including usage of the Model in an end-use application -
|
| 29 |
+
e.g. chatbot, translator, image generator.
|
| 30 |
+
|
| 31 |
+
- "Third Parties" means individuals or legal entities that are not under common
|
| 32 |
+
control with Licensor or You.
|
| 33 |
+
|
| 34 |
+
- "Data" means a collection of information and/or content extracted from the
|
| 35 |
+
dataset used with the Model, including to train, pretrain, or otherwise evaluate
|
| 36 |
+
the Model. The Data is not licensed under this License.
|
| 37 |
+
|
| 38 |
+
- "Output" means the results of operating a Model as embodied in informational
|
| 39 |
+
content resulting therefrom.
|
| 40 |
+
|
| 41 |
+
- "Model" means any accompanying machine-learning based assemblies (including
|
| 42 |
+
checkpoints), consisting of learnt weights, parameters (including optimizer
|
| 43 |
+
states), corresponding to the model architecture as embodied in the
|
| 44 |
+
Complementary Material, that have been trained or tuned, in whole or in part on
|
| 45 |
+
the Data, using the Complementary Material.
|
| 46 |
+
|
| 47 |
+
- "Derivatives of the Model" means all modifications to the Model, works based
|
| 48 |
+
on the Model, or any other model which is created or initialized by transfer of
|
| 49 |
+
patterns of the weights, parameters, activations or output of the Model, to the
|
| 50 |
+
other model, in order to cause the other model to perform similarly to the
|
| 51 |
+
Model, including - but not limited to - distillation methods entailing the use
|
| 52 |
+
of intermediate data representations or methods based on the generation of
|
| 53 |
+
synthetic data by the Model for training the other model.
|
| 54 |
+
|
| 55 |
+
- "Complementary Material" means the accompanying source code and scripts used
|
| 56 |
+
to define, run, load, benchmark or evaluate the Model, and used to prepare data
|
| 57 |
+
for training or evaluation, if any. This includes any accompanying
|
| 58 |
+
documentation, tutorials, examples, etc, if any.
|
| 59 |
+
|
| 60 |
+
- "Distribution" means any transmission, reproduction, publication or other
|
| 61 |
+
sharing of the Model or Derivatives of the Model to a third party, including
|
| 62 |
+
providing the Model as a hosted service made available by electronic or other
|
| 63 |
+
remote means - e.g. API-based or web access.
|
| 64 |
+
|
| 65 |
+
- “Use” includes accessing and utilizing a Model or Derivates of a Model, which
|
| 66 |
+
may also include creating content, fine-tuning, updating, running, training,
|
| 67 |
+
evaluating and/or re-parametrizing such Model or Derivates of a Model.
|
| 68 |
+
|
| 69 |
+
- "Contribution" means any work of authorship, including the original version of
|
| 70 |
+
the Model and any modifications or additions to that Model or Derivatives of the
|
| 71 |
+
Model thereof, that is intentionally submitted to Licensor for inclusion in the
|
| 72 |
+
Model.
|
| 73 |
+
|
| 74 |
+
- "Contributor" means Licensor and any individual or Legal Entity on behalf of
|
| 75 |
+
whom a Contribution has been received by Licensor and subsequently incorporated
|
| 76 |
+
within the Model.
|
| 77 |
+
|
| 78 |
+
2. Grant of License.
|
| 79 |
+
|
| 80 |
+
Subject to the terms and conditions of this License, each Contributor hereby
|
| 81 |
+
grants to You a time-unlimited, worldwide, non-exclusive, no-charge, royalty-
|
| 82 |
+
free license to use, make, have made, reproduce, prepare derivatives of the
|
| 83 |
+
model, publicly display, publicly perform, sublicense, offer to sell, sell,
|
| 84 |
+
import and otherwise transfer or distribute the model and derivatives of the
|
| 85 |
+
model.
|
| 86 |
+
|
| 87 |
+
3. Redistribution
|
| 88 |
+
|
| 89 |
+
You may reproduce and distribute copies of the model or derivatives of the model
|
| 90 |
+
in any medium, with or without modifications, provided that You meet the
|
| 91 |
+
following conditions: (a) You must give any other recipients of the model or
|
| 92 |
+
derivatives of the model a copy of this License; and (b) You must retain all
|
| 93 |
+
copyright notices in any redistribution of the model or derivatives of the
|
| 94 |
+
model, excluding those notices that do not pertain to any part of a derivative
|
| 95 |
+
of the model; and (c) You must include the use-based restrictions in section 4
|
| 96 |
+
as a condition precedent to effect any type of legal agreement (e.g. a license)
|
| 97 |
+
governing the use and/or distribution of the model or its Derivatives, and give
|
| 98 |
+
such notice to any subsequent Third Party recipients;
|
| 99 |
+
|
| 100 |
+
4. Use-based Restrictions.
|
| 101 |
+
|
| 102 |
+
You can only use the Model in compliance with the following conditions:
|
| 103 |
+
|
| 104 |
+
(a) You must comply with applicable laws and regulations.
|
| 105 |
+
|
| 106 |
+
(b) You must not use the model to intentionally recreate material from the
|
| 107 |
+
training data, whether protected by intellectual property rights or as personal
|
| 108 |
+
data
|
| 109 |
+
|
| 110 |
+
(c) Neither the name of the National library nor the names of creators or
|
| 111 |
+
publishers of training data may be used to endorse or promote products derived
|
| 112 |
+
from this model without specific prior written permission.
|
| 113 |
+
|
| 114 |
+
(d) You must not use the Model or its outputs, to provide end-user services
|
| 115 |
+
whose primary purpose is to summarize, restate, copy, or otherwise replace
|
| 116 |
+
services for access to the press publications licensed as training data, unless you have a separate agreement with the
|
| 117 |
+
copyright holders. This includes, but is not limited to, services that provide
|
| 118 |
+
users with functional substitutes for access to the original press content.
|
| 119 |
+
|
| 120 |
+
5. Outputs.
|
| 121 |
+
|
| 122 |
+
Except as set forth herein, Licensor claims no rights in the Output You generate
|
| 123 |
+
with a model. You are accountable for the Output You generate and its subsequent
|
| 124 |
+
uses. No use of the Output may contravene any provision as stated in this
|
| 125 |
+
License, hereunder section 4 on use-based restrictions.
|
| 126 |
+
|
| 127 |
+
6. Disclaimer of Warranty.
|
| 128 |
+
|
| 129 |
+
Unless required by applicable law or agreed to in writing, Licensor provides the
|
| 130 |
+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 131 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
| 132 |
+
including, without limitation, any warranties or conditions of TITLE, NON-
|
| 133 |
+
INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
| 134 |
+
solely responsible for determining the appropriateness of using or
|
| 135 |
+
redistributing the Work and assume any risks associated with Your exercise of
|
| 136 |
+
permissions under this License. The Licensor makes no representations or
|
| 137 |
+
warranties that the Model or its Output will be free from factual inaccuracies,
|
| 138 |
+
biases, or potential misinterpretation of the underlying training data. You are
|
| 139 |
+
solely responsible for ensuring that any use of the Model adheres to applicable
|
| 140 |
+
legal and ethical standards.
|
| 141 |
+
|
| 142 |
+
7. Limitation of Liability.
|
| 143 |
+
|
| 144 |
+
In no event and under no legal theory, whether in tort (including negligence),
|
| 145 |
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
| 146 |
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
| 147 |
+
liable to You for damages, including any direct, indirect, special, incidental,
|
| 148 |
+
or consequential damages of any character arising as a result of this License or
|
| 149 |
+
out of the use or inability to use the Work (including but not limited to
|
| 150 |
+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
| 151 |
+
any and all other commercial damages or losses), even if such Contributor has
|
| 152 |
+
been advised of the possibility of such damages.
|
| 153 |
+
|
| 154 |
+
8. Accepting Warranty or Additional Liability.
|
| 155 |
+
|
| 156 |
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
| 157 |
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
| 158 |
+
other liability obligations and/or rights consistent with this License. However,
|
| 159 |
+
in accepting such obligations, You may act only on Your own behalf and on Your
|
| 160 |
+
sole responsibility, not on behalf of any other Contributor, and only if You
|
| 161 |
+
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
| 162 |
+
incurred by, or claims asserted against, such Contributor by reason of your
|
| 163 |
+
accepting any such warranty or additional liability.
|
| 164 |
+
|
| 165 |
+
9. Term and Termination.
|
| 166 |
+
|
| 167 |
+
The term of this Agreement will commence upon your acceptance of this Agreement
|
| 168 |
+
and will continue in full force and effect until terminated in accordance with
|
| 169 |
+
the terms and conditions herein. Licensor may terminate this Agreement if you
|
| 170 |
+
are in breach of any term or condition of this Agreement. Upon termination of
|
| 171 |
+
this Agreement, you shall cease use of the licensed model. Section 7 shall
|
| 172 |
+
survive the termination of this Agreement. Termination of the agreement does not
|
| 173 |
+
affect your continued rights to use parts of the model the licensed model was
|
| 174 |
+
based on (if warm trained) under its original license.
|
| 175 |
+
|
| 176 |
+
10. Governing Law and Jurisdiction.
|
| 177 |
+
|
| 178 |
+
This Agreement will be governed and construed under the laws of Norway. The Oslo
|
| 179 |
+
District Court shall have exclusive jurisdiction of any dispute arising out of
|
| 180 |
+
this Agreement.
|
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:e37c73062cb5c762392d1e17cdc4f5a7d777841a338a50c50017baf1ab9998c1
|
| 3 |
+
size 336316
|
README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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+
- conversational
|
| 15 |
+
- instruct
|
| 16 |
+
- borealis
|
| 17 |
+
- gemma3
|
| 18 |
+
- gguf
|
| 19 |
+
- quantized
|
| 20 |
+
- norwegian
|
| 21 |
+
- norwegian-bokmal
|
| 22 |
+
- norwegian-nynorsk
|
| 23 |
+
- full-release
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
|
| 28 |
+
# Borealis 4B GGUF
|
| 29 |
+
|
| 30 |
+
## Model Summary
|
| 31 |
+
|
| 32 |
+
**NbAiLab/borealis-4b-gguf** is a GGUF release of **4B-parameter** instruction-tuned **full release** model in the Borealis family from the National Library of Norway (Nasjonalbiblioteket, NB).
|
| 33 |
+
|
| 34 |
+
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.
|
| 35 |
+
|
| 36 |
+
All Borealis released models are based on the **Gemma 3** family. This GGUF repository is based on the corresponding [NbAiLab/borealis-4b](https://huggingface.co/NbAiLab/borealis-4b) safetensors release.
|
| 37 |
+
|
| 38 |
+
### Sizes
|
| 39 |
+
|
| 40 |
+
| Size | Full release | Open release |
|
| 41 |
+
|---:|---|---|
|
| 42 |
+
| 27B | [NbAiLab/borealis-27b](https://huggingface.co/NbAiLab/borealis-27b) | [NbAiLab/borealis-open-27b](https://huggingface.co/NbAiLab/borealis-open-27b) |
|
| 43 |
+
| 12B | [NbAiLab/borealis-12b](https://huggingface.co/NbAiLab/borealis-12b) | [NbAiLab/borealis-open-12b](https://huggingface.co/NbAiLab/borealis-open-12b) |
|
| 44 |
+
| 4B | [NbAiLab/borealis-4b](https://huggingface.co/NbAiLab/borealis-4b) | [NbAiLab/borealis-open-4b](https://huggingface.co/NbAiLab/borealis-open-4b) |
|
| 45 |
+
| 1B | [NbAiLab/borealis-1b](https://huggingface.co/NbAiLab/borealis-1b) | [NbAiLab/borealis-open-1b](https://huggingface.co/NbAiLab/borealis-open-1b) |
|
| 46 |
+
| 270M | [NbAiLab/borealis-270m](https://huggingface.co/NbAiLab/borealis-270m) | [NbAiLab/borealis-open-270m](https://huggingface.co/NbAiLab/borealis-open-270m) |
|
| 47 |
+
|
| 48 |
+
## Training Data
|
| 49 |
+
|
| 50 |
+
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.
|
| 51 |
+
|
| 52 |
+
The SFT dataset for this model is [NbAiLab/aurora-sft](https://huggingface.co/datasets/NbAiLab/aurora-sft). [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.
|
| 53 |
+
|
| 54 |
+
The Norwegian government has entered into an agreement, through the National Library of Norway, to access copyrighted press material via Kopinor on behalf of the Norwegian Media Businesses' Association (MBL), enabling the lawful training, development, maintenance, and public release of Norwegian language models. The agreement covers copyright-protected press publications published in Norway up to one year from the date of publication of the model, effectively creating a rolling cutoff date rather than a fixed historical cutoff. For this release, the cutoff date is January 1, 2025.
|
| 55 |
+
|
| 56 |
+
## Evaluation
|
| 57 |
+
|
| 58 |
+
<figure>
|
| 59 |
+
<img src="./borealis_evals_202605.png" alt="Borealis evaluation results">
|
| 60 |
+
<figcaption>Borealis evaluation results on selected tasks (best score among {0-5}-shot).</figcaption>
|
| 61 |
+
</figure>
|
| 62 |
+
|
| 63 |
+
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. Despite using only around 10k newspaper-derived tasks from the abovementioned agreement, we observe a slight performance increase in some key metrics. We hope to further increase the difference by incorporating proper pre-training on the newspaper material.
|
| 64 |
+
|
| 65 |
+
## Safety and Alignment
|
| 66 |
+
|
| 67 |
+
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.
|
| 68 |
+
|
| 69 |
+
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.
|
| 70 |
+
|
| 71 |
+
### Prompt Baking
|
| 72 |
+
|
| 73 |
+
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.
|
| 74 |
+
|
| 75 |
+
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.
|
| 76 |
+
|
| 77 |
+
## Intended Use
|
| 78 |
+
|
| 79 |
+
- Norwegian-centric assistant-style tasks, including drafting, summarization, Q&A, and light reasoning (this is not a reasoning model).
|
| 80 |
+
- Assessment and improvement of Norwegian writing style and quality.
|
| 81 |
+
- Evaluation of behavior and language coverage for Norwegian, Bokmål, and Nynorsk.
|
| 82 |
+
|
| 83 |
+
## Usage
|
| 84 |
+
|
| 85 |
+
This repository contains GGUF files for `NbAiLab/borealis-4b`. For Transformers or
|
| 86 |
+
vLLM serving from safetensors, use the main model repository: `NbAiLab/borealis-4b`.
|
| 87 |
+
|
| 88 |
+
### llama.cpp
|
| 89 |
+
|
| 90 |
+
Run a GGUF directly from the Hub:
|
| 91 |
+
|
| 92 |
+
```bash
|
| 93 |
+
llama-server -hf NbAiLab/borealis-4b-gguf --port 8080
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
Or download a GGUF file and run it locally:
|
| 97 |
+
|
| 98 |
+
```bash
|
| 99 |
+
llama-cli -m borealis-4b-Q4_K_M.gguf \
|
| 100 |
+
-p "Skriv et kort sammendrag av hva Nasjonalbiblioteket gjør." \
|
| 101 |
+
-n 256
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
For image-text use with llama.cpp, use the matching projector file from this
|
| 105 |
+
repository, for example `mmproj_borealis-4b-BF16.gguf`, together with a model GGUF.
|
| 106 |
+
|
| 107 |
+
### Ollama
|
| 108 |
+
|
| 109 |
+
Run the GGUF repository from Hugging Face:
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
ollama run hf.co/NbAiLab/borealis-4b-gguf
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
For a local GGUF file, create a minimal `Modelfile`:
|
| 116 |
+
|
| 117 |
+
```text
|
| 118 |
+
FROM ./borealis-4b-Q4_K_M.gguf
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
Then create and run the local Ollama model:
|
| 122 |
+
|
| 123 |
+
```bash
|
| 124 |
+
ollama create borealis-4b -f Modelfile
|
| 125 |
+
ollama run borealis-4b "Skriv tre korte punkter om norsk språkteknologi."
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
## Limitations
|
| 129 |
+
|
| 130 |
+
- The model may hallucinate or produce incorrect information.
|
| 131 |
+
- Safety alignment reduces but does not eliminate harmful or inappropriate outputs.
|
| 132 |
+
- Performance outside Norwegian and English use cases has not been fully characterized.
|
| 133 |
+
|
| 134 |
+
## EU AI Act
|
| 135 |
+
|
| 136 |
+
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.
|
| 137 |
+
|
| 138 |
+
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.
|
| 139 |
+
|
| 140 |
+
For additional model-level documentation, see the [Model Documentation Form](./Model_Documentation_Form.pdf).
|
| 141 |
+
|
| 142 |
+
## License
|
| 143 |
+
|
| 144 |
+
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.
|
| 145 |
+
|
| 146 |
+
For more information, see the [LICENSE](./LICENSE) and the [License FAQ](./LICENSE_FAQ.pdf).
|
| 147 |
+
|
| 148 |
+
## Authenticity
|
| 149 |
+
|
| 150 |
+
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.
|
| 151 |
+
|
| 152 |
+
To verify model authenticity and file integrity after downloading the repository, run:
|
| 153 |
+
|
| 154 |
+
```bash
|
| 155 |
+
bash signing/verify.sh
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
For more verification instructions, see [ai.nb.no/verify](https://ai.nb.no/verify).
|
| 159 |
+
|
| 160 |
+
## Weights
|
| 161 |
+
|
| 162 |
+
This repository contains the Transformers (safetensors) release of **NbAiLab/borealis-4b-gguf**.
|
| 163 |
+
|
| 164 |
+
Companion formats:
|
| 165 |
+
- GGUF: [NbAiLab/borealis-4b-gguf](https://huggingface.co/NbAiLab/borealis-4b-gguf)
|
| 166 |
+
- MLX: [NbAiLab/borealis-4b-mlx](https://huggingface.co/NbAiLab/borealis-4b-mlx)
|
| 167 |
+
- MLX 8-bit: [NbAiLab/borealis-4b-mlx-8bits](https://huggingface.co/NbAiLab/borealis-4b-mlx-8bits)
|
| 168 |
+
|
| 169 |
+
## Citation and Contributors
|
| 170 |
+
|
| 171 |
+
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.
|
| 172 |
+
|
| 173 |
+
A tecnical report will be released soon.
|
| 174 |
+
|
| 175 |
+
## Acknowledgements
|
| 176 |
+
|
| 177 |
+
Thanks to the Gemma team at Google for releasing Gemma 3, and to everyone contributing to the Norwegian language technology ecosystem.
|
| 178 |
+
|
| 179 |
+
## Disclaimer
|
| 180 |
+
|
| 181 |
+
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.
|
| 182 |
+
|
| 183 |
+
## Contact
|
| 184 |
+
|
| 185 |
+
For feedback, technical concerns, or collaboration inquiries, please contact <a rel="noopener nofollow" href="mailto:ailab@nb.no">ailab@nb.no</a>.
|
borealis-4b-BF16.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b92f06a1a9033a76c5d6ed6df524d8bb214530004a58a25beeb87d2c99fd0c5
|
| 3 |
+
size 7767804320
|
borealis-4b-Q2_K.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92a0ce403da4f339fe170c5bbc90169911e3f9340f82196f25840b4649235754
|
| 3 |
+
size 1729164960
|
borealis-4b-Q3_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d62d0456894e19a56dcf750abb7e1a84192806efe4aaf7c8e87bf8112664598
|
| 3 |
+
size 2098460320
|
borealis-4b-Q4_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4486e86d94194c631e8c18b530b796b1287fdf959f9a0ac1fb17441beadb8c51
|
| 3 |
+
size 2489894560
|
borealis-4b-Q5_K_M.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:556fc1a44cebcbb5df2d80bff13310b8904957cf4fbf955ca4929bd6c5ad412b
|
| 3 |
+
size 2829698720
|
borealis-4b-Q6_K.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f6fbfe95dafe14bd0a971273a38e142ed8a16aca4cf7e7e765ef52aeb698d1e4
|
| 3 |
+
size 3190740640
|
borealis-4b-Q8_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:799150f7ab450c459cfdd1602d097e0f15e57516c8274be35da514c935ad4776
|
| 3 |
+
size 4130402720
|
borealis.png
ADDED
|
Git LFS Details
|
borealis_evals_202605.png
ADDED
|
Git LFS Details
|
mmproj_borealis-4b-BF16.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9443eda0d5db951c4c54df0b57ff85b99ef3d81b1b6c5f7a50ef6be623576675
|
| 3 |
+
size 851252192
|
signing/SHA256SUMS
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
8b92f06a1a9033a76c5d6ed6df524d8bb214530004a58a25beeb87d2c99fd0c5 borealis-4b-BF16.gguf
|
| 2 |
+
92a0ce403da4f339fe170c5bbc90169911e3f9340f82196f25840b4649235754 borealis-4b-Q2_K.gguf
|
| 3 |
+
6d62d0456894e19a56dcf750abb7e1a84192806efe4aaf7c8e87bf8112664598 borealis-4b-Q3_K_M.gguf
|
| 4 |
+
4486e86d94194c631e8c18b530b796b1287fdf959f9a0ac1fb17441beadb8c51 borealis-4b-Q4_K_M.gguf
|
| 5 |
+
556fc1a44cebcbb5df2d80bff13310b8904957cf4fbf955ca4929bd6c5ad412b borealis-4b-Q5_K_M.gguf
|
| 6 |
+
f6fbfe95dafe14bd0a971273a38e142ed8a16aca4cf7e7e765ef52aeb698d1e4 borealis-4b-Q6_K.gguf
|
| 7 |
+
799150f7ab450c459cfdd1602d097e0f15e57516c8274be35da514c935ad4776 borealis-4b-Q8_0.gguf
|
| 8 |
+
9443eda0d5db951c4c54df0b57ff85b99ef3d81b1b6c5f7a50ef6be623576675 mmproj_borealis-4b-BF16.gguf
|
signing/SHA256SUMS.sig
ADDED
|
Binary file (512 Bytes). View file
|
|
|
signing/ca-chain.pem
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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sopK
|
| 39 |
+
-----END CERTIFICATE-----
|
signing/verify.sh
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|