Downloads · 30 days
0
mevsg/bntng-dis-v2
bntng-dis-v2 is a machine learning model from mevsg. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This model performs word sense disambiguation for Jawi script text, specifically addressing cases where the same written form can correspond to multiple different words in Malay. The model is fine-tuned from SEA-LION…
Downloads · 30 days
0
Access
Public
Updated Feb 13, 2025
Repo size
336 MB
Likes
0
Public
Click a slice to open those files.
.safetensors336 MB · 100%
From the Hugging Face model README
This model performs word sense disambiguation for Jawi script text, specifically addressing cases where the same written form can correspond to multiple different words in Malay. The model is fine-tuned from SEA-LION (Southeast Asian Language Intelligence Open Network), specifically the 7B instruction-tuned research variant.
Example of ambiguous forms handled:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load the tokenizer from the base model
base_model_path = "aisingapore/sea-lion-7b"
tokenizer = AutoTokenizer.from_pretrained(base_model_path, trust_remote_code=True)
# Load the fine-tuned model
device = 'cuda' if torch.cuda.is_available() else 'cpu'
peft_model_path = "mevsg/bntng-dis-v2"
model = AutoModelForCausalLM.from_pretrained(peft_model_path, trust_remote_code=True)
model.to(device)
# Example usage
prompt = "Apakah perkataan yang sesuai menggantikan 'bntng' dalam ayat berikut:"
input_text = "Langit malam ini penuh dengan bntng yang bersinar terang."
full_prompt = f"### USER:\n{prompt} {input_text}\n\n### RESPONSE:\n"
tokens = tokenizer(full_prompt, return_tensors="pt")
tokens.to(device)
output = model.generate(
tokens["input_ids"],
attention_mask=tokens["attention_mask"],
max_new_tokens=20,
eos_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(output[0], skip_special_tokens=True))