PavanDeepak commited on
Commit
18c38c4
·
verified ·
1 Parent(s): a83329a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -23
README.md CHANGED
@@ -23,37 +23,45 @@ The model has demonstrated robust performance with an accuracy of 0.721459, F1 s
23
  ## Model Architecture
24
  The model leverages the BertForSequenceClassification architecture, It has been fine-tuned on the aforementioned dataset, with the following key configuration parameters:
25
 
26
- Hidden size: 768
27
- Number of attention heads: 12
28
- Number of hidden layers: 12
29
- Max position embeddings: 512
30
- Type vocab size: 2
31
- Vocab size: 30522
32
- The model uses the GELU activation function in its hidden layers and applies dropout with a probability of 0.1 to the attention probabilities to prevent overfitting.
33
 
34
  ## Example
35
 
36
  ```from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification```
37
- ```from transformers import AutoTokenizer
38
- ```import numpy as np
39
- ```from scipy.special import expit
40
 
41
 
42
- ```MODEL = f"PavanDeepak/Topic_Classification"
43
- ```tokenizer = AutoTokenizer.from_pretrained(MODEL)
44
 
45
- ```model = AutoModelForSequenceClassification.from_pretrained(MODEL)
46
- ```class_mapping = model.config.id2label
47
 
48
- ```text = "I love chicken manchuria"
49
- ```tokens = tokenizer(text, return_tensors='pt')
50
- ```output = model(**tokens)
51
 
52
- ```scores = output[0][0].detach().numpy()
53
- ```scores = expit(scores)
54
- ```predictions = (scores >= 0.5) * 1
55
 
56
 
57
- ```for i in range(len(predictions)):
58
- ```if predictions[i]:
59
- ```print(class_mapping[i])```
 
 
 
 
 
 
 
 
 
23
  ## Model Architecture
24
  The model leverages the BertForSequenceClassification architecture, It has been fine-tuned on the aforementioned dataset, with the following key configuration parameters:
25
 
26
+ * Hidden size: 768
27
+ * Number of attention heads: 12
28
+ * Number of hidden layers: 12
29
+ * Max position embeddings: 512
30
+ * Type vocab size: 2
31
+ * Vocab size: 30522
32
+ * The model uses the GELU activation function in its hidden layers and applies dropout with a probability of 0.1 to the attention probabilities to prevent overfitting.
33
 
34
  ## Example
35
 
36
  ```from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification```
37
+ ```from transformers import AutoTokenizer```
38
+ ```import numpy as np```
39
+ ```from scipy.special import expit```
40
 
41
 
42
+ ```MODEL = f"PavanDeepak/Topic_Classification"```
43
+ ```tokenizer = AutoTokenizer.from_pretrained(MODEL)```
44
 
45
+ ```model = AutoModelForSequenceClassification.from_pretrained(MODEL)```
46
+ ```class_mapping = model.config.id2label```
47
 
48
+ ```text = "I love chicken manchuria"```
49
+ ```tokens = tokenizer(text, return_tensors='pt')```
50
+ ```output = model(**tokens)```
51
 
52
+ ```scores = output[0][0].detach().numpy()```
53
+ ```scores = expit(scores)```
54
+ ```predictions = (scores >= 0.5) * 1```
55
 
56
 
57
+ ```for i in range(len(predictions)):```
58
+ ```if predictions[i]:```
59
+ ```print(class_mapping[i])```
60
+
61
+ ## Output:
62
+
63
+ * Food
64
+ * Videogames & Shows
65
+ * Homestyle
66
+ * Travel
67
+ * Health