transformers tf roberta token-classification generated_from_keras_callback base_model:FacebookAI/roberta-large base_model:finetune:FacebookAI/roberta-large license:mit autotrain_compatible endpoints_compatible region:us
---
base_model: FacebookAI/roberta-large
license: mit
tags:
- generated_from_keras_callback
model-index:
- name: ner-test
  results: []
---

<!-- This model card has been generated automatically according to the information Keras had access to. You should
probably proofread and complete it, then remove this comment. -->

## roberta-large-finetuned-ner

## Model description

**roberta-large-finetuned-ner** is a fine-tuned Roberta model that is ready to use for **Named Entity Recognition**. It has been trained to recognize eight types of entities:
Geographical, Organization, Person, Geopolitical Entity, Time indicator, Artifact, Event, Natural Phenomenon.
This model is a fine-tuned version of [FacebookAI/roberta-large](https://huggingface.co/FacebookAI/roberta-large) on an [Named Entity Recognition (NER) Corpus dataset](https://www.kaggle.com/datasets/naseralqaydeh/named-entity-recognition-ner-corpus).

It achieves the following results on the evaluation set:
- Train Loss: 0.1164
- Validation Loss: 0.0878
- Train Precision: 0.8442
- Train Recall: 0.8358
- Train F1: 0.8400
- Train Accuracy: 0.9718
- Epoch: 0

## Intended uses & limitations

#### How to use:

You can use this model with Transformers pipeline for NER.
```python
 from transformers import AutoTokenizer, TFAutoModelForTokenClassification
 from transformers import pipeline

 tokenizer = AutoTokenizer.from_pretrained("Astral7/roberta-large-finetuned-ner",add_prefix_space=True)
 model = TFAutoModelForTokenClassification.from_pretrained("Astral7/roberta-large-finetuned-ner")
 
 nlp_pipe = pipeline("token-classification", model=model,tokenizer=tokenizer )
 example = "My name is Clara and I live in Berkeley, California."

 results=nlp_pipe(example)
 print(results)
```

#### Limitations:

This model is limited by its training dataset of Annotated Corpus for Named Entity Recognition is annotated Corpus for Named Entity Recognition 
using GMB(Groningen Meaning Bank) corpus for entity classification with enhanced and popular features 
by Natural Language Processing applied to the data set.

## Training and evaluation data

This model was fine-tuned on Corpus for [Named Entity Recognition Dataset](https://www.kaggle.com/datasets/naseralqaydeh/named-entity-recognition-ner-corpus).

As in the dataset, each token will be classified as one of the following classes:

Abbreviation|Description
-|-
B-eve| Event
I-eve | Event
B-org | Organization
I-org | Organization
B-gpe | Geopolitical Entity
I-gpe | Geopolitical Entity
B-geo | Geographical
I-geo | Geographical
B-nat | Natural Phenomenon
I-nat | Natural Phenomenon
B-per | Person
I-per | Person
B-art | Art
I-art | Art
B-tim | Time
I-tim | Time

## Training procedure

This model was trained on a single T4 GPU.

### Training hyperparameters

The following hyperparameters were used during training:
- optimizer:
  {
    "name": "AdamWeightDecay",
    "learning_rate": {
        "module": "keras.optimizers.schedules",
        "class_name": "PolynomialDecay",
        "config": {
            "initial_learning_rate": 2e-05,
            "decay_steps": 4795,
            "end_learning_rate": 0.0,
            "power": 1.0,
            "cycle": False,
            "name": None,
        },
        "registered_name": None,
    },
    "decay": 0.0,
    "beta_1": 0.9,
    "beta_2": 0.999,
    "epsilon": 1e-08,
    "amsgrad": False,
    "weight_decay_rate": 0.01,
}          - 
- training_precision: float32

### Training results

| Train Loss | Validation Loss | Train Precision | Train Recall | Train F1 | Train Accuracy | Epoch |
|:----------:|:---------------:|:---------------:|:------------:|:--------:|:--------------:|:-----:|
| 0.1164     | 0.0878          | 0.8442          | 0.8358       | 0.8400   | 0.9718         | 0     |


### Framework versions

- Transformers 4.35.2
- TensorFlow 2.15.0
- Datasets 2.17.1
- Tokenizers 0.15.2
