Instructions to use barbaroo/gptsw3-6.7B-translation-en-fo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use barbaroo/gptsw3-6.7B-translation-en-fo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="barbaroo/gptsw3-6.7B-translation-en-fo")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("barbaroo/gptsw3-6.7B-translation-en-fo") model = AutoModelForCausalLM.from_pretrained("barbaroo/gptsw3-6.7B-translation-en-fo", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use barbaroo/gptsw3-6.7B-translation-en-fo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "barbaroo/gptsw3-6.7B-translation-en-fo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "barbaroo/gptsw3-6.7B-translation-en-fo", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/barbaroo/gptsw3-6.7B-translation-en-fo
- SGLang
How to use barbaroo/gptsw3-6.7B-translation-en-fo 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 "barbaroo/gptsw3-6.7B-translation-en-fo" \ --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": "barbaroo/gptsw3-6.7B-translation-en-fo", "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 "barbaroo/gptsw3-6.7B-translation-en-fo" \ --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": "barbaroo/gptsw3-6.7B-translation-en-fo", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use barbaroo/gptsw3-6.7B-translation-en-fo with Docker Model Runner:
docker model run hf.co/barbaroo/gptsw3-6.7B-translation-en-fo
File size: 3,797 Bytes
41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 b4e33e5 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 03dff8e 41cf027 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | ---
base_model: AI-Sweden-Models/gpt-sw3-6.7b-v2
library_name: transformers
datasets:
- barbaroo/Sprotin_parallel
- barbaroo/fo_en_synthetic
language:
- en
- fo
metrics:
- bleu
- chrf
- bertscore
pipeline_tag: text-generation
---
# Model Card: English–Faroese Translation (Merged Model)
## Model Details
### Model Description
- **Developed by:** Barbara Scalvini
- **Model type:** Fully merged model for **English → Faroese** translation
- **Languages:** English, Faroese
- **License:** Inherits license from the base model (GPT-SW3 6.7B)
- **Finetuned from:** [AI-Sweden-Models/gpt-sw3-6.7b-v2](https://huggingface.co/AI-Sweden-Models/gpt-sw3-6.7b-v2)
- **Library:** [Transformers](https://github.com/huggingface/transformers)
This model is the **merged version** of the PEFT adapter [`barbaroo/gptsw3_translate_synth_6.7B`](https://huggingface.co/barbaroo/gptsw3_translate_synth_6.7B) with its base model.
---
## Uses
### Direct Use
- English → Faroese machine translation.
### Downstream Use
- Can be integrated into **multilingual NLP pipelines** or localization workflows.
### Out-of-Scope Use
- Languages other than English or Faroese.
- Tasks like summarization, classification, or dialogue without further fine-tuning.
---
## Bias, Risks, and Limitations
- As with all translation models, may reflect **biases** from the training corpora.
- Outputs should be **carefully validated** for sensitive or high-stakes domains.
---
## How to Get Started with the Model
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import re
import pandas as pd
# Model repo
MODEL_NAME = "barbaroo/gptsw3-6.7B-translation-en-fo"
# Quantization config (8-bit)
bnb_config = BitsAndBytesConfig(
load_in_8bit=True
)
# Initialize tokenizer & model
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForCausalLM.from_pretrained(
MODEL_NAME,
quantization_config=bnb_config,
device_map="auto",
)
model.eval()
# Alpaca-style prompt template
alpaca_prompt = """
### Instruction:
{}
### Input:
{}
### Response:
{}"""
EOS_TOKEN = tokenizer.eos_token
print("EOS token:", EOS_TOKEN)
# Example sentences
sentences = ["I love Faroese!"]
translations = []
for sentence in sentences:
inputs = tokenizer(
[
alpaca_prompt.format(
"Translate this sentence from English to Faroese:",
sentence,
"",
)
],
return_tensors="pt"
).to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=500,
use_cache=True,
do_sample=True,
temperature=0.1,
top_p=1,
)
output_string = tokenizer.batch_decode(outputs, skip_special_tokens=False)[0]
try:
response = output_string.split("Response:\n", 1)[1]
translation = response.replace(EOS_TOKEN, "")
except IndexError:
translation = ""
translations.append(translation)
print(translation)
```
## Training Details
### Training Data
- [barbaroo/Sprotin_parallel](https://huggingface.co/datasets/barbaroo/Sprotin_parallel)
- [barbaroo/fo_en_synthetic](https://huggingface.co/datasets/barbaroo/fo_en_synthetic)
### Procedure
- Initially trained as a **PEFT adapter** using Alpaca-style prompts.
- Then **merged with the base GPT-SW3 6.7B model** to produce this standalone version.
**Hyperparameters:**
- Epochs: 3 (early stopping on validation loss)
- Batch Size: 2 (with 4 gradient accumulation steps)
- Learning Rate: 2e-4
- Optimizer: AdamW with LR scheduler + warm-up
---
## Evaluation
### Test Data
- FLORES-200 benchmark (~1012 English–Faroese pairs).
### Metrics
- **BLEU:** 19.8
- **chrF:** 52.4
|