hf_mirrors/indonesian-roberta-large-openmind
Model Introduction
Files & versions
Analysis

Indonesian RoBERTa Large

Indonesian RoBERTa Large is a masked language model based on the RoBERTa model. It was trained on the OSCAR dataset, specifically the unshuffled_deduplicated_id subset. The model was trained from scratch and achieved an evaluation loss of 4.801 and an evaluation accuracy of 29.8%.

This model was trained using HuggingFace's Flax framework and is part of the JAX/Flax Community Week organized by HuggingFace. All training was done on a TPUv3-8 VM, sponsored by the Google Cloud team.

All necessary scripts used for training could be found in the Files and versions tab, as well as the Training metrics logged via Tensorboard.

Model

Model#paramsArch.Training/Validation data (text)
indonesian-roberta-large355MRoBERTaOSCAR unshuffled_deduplicated_id Dataset

Evaluation Results

The model was trained for 10 epochs and the following is the final result once the training ended.

train lossvalid lossvalid accuracytotal time
5.194.8010.2982:8:32:28

How to Use

Use in Openmind

from openmind import pipeline, AutoTokenizer, is_torch_npu_available
from openmind_hub import snapshot_download
import torch.nn.functional as F
from torch import Tensor
import openmind
import torch
import argparse
import time

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="jeffding/indonesian-roberta-large-openmind",
    )
    args = parser.parse_args()
    return args

def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"
    
    start_time = time.time()
    
    tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=True)
    pipe = pipeline('fill-mask', model=model_path, torch_dtype=torch.bfloat16, device_map=device)
    MASK_TOKEN = tokenizer.mask_token
    result = pipe("Budi sedang {} di sekolah.".format(MASK_TOKEN))
    print(result)
    
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")
    
if __name__ == "__main__":
    main()

As Masked Language Model

from transformers import pipeline

pretrained_name = "flax-community/indonesian-roberta-large"

fill_mask = pipeline(
    "fill-mask",
    model=pretrained_name,
    tokenizer=pretrained_name
)

fill_mask("Budi sedang <mask> di sekolah.")

Feature Extraction in PyTorch

from transformers import RobertaModel, RobertaTokenizerFast

pretrained_name = "flax-community/indonesian-roberta-large"
model = RobertaModel.from_pretrained(pretrained_name)
tokenizer = RobertaTokenizerFast.from_pretrained(pretrained_name)

prompt = "Budi sedang berada di sekolah."
encoded_input = tokenizer(prompt, return_tensors='pt')
output = model(**encoded_input)

Team Members

  • Wilson Wongso (@w11wo)
  • Steven Limcorn (@stevenlimcorn)
  • Samsul Rahmadani (@munggok)
  • Chew Kok Wah (@chewkokwah)