Transformers
Safetensors
Divehi
t5
text2text-generation
dhivehi
gpt
llm
thaana
text-gen
text-generation-inference
Instructions to use alakxender/flan-t5-base-alpaca-dv with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use alakxender/flan-t5-base-alpaca-dv with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("alakxender/flan-t5-base-alpaca-dv") model = AutoModelForSeq2SeqLM.from_pretrained("alakxender/flan-t5-base-alpaca-dv", device_map="auto") - Notebooks
- Google Colab
- Kaggle
metadata
library_name: transformers
tags:
- dhivehi
- gpt
- llm
- thaana
- text-gen
license: mit
datasets:
- alakxender/alpaca_dhivehi
language:
- dv
metrics:
- rouge
base_model:
- google/flan-t5-base
Alpaca Dhivehi Fine-Tuned Flan-T5
This repository contains a fine-tuned Flan-T5 model on the Alpaca Dhivehi dataset, aimed at enabling Dhivehi language instruction-following tasks.
Note: The model can follow instructions and inputs to some extent, but it’s not strictly trained for perfect adherence. Outputs may be partially aligned but are not guaranteed to be fully accurate. Treat results as experimental.
Model Details
- Base model:
google/flan-t5-small(or whichever size you used) - Dataset: Alpaca Dhivehi , Translation from English to Dhivehi
- Training epochs: 3
- Final evaluation:
eval_loss: 2.94ROUGE-1: 0.10ROUGE-2: 0.03ROUGE-L: 0.099- Runtime: 1191 seconds (~20 minutes)
- ~4.3 samples/sec, ~2.17 steps/sec
Usage
To run inference using the fine-tuned model:
import torch
from transformers import T5Tokenizer, T5ForConditionalGeneration
MODEL_PATH = "alakxender/flan-t5-base-alpaca-dv"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = T5Tokenizer.from_pretrained(MODEL_PATH)
model = T5ForConditionalGeneration.from_pretrained(MODEL_PATH).to(device)
def generate_response(instruction, input_text):
combined_input = f"{instruction.strip()} {input_text.strip()}" if input_text else instruction.strip()
inputs = tokenizer(combined_input, return_tensors="pt", truncation=True, max_length=256).to(device)
output_ids = model.generate(
**inputs,
max_new_tokens=256,
num_beams=8,
repetition_penalty=1.5,
no_repeat_ngram_size=3,
do_sample=True,
early_stopping=True,
temperature=0.1
)
decoded_output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
return decoded_output
# Example usage:
instruction = "ދީފައިވާ މައުޟޫޢާ ބެހޭގޮތުން ކުރު ޕެރެގްރާފެއް ލިޔެލާށެވެ."
input_text = "އިއާދަކުރަނިވި ހަކަތަ ބޭނުންކުރުމުގެ މުހިންމުކަން"
print(generate_response(instruction, input_text))
އިއާދަކުރަނިވި ހަކަތަ ބޭނުންކުރުމުގެ މުހިންމު އެއް މައުޟޫއަކީ ސޯލާ، ވިންޑް، ހައިޑްރޯ، ޖިއޮތަރމަލް، އަދި ހައިޑްރޯއިލެކްޓްރިކް ޕަވަރ ފަދަ އިއާދަކުރަނިވި ހަކަތައިން ގްރީންހައުސް ގޭސްތައް ބޭރުވުން .....
Evaluation Results
From the last evaluation:
{'eval_loss': 2.9449,
'eval_rouge1': 0.1003,
'eval_rouge2': 0.0335,
'eval_rougeL': 0.0993,
'eval_rougeLsum': 0.0993,
'eval_runtime': 1191.5,
'eval_samples_per_second': 4.34,
'eval_steps_per_second': 2.17,
'epoch': 3.0}
Notes
- This fine-tuned model is experimental and intended for research on Dhivehi-language instruction-following tasks.