Run this model with HF Jobs
Run BH-Language-AI/bh-translate-1-9b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/BH-Language-AI/bh-translate-1-9b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/BH-Language-AI/bh-translate-1-9b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/BH-Language-AI/bh-translate-1-9b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/BH-Language-AI/bh-translate-1-9b. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use BH-Language-AI/bh-translate-1-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use BH-Language-AI/bh-translate-1-9b with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "BH-Language-AI/bh-translate-1-9b") - Notebooks
- Google Colab
- Kaggle
Ogledala / mirrors: GitCode (AtomGit), CSDN i slični sajtovi automatski miroruju ovaj repo. Zvanična i jedina ažurirana verzija je ovdje na Hugging Face-u; kartice na ogledalima se ne ažuriraju (pa ispravke, npr. tokenizer od 2026-12-05, tamo mogu izostati).
BH-Translate-1-9B — Bosnian↔English translation (LoRA)
LoRA adapter (r16) on top of Qwen/Qwen3.5-9B (Apache-2.0), trained on 60k
en↔bs pairs from OPUS-100. Renamed from bs-qwen35-9b-mt-v01 → bh-translate-1-9b (Gen-1 standard bh-translate-1-{size}). The old repo stays untouched. Member of the
BH-Translate collection.
Training
- Base:
Qwen/Qwen3.5-9Brevc20223623576· LoRA r16/α32, lr 2e-5, 1 epoch, packing, 7.500 steps (LUMI-G MI250X, ~1.5 h) - Data: bs-lang-mt-enbs-v01
(OPUS-100
bs-en, 895k cleaned; 60k used) — mixed licenses from the original OPUS corpora, for research use only - Train loss 1.02 · val loss 1.10 (gap 0.08, no overfitting)
Eval (OPUS-100 test, 1.966, held-out)
Measured with thinking OFF (see Usage) + continuation truncation at \nuser:
| direction | chrF++ |
|---|---|
| en→bs | 35.5 |
| bs→en | 19.3 |
Caveats: the OPUS-100 subtitle references are noisy (incorrect alignments,
ekavica — the ekavian counterpart of ijekavica — in the en→bs references while the model produces ijekavica) — the numbers are a
lower bound, not a SOTA claim. sacrebleu 2.6.0 corpus_bleu returns 0.0 even for
identical sentences (a bug in that version), so BLEU is not reported. External clean eval
(Flores/Tatoeba) is blocked — gated on the Hub; a BH golden set is planned.
Usage (thinking OFF + stop required)
from transformers import AutoProcessor, AutoModelForImageTextToText
from peft import PeftModel
import torch
base = "Qwen/Qwen3.5-9B"
model = AutoModelForImageTextToText.from_pretrained(
base, dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
model = PeftModel.from_pretrained(model, "BH-Language-AI/bh-translate-1-9b")
proc = AutoProcessor.from_pretrained(base, trust_remote_code=True)
prompt = proc.apply_chat_template(
[{"role": "user", "content": "Prevedi sljedeći tekst s engleskog na bosanski:\nHello world."}],
tokenize=False, add_generation_prompt=True, enable_thinking=False)
inp = proc(text=prompt, return_tensors="pt").to(model.device)
out = model.generate(**inp, max_new_tokens=256, do_sample=False,
stop_strings=["\nuser\n", "<|im_start|>"],
tokenizer=proc.tokenizer)
print(proc.decode(out[0][inp["input_ids"].shape[1]:], skip_special_tokens=True))
Without enable_thinking=False the model thinks in English instead of translating;
without stop strings it keeps inventing the next dialogue turns.
Limitations
- Short subtitle style dominates; long/professional texts are weaker (phase 2)
- LoRA adapter only — merge + Q8 follow
- No baseline comparison with the base on the same test (planned)
License
Apache-2.0 (base and adapter). Training data: mixed licenses (see the dataset card).
- Downloads last month
- 45