Downloads · 30 days
15
5% of all-time downloads
alakxender/gemma-3-270m-dhivehi-pt
gemma-3-270m-dhivehi-pt is a text generation model from alakxender. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Compact Dhivehi (ދިވެހި) pretrained model based on google/gemma-3-270m, trained on a large corpus of Dhivehi text data including news articles, Wikipedia content, and general web text.
Downloads · 30 days
15
5% of all-time downloads
All-time downloads
301
Public
Parameters
268M
574 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors536 MB · 93%
From the Hugging Face model README
Compact Dhivehi (ދިވެހި) pretrained model based on google/gemma-3-270m, trained on a large corpus of Dhivehi text data including news articles, Wikipedia content, and general web text.
Note: This model is specifically pretrained on Dhivehi text and provides a strong foundation for further fine-tuning on specific tasks or direct use for text generation.
google/gemma-3-270mThe model was pretrained on a comprehensive corpus of Dhivehi text data:
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch
# Load model
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch
# Load model
model_path = "alakxender/gemma-3-270m-dhivehi-pt"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype="auto",
device_map="auto",
)
# Method 1: Direct text generation
prompt = "ދިވެހިރާއްޖެއަކީ"
# Tokenize input
inputs = tokenizer(
prompt,
return_tensors="pt",
padding=True
)
# Move inputs to the same device as the model
if torch.cuda.is_available():
inputs = {k: v.to(model.device) for k, v in inputs.items()}
# Generate content
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=150,
# num_return_sequences=1,
# temperature=0.8,
# do_sample=True,
# pad_token_id=tokenizer.eos_token_id,
# eos_token_id=tokenizer.eos_token_id,
# repetition_penalty=1.1,
)
# Decode generated text
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Extract only the newly generated part
generated_only = generated_text[len(prompt):].strip()
print(f"Generated: {generated_only}")
# `gemma-3-270m-dhivehi-pt`: އަޅުގަނޑުމެންގެ ގޮނޑުދޮށްތަކާއި ފަރުބަދަތަކާއި އުތުރު ހިންދުސްތާނުގެ ވަކިވަކި ހިސާބުގައި ދިރިއުޅޭ ދިވެހިންގެ މެދުގައި އޮންނަ ގުދުރަތީ ކަންކަން ދެކިލުމުގެ ފުރުޞަތު އޮތް ޤައުމެއްކަމުގައި ދުވަހަކުވެސް ހިޔެއްނުކުރާނެއެވެ. 33 އަހަރުގެ ވެރިކަމުން މިދެންނެވި
# `google/gemma-3-270m`: ވެސް އޭނާގެ ރާއްޖެއެއްކަމަށް ވެރިކަން ނުވަތަ ޓީމް ނޭޝަނަލްގެ ބައިވެރިވަރމް އޭޝިޔާގެ ހައިސިއްޔަތް ބޯޑިޔަށް ނުހުންދާ ކަމަށް ލިޔުއްވައިގައެވެ. ދިވެހިންނާއި މިއީ އެއާ އޭޝިޔާގެ ބަޔާންކޮށް ނިޒާމް ނެތުމުގައި ދާއިރާއަށް އޭޝިޔާއަށް ދެއްވައިދޭ މަލިވާރުކަމަށް
max_new_tokens: Controls the length of generated text (64-512 recommended)temperature: Controls randomness (0.1-1.0, higher = more creative)top_p: Nucleus sampling parameter (0.1-1.0)top_k: Top-k sampling parameter (1-100)do_sample: Boolean flag to enable/disable sampling