DeepakKumarMSL commited on
Commit
63f08fe
·
verified ·
1 Parent(s): deaf973

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +85 -0
README.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Custom BERT NER Model
2
+
3
+ This repository contains a BERT-based Named Entity Recognition (NER) model fine-tuned on the CoNLL-2003 dataset. The model is trained to identify common named entity types such as persons, organizations, locations, and miscellaneous entities.
4
+
5
+ ---
6
+
7
+ ## Model Details
8
+
9
+ - **Model architecture:** BERT (bert-base-cased)
10
+ - **Task:** Token classification / Named Entity Recognition (NER)
11
+ - **Training data:** CoNLL-2003 dataset (~14,000 training samples)
12
+ - **Number of epochs:** 5
13
+ - **Framework:** Hugging Face Transformers + Datasets
14
+ - **Device:** CUDA-enabled GPU for training and inference
15
+ - **WandB:** Disabled during training
16
+
17
+ ---
18
+
19
+ ## Usage
20
+
21
+ You can use this model for token classification to identify named entities in your text.
22
+
23
+ ### Installation
24
+
25
+ ```python
26
+ pip install transformers datasets torch
27
+ ```
28
+
29
+ ## Load the model and tokenizer
30
+
31
+ ```pyhton
32
+
33
+ from transformers import BertTokenizerFast, BertForTokenClassification
34
+ import torch
35
+
36
+ model_name_or_path = "AventIQ-AI/Custom-BERT-NER-Model"
37
+
38
+ tokenizer = BertTokenizerFast.from_pretrained(model_name_or_path)
39
+ model = BertForTokenClassification.from_pretrained(model_name_or_path)
40
+
41
+ model.to("cuda") # or "cpu"
42
+ model.eval()
43
+ ```
44
+
45
+ ## Example inference
46
+
47
+ ```python
48
+
49
+ text = "Hi, I am Deepak and I am living in Delhi."
50
+
51
+ tokens = tokenizer(text, return_tensors="pt").to(model.device)
52
+ outputs = model(**tokens)
53
+ predictions = torch.argmax(outputs.logits, dim=2)
54
+
55
+ labels = [model.config.id2label[p.item()] for p in predictions[0]]
56
+ for token, label in zip(tokenizer.tokenize(text), labels):
57
+ print(f"{token}: {label}")
58
+ ```
59
+
60
+ ## Training Details
61
+
62
+ - Dataset: CoNLL-2003, loaded via the Hugging Face datasets library
63
+
64
+ - Optimizer: AdamW
65
+
66
+ - Learning Rate: 5e-5
67
+
68
+ - Batch Size: 16
69
+
70
+ - Max Sequence Length: 128
71
+
72
+ - Epochs: 5
73
+
74
+ - Evaluation: Performed on validation split (if applicable)
75
+
76
+ - Quantization: Applied post-training for model size reduction (optional)
77
+
78
+ ## Limitations
79
+
80
+ - The model may not generalize well to unseen entity types or domains outside CoNLL-2003.
81
+
82
+ - It can occasionally mislabel entities, especially for rare or new names.
83
+
84
+ - A CUDA-enabled GPU is required for efficient training and inference.
85
+