Downloads · 30 days
0
kikeplo/latvian-qwen-0.5b-lora-v2
latvian-qwen-0.5b-lora-v2 is a text generation model from kikeplo. Use it when you need the model to write or continue text. It is set up for transformers.
A Latvian language adaptation of Qwen2.5-0.5B using parameter-efficient LoRA continued pretraining.
Downloads · 30 days
0
Access
Public
Updated Sep 23, 2026
Repo size
63.7 MB
Likes
0
Public
Click a slice to open those files.
.pt34.9 MB · 37%
From the Hugging Face model README
A Latvian language adaptation of Qwen2.5-0.5B using parameter-efficient LoRA continued pretraining.
This project explores adapting a small pretrained causal language model to Latvian using a reproducible data preparation, training, and evaluation pipeline.
This repository contains the LoRA adapter rather than a separate full copy of the base-model weights.
V2 was trained using Latvian text from two training sources:
RaivisDejus/latvian-textThe text was tokenized and packed into 512-token training sequences.
Training configuration:
V2 was evaluated on a held-out LVTB test set using the same evaluation procedure as the base model and V1 adapter.
| Model | Test Loss | Perplexity |
|---|---|---|
| Qwen2.5-0.5B | 3.9584 | 52.38 |
| V1 | 3.7091 | 40.82 |
| V2 | 3.6441 | 38.25 |
Under this evaluation setup, V2 achieved lower test loss and perplexity than both the original base model and V1.
This model is intended primarily for:
It should not be considered a production-ready general-purpose Latvian language model.
This is a relatively small-scale adaptation of a 0.5B-parameter multilingual base model.
Generated text can still contain:
The reported evaluation measures performance on the selected held-out LVTB test set. They should not be interpreted as a complete measure of Latvian language ability.
This repository does not declare a single standalone license for the adapter weights.
The model depends on a base model and training datasets with separate licensing terms. Users should review the applicable terms for each component before using, redistributing, or incorporating the adapter into another system.
Qwen2.5-0.5B is provided under the Apache-2.0 license.
Base model:
https://huggingface.co/Qwen/Qwen2.5-0.5B
The Latvian Treebank (LVTB) is distributed under CC BY-SA 4.0.
Users should comply with the dataset's attribution and share-alike requirements.
The RaivisDejus/latvian-text dataset is currently listed on Hugging Face under CC BY 4.0.
Users should comply with the dataset's attribution requirements and review the dataset card and source-specific terms.
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
base_model_id = "Qwen/Qwen2.5-0.5B"
adapter_id = "YOUR_USERNAME/latvian-qwen-0.5b-lora-v2"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
dtype=torch.float16,
)
model = PeftModel.from_pretrained(
model,
adapter_id,
)
device = "cuda" if torch.cuda.is_available() else "cpu"
model = model.to(device)
model.eval()
prompt = "Latvija ir"
inputs = tokenizer(
prompt,
return_tensors="pt"
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=80,
do_sample=True,
temperature=0.7,
top_p=0.9,
repetition_penalty=1.15,
)
print(
tokenizer.decode(
outputs[0],
skip_special_tokens=True
)
)