dipawidia commited on
Commit
dd47d9d
1 Parent(s): e1e1134

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -6
README.md CHANGED
@@ -3,9 +3,17 @@ license: mit
3
  base_model: xlnet-base-cased
4
  tags:
5
  - generated_from_keras_callback
 
 
 
6
  model-index:
7
  - name: dipawidia/xlnet-base-cased-product-review-sentiment-analysis
8
  results: []
 
 
 
 
 
9
  ---
10
 
11
  <!-- This model card has been generated automatically according to the information Keras had access to. You should
@@ -13,7 +21,7 @@ probably proofread and complete it, then remove this comment. -->
13
 
14
  # dipawidia/xlnet-base-cased-product-review-sentiment-analysis
15
 
16
- This model is a fine-tuned version of [xlnet-base-cased](https://huggingface.co/xlnet-base-cased) on an unknown dataset.
17
  It achieves the following results on the evaluation set:
18
  - Train Loss: 0.1085
19
  - Train Accuracy: 0.9617
@@ -21,13 +29,48 @@ It achieves the following results on the evaluation set:
21
  - Validation Accuracy: 0.9414
22
  - Epoch: 4
23
 
24
- ## Model description
25
 
26
- More information needed
27
 
28
- ## Intended uses & limitations
 
 
 
 
 
 
 
 
29
 
30
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  ## Training and evaluation data
33
 
@@ -56,4 +99,4 @@ The following hyperparameters were used during training:
56
 
57
  - Transformers 4.41.2
58
  - TensorFlow 2.15.0
59
- - Tokenizers 0.19.1
 
3
  base_model: xlnet-base-cased
4
  tags:
5
  - generated_from_keras_callback
6
+ - sentiment analysis
7
+ widget:
8
+ - text: product quality is good. affordable prices and very fast delivery.
9
  model-index:
10
  - name: dipawidia/xlnet-base-cased-product-review-sentiment-analysis
11
  results: []
12
+ language:
13
+ - en
14
+ metrics:
15
+ - accuracy
16
+ library_name: transformers
17
  ---
18
 
19
  <!-- This model card has been generated automatically according to the information Keras had access to. You should
 
21
 
22
  # dipawidia/xlnet-base-cased-product-review-sentiment-analysis
23
 
24
+ This model is a fine-tuned version of [xlnet-base-cased](https://huggingface.co/xlnet-base-cased) on any type of product reviews dataset gathered from several e-commerce such as shopee, tokopedia, blibli, lazada, and zalora.
25
  It achieves the following results on the evaluation set:
26
  - Train Loss: 0.1085
27
  - Train Accuracy: 0.9617
 
29
  - Validation Accuracy: 0.9414
30
  - Epoch: 4
31
 
32
+ ## Intended uses & limitations
33
 
34
+ This fine-tuned XLNet model is used for sentiment analysis with 2 labels text classification: 0 -> Negative; 1 -> Positive.
35
 
36
+ ### Example Pipeline
37
+ ```python
38
+ from transformers import pipeline
39
+ pipe = pipeline("text-classification", model="dipawidia/xlnet-base-cased-product-review-sentiment-analysis")
40
+ pipe("This shoes is awesome")
41
+ ```
42
+ ```
43
+ [{'label': 'Positive', 'score': 0.9995703101158142}]
44
+ ```
45
 
46
+ ### Full classification example
47
+
48
+ ```python
49
+ from transformers import XLNetTokenizer, TFXLNetForSequenceClassification
50
+ import tensorflow as tf
51
+ import numpy as np
52
+
53
+ tokenizer = XLNetTokenizer.from_pretrained("dipawidia/xlnet-base-cased-product-review-sentiment-analysis")
54
+ model = TFXLNetForSequenceClassification.from_pretrained("dipawidia/xlnet-base-cased-product-review-sentiment-analysis")
55
+
56
+ def get_sentimen(text):
57
+ tokenize_text = tokenizer(text, return_tensors = 'tf')
58
+ preds = model.predict(dict(tokenize_text))['logits']
59
+ class_preds = np.argmax(tf.keras.layers.Softmax()(preds))
60
+ if class_preds == 1:
61
+ label = 'Positive'
62
+ else:
63
+ label = 'Negative'
64
+ return(label)
65
+
66
+ get_sentimen('i hate this product')
67
+ ```
68
+
69
+ Output:
70
+
71
+ ```
72
+ Negative
73
+ ```
74
 
75
  ## Training and evaluation data
76
 
 
99
 
100
  - Transformers 4.41.2
101
  - TensorFlow 2.15.0
102
+ - Tokenizers 0.19.1