ner vietnamese electra base

NlpHUST

Introduction

The ner-vietnamese-electra-base model is a fine-tuned version of the NlpHUST/electra-base-vn, optimized for Vietnamese Named Entity Recognition (NER) tasks using the VLSP 2018 dataset. It delivers high precision, recall, and F1 scores across various entity categories, demonstrating its efficacy in recognizing Vietnamese entities.

Architecture

The model is built upon the ELECTRA architecture, leveraging its capabilities for token classification. It utilizes the Transformers library and is implemented in PyTorch, allowing for efficient model operations and integration with existing ML pipelines.

Training

The model was trained using a set of hyperparameters that optimize its performance for NER tasks. Key parameters include a learning rate of 5e-05, a training batch size of 16, and evaluation batch size of 4, with training conducted over 10 epochs. The Adam optimizer was used with a linear learning rate scheduler.

Guide: Running Locally

To run the ner-vietnamese-electra-base model locally, follow these steps:

  1. Install Required Libraries: Ensure you have the Transformers library and PyTorch installed. You can do this via pip:

    pip install transformers torch
    
  2. Load the Model: Use the Transformers library to load the model and tokenizer.

    from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
    
    tokenizer = AutoTokenizer.from_pretrained("NlpHUST/ner-vietnamese-electra-base")
    model = AutoModelForTokenClassification.from_pretrained("NlpHUST/ner-vietnamese-electra-base")
    nlp = pipeline("ner", model=model, tokenizer=tokenizer)
    
  3. Perform NER: Input a sample text to extract named entities.

    example = "Liên quan vụ việc CSGT bị tố đánh dân, trúng một cháu nhỏ đang ngủ, đang lan truyền trên mạng xã hội, Đại tá Nguyễn Văn Tảo, Phó Giám đốc Công an tỉnh Tiền Giang vừa có cuộc họp cùng Chỉ huy Công an huyện Châu Thành và một số đơn vị nghiệp vụ cấp tỉnh để chỉ đạo làm rõ thông tin."
    ner_results = nlp(example)
    print(ner_results)
    
  4. Cloud GPUs: For enhanced performance, consider running this on a cloud GPU service like AWS, GCP, or Azure.

License

More information is needed regarding the specific licensing of this model. Please refer to the Hugging Face model card or contact the model authors for further details.

More Related APIs in Token Classification