fahrendrakhoirul commited on
Commit
0e554d6
1 Parent(s): 8a3e98d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -0
README.md CHANGED
@@ -2,7 +2,60 @@
2
  tags:
3
  - pytorch_model_hub_mixin
4
  - model_hub_mixin
 
 
 
 
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
8
  - Library: [More Information Needed]
 
2
  tags:
3
  - pytorch_model_hub_mixin
4
  - model_hub_mixin
5
+ datasets:
6
+ - fahrendrakhoirul/ecommerce-reviews-multilabel-dataset
7
+ language:
8
+ - id
9
  ---
10
+ **Short Summary:**
11
+ This model combines the power of IndoBERT for understanding language with a Convolutional Neural Network (CNN) for capturing local patterns in text data. It's specifically designed for multi-label classification of customer reviews in e-commerce, focusing on: Product, Customer Sevice, and Shipping/Delivery
12
+
13
+ **Detailed Description:**
14
+ Explain that the model is based on IndoBERT-base-p1, a pre-trained IndoBERT model specifically designed for Indonesian text.
15
+ Highlight that it's fine-tuned on a dataset of e-commerce reviews, allowing it to understand the nuances of customer sentiment in this domain.
16
+ Following the IndoBERT layer, a 1D convolutional layer (Conv1d) is applied to extract local features from the hidden state vectors. An Adaptive Average Pooling layer (AdaptiveAvgPool1d) is used to reduce the dimensionality of the convolutional output, making it suitable for feeding into a final linear layer.
17
+ The final linear layer produces logits for each of the three classes (Produk, Layanan Pelanggan, Pengiriman). A sigmoid activation function is applied to convert the logits into probabilities, allowing for multi-label classification.
18
+
19
+ Clearly define the three output classes and their corresponding labels:
20
+ - Produk (Product): Customer satisfaction with product quality, performance, and description accuracy.
21
+ - Layanan Pelanggan (Customer Service): Interaction with sellers, their responsiveness, and complaint handling.
22
+ - Pengiriman (Shipping/Delivery): Speed of delivery, item condition upon arrival, and timeliness.
23
+
24
+
25
+ **How to import in PyTorch:**
26
+ ```python
27
+ import torch.nn as nn
28
+ from huggingface_hub import PyTorchModelHubMixin
29
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
30
+
31
+ class IndoBertCNNEcommerceReview(nn.Module, PyTorchModelHubMixin):
32
+ def __init__(self, bert):
33
+ super().__init__()
34
+ self.bert = bert
35
+ self.conv1 = nn.Conv1d(in_channels=bert.config.hidden_size, out_channels=512, kernel_size=3, padding=1)
36
+ self.pool = nn.AdaptiveAvgPool1d(1)
37
+ self.linear = nn.Linear(512, 3)
38
+ self.sigmoid = nn.Sigmoid()
39
+
40
+ def forward(self, input_ids, attention_mask):
41
+ outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
42
+ last_hidden_state = outputs.last_hidden_state
43
+
44
+ # Permute to [batch_size, hidden_size, seq_len]
45
+ last_hidden_state = last_hidden_state.permute(0, 2, 1)
46
+
47
+ conv1_output = self.conv1(last_hidden_state)
48
+ pooled_output = self.pool(conv1_output).squeeze(-1)
49
+ logits = self.linear(pooled_output)
50
+ probabilities = self.sigmoid(logits)
51
+ return probabilities
52
+
53
+ bert = AutoModelForSequenceClassification.from_pretrained("indobenchmark/indobert-base-p1",
54
+ num_labels=3,
55
+ problem_type="multi_label_classification")
56
+ tokenizer = AutoTokenizer.from_pretrained("fahrendrakhoirul/indobert-cnn-finetuned-ecommerce-reviews")
57
+ model = IndoBertCNNEcommerceReview.from_pretrained("fahrendrakhoirul/indobert-cnn-finetuned-ecommerce-reviews", bert=bert)
58
+ ```
59
 
60
  This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
61
  - Library: [More Information Needed]