dipawidia/xlnet-base-cased-product-review-sentiment-analysis
057
<!-- 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. -->
dipawidia/xlnet-base-cased-product-review-sentiment-analysis
This model is a fine-tuned version of xlnet-base-cased on any type of product reviews dataset gathered from several e-commerce such as shopee, tokopedia, blibli, lazada, and zalora. The dataset can be found here It achieves the following results on the evaluation set:
- Train Loss: 0.1085
- Train Accuracy: 0.9617
- Validation Loss: 0.1910
- Validation Accuracy: 0.9414
- Epoch: 4
Intended uses & limitations
This fine-tuned XLNet model is used for sentiment analysis with 2 labels text classification: 0 -> Negative; 1 -> Positive.
Example Pipeline
from transformers import pipeline
pipe = pipeline("text-classification", model="dipawidia/xlnet-base-cased-product-review-sentiment-analysis")
pipe("This shoes is awesome")[{'label': 'Positive', 'score': 0.9995703101158142}]Full classification example
from transformers import XLNetTokenizer, TFXLNetForSequenceClassification
import tensorflow as tf
import numpy as np
tokenizer = XLNetTokenizer.from_pretrained("dipawidia/xlnet-base-cased-product-review-sentiment-analysis")
model = TFXLNetForSequenceClassification.from_pretrained("dipawidia/xlnet-base-cased-product-review-sentiment-analysis")
def get_sentimen(text):
tokenize_text = tokenizer(text, return_tensors = 'tf')
preds = model.predict(dict(tokenize_text))['logits']
class_preds = np.argmax(tf.keras.layers.Softmax()(preds))
if class_preds == 1:
label = 'Positive'
else:
label = 'Negative'
return(label)
get_sentimen('i hate this product')Output:
NegativeTraining procedure
Training hyperparameters
The following hyperparameters were used during training:
- optimizer: {'name': 'AdamW', 'weightdecay': 0.004, 'clipnorm': None, 'globalclipnorm': None, 'clipvalue': None, 'useema': False, 'emamomentum': 0.99, 'emaoverwritefrequency': None, 'jitcompile': True, 'islegacyoptimizer': False, 'learningrate': 3e-05, 'beta1': 0.9, 'beta2': 0.999, 'epsilon': 1e-07, 'amsgrad': False}
- training_precision: float32
Training results
Framework versions
- Transformers 4.41.2
- TensorFlow 2.15.0
- Tokenizers 0.19.1
