Update README.md
Browse files
README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2 |
tags:
|
3 |
- pytorch_model_hub_mixin
|
4 |
- model_hub_mixin
|
5 |
-
-
|
|
|
|
|
6 |
datasets:
|
7 |
- fahrendrakhoirul/ecommerce-reviews-multilabel-dataset
|
8 |
language:
|
@@ -15,6 +17,31 @@ library_name: transformers
|
|
15 |
pipeline_tag: text-classification
|
16 |
---
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
|
19 |
- Library: [More Information Needed]
|
20 |
- Docs: [More Information Needed]
|
|
|
2 |
tags:
|
3 |
- pytorch_model_hub_mixin
|
4 |
- model_hub_mixin
|
5 |
+
- indobert
|
6 |
+
- indobenchmark
|
7 |
+
- indonlu
|
8 |
datasets:
|
9 |
- fahrendrakhoirul/ecommerce-reviews-multilabel-dataset
|
10 |
language:
|
|
|
17 |
pipeline_tag: text-classification
|
18 |
---
|
19 |
|
20 |
+
How to import in PyTorch:
|
21 |
+
```python
|
22 |
+
import torch.nn as nn
|
23 |
+
from huggingface_hub import PyTorchModelHubMixin
|
24 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
25 |
+
|
26 |
+
class IndoBertEcommerceReview(nn.Module, PyTorchModelHubMixin):
|
27 |
+
def __init__(self, bert):
|
28 |
+
super().__init__()
|
29 |
+
self.bert = bert
|
30 |
+
self.sigmoid = nn.Sigmoid()
|
31 |
+
|
32 |
+
def forward(self, input_ids, attention_mask):
|
33 |
+
outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
|
34 |
+
logits = outputs.logits
|
35 |
+
probabilities = self.sigmoid(logits)
|
36 |
+
return probabilities
|
37 |
+
|
38 |
+
bert = AutoModelForSequenceClassification.from_pretrained("indobenchmark/indobert-base-p1",
|
39 |
+
num_labels=3,
|
40 |
+
problem_type="multi_label_classification")
|
41 |
+
tokenizer = BertTokenizer.from_pretrained("fahrendrakhoirul/indobert-finetuned-ecommerce-reviews")
|
42 |
+
model = AutoModelForSequenceClassification.from_pretrained("fahrendrakhoirul/indobert-finetuned-ecommerce-reviews", bert=bert)
|
43 |
+
```
|
44 |
+
|
45 |
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
|
46 |
- Library: [More Information Needed]
|
47 |
- Docs: [More Information Needed]
|