Nelis5174473/Dutch-QA-Pairs-Rijksoverheid
Viewer • Updated • 1.94k • 36 • 1
How to use Nelis5174473/GovLLM-7B-ultra with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Nelis5174473/GovLLM-7B-ultra")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Nelis5174473/GovLLM-7B-ultra")
model = AutoModelForCausalLM.from_pretrained("Nelis5174473/GovLLM-7B-ultra")
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]:]))How to use Nelis5174473/GovLLM-7B-ultra with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Nelis5174473/GovLLM-7B-ultra"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Nelis5174473/GovLLM-7B-ultra",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Nelis5174473/GovLLM-7B-ultra
How to use Nelis5174473/GovLLM-7B-ultra with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Nelis5174473/GovLLM-7B-ultra" \
--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": "Nelis5174473/GovLLM-7B-ultra",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Nelis5174473/GovLLM-7B-ultra" \
--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": "Nelis5174473/GovLLM-7B-ultra",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Nelis5174473/GovLLM-7B-ultra with Docker Model Runner:
docker model run hf.co/Nelis5174473/GovLLM-7B-ultra
This model is a fine-tuned version of the Dutch conversational model BramVanroy/GEITje-7B-ULTRA on a Dutch question-answer pair dataset of the Dutch Government. This is a Dutch question/answer model ultimately based on Mistral and fine-tuned with SFT and LoRA. The training with 3 epochs took almost 2 hours and was run on an Nvidia A100 (40GB VRAM).
import requests
API_URL = "https://your-own-endpoint.us-east-1.aws.endpoints.huggingface.cloud"
headers = {"Authorization": "Bearer hf_your_own_token"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
output = query({
"inputs": "Geeft de overheid subsidie aan bedrijven?"
})
# print generated answer
print(output[0]['generated_text'])
The following hyperparameters were used during training:
| Epoch | Loss | Grad_norm | learning_rate | step |
|---|---|---|---|---|
| 0.14 | 1.3183 | 0.6038 | 1.3888e-05 | 25/540 |
| 0.42 | 1.0220 | 0.4180 | 2.8765e-05 | 75/540 |
| 0.69 | 0.9251 | 0.4119 | 2.56793-05 | 125/540 |
| 0.97 | 0.9260 | 0.4682 | 2.2592e-05 | 175/540 |
| 1.25 | 0.8586 | 0.5338 | 1.9506e-05 | 225/540 |
| 1.53 | 0.8767 | 0.6359 | 1.6420e-05 | 275/540 |
| 1.80 | 0.8721 | 0.6137 | 1.3333e-05 | 325/540 |
| 2.08 | 0.8469 | 0.7310 | 1.0247e-05 | 375/540 |
| 2.36 | 0.8324 | 0.7945 | 7.1605e-05 | 425/540 |
| 2.64 | 0.8170 | 0.8522 | 4.0741e-05 | 475/540 |
| 2.91 | 0.8185 | 0.8562 | 9.8765e-05 | 525/540 |