YashikaNagpal commited on
Commit
cae568a
·
verified ·
1 Parent(s): 9646099

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +70 -0
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Model Overview
3
+
4
+ This model is a Named Entity Recognition (NER) system fine-tuned on the WNUT 17 dataset using DistilBERT. It predicts entity types such as persons, organizations, locations, and more from text.
5
+
6
+ # Model Details
7
+ ```
8
+ Model Type: Transformer-based NER
9
+
10
+ Base Model: DistilBERT (distilbert-base-uncased)
11
+
12
+ Dataset: WNUT 17
13
+
14
+ Training Framework: PyTorch & Hugging Face Transformers
15
+
16
+ Training Epochs: 3
17
+
18
+ Batch Size: 16
19
+
20
+ Learning Rate: 2e-5
21
+
22
+ Optimizer: AdamW
23
+
24
+ Weight Decay: 0.01
25
+
26
+ Evaluation Strategy: Per epoch
27
+ ```
28
+
29
+ # Training Data
30
+
31
+ The model is trained on the WNUT 17 dataset, which contains challenging named entities in social media and conversational text. The dataset provides annotations for named entity recognition, including entity categories such as:
32
+ ```
33
+ person
34
+
35
+ location
36
+
37
+ corporation
38
+
39
+ product
40
+
41
+ creative-work
42
+
43
+ group
44
+ ```
45
+
46
+ # Inference and Usage
47
+
48
+
49
+ ```python
50
+ Loading the Model
51
+
52
+ from transformers import DistilBertForTokenClassification, DistilBertTokenizerFast
53
+ import torch
54
+
55
+ def load_model_and_tokenizer(model_path):
56
+ tokenizer = DistilBertTokenizerFast.from_pretrained('distilbert-base-uncased')
57
+ model = DistilBertForTokenClassification.from_pretrained(model_path)
58
+ return model, tokenizer
59
+
60
+ model_path = "./final_model"
61
+ model, tokenizer = load_model_and_tokenizer(model_path)
62
+ model.eval()
63
+ ```
64
+
65
+ # Example Usage
66
+
67
+ test_sentence = "Apple CEO Tim Cook announced the new iPhone 14 at their headquarters in Cupertino."
68
+ entities = predict_entities(test_sentence, model, tokenizer)
69
+ print(entities)
70
+