alakxender/dhivehi-quick-spell-check-t5

🤗 Hugging Face 来源apache-2.060M 参数242 MBsafetensors✓ 1 个校验和今天更新
一条命令提交

在你的模型文件夹旁边运行它。它会制作种子、将文件与 Hugging Face 比对,然后提交。你只需开始做种,并粘贴你账户中的密钥。它只读取你的文件,绝不修改。如果愿意,可以先阅读脚本。

curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo alakxender/dhivehi-quick-spell-check-t5 ./model-folder
需要做种者 →

T5 Dhivehi Typo Correction

A fine-tuned T5 model for correcting typos in Dhivehi text. This project uses a custom-trained T5-small model to detect and fix spelling errors in Dhivehi text.

Overview

This project implements a spell-checking system using:

  • T5-small as the base model
  • Custom Dhivehi tokenizer
  • Weights & Biases for experiment tracking
  • Hugging Face's Transformers library

Training parameters:

  • Learning rate: 3e-4
  • Batch size: 64
  • Training epochs: 3
  • Weight decay: 0.01
  • Warmup ratio: 0.1
  • Maximum sequence length: 128 tokens

Usage

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch

# Load the model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("alakxender/dhivehi-quick-spell-check-t5")
model = AutoModelForSeq2SeqLM.from_pretrained("alakxender/dhivehi-quick-spell-check-t5")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)

# Correct text
def correct_text(input_text):
    input_text = "fix: " + input_text
    inputs = tokenizer(input_text, return_tensors="pt", max_length=128, truncation=True)
    inputs = inputs.to(device)
    
    outputs = model.generate(
        input_ids=inputs["input_ids"],
        attention_mask=inputs.get("attention_mask", None),
        max_length=128,
        num_beams=4,
        early_stopping=True
    )
    
    return tokenizer.decode(outputs[0], skip_special_tokens=True)