Push Keras model using huggingface_hub.
Browse files- README.md +5 -38
- keras_metadata.pb +2 -2
- model.png +0 -0
- saved_model.pb +2 -2
- variables/variables.data-00000-of-00001 +2 -2
- variables/variables.index +0 -0
README.md
CHANGED
|
@@ -4,50 +4,17 @@ library_name: keras
|
|
| 4 |
|
| 5 |
## Model description
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
-
DistlBiLSTM - 66K parameters (91.7 accuracy)
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
-
##
|
| 14 |
-
|
| 15 |
-
Example of ruuning prediction and evaluation on SST-2 test dataset
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
```python
|
| 19 |
-
import torch
|
| 20 |
-
!pip install setfit
|
| 21 |
-
|
| 22 |
-
from datasets import load_dataset
|
| 23 |
-
import numpy as np
|
| 24 |
-
from sklearn.metrics import accuracy_score
|
| 25 |
-
from keras.preprocessing.text import Tokenizer
|
| 26 |
-
from keras.utils import pad_sequences
|
| 27 |
-
import tensorflow as tf
|
| 28 |
-
from huggingface_hub import from_pretrained_keras
|
| 29 |
-
|
| 30 |
-
sst2 = load_dataset("SetFit/sst2")
|
| 31 |
-
augmented_sst2_dataset = load_dataset("jmamou/augmented-glue-sst2")
|
| 32 |
-
|
| 33 |
-
tokenizer = Tokenizer(num_words=10000)
|
| 34 |
-
tokenizer.fit_on_texts(augmented_sst2_dataset['train']['sentence'])
|
| 35 |
-
test_sequences = tokenizer.texts_to_sequences(sst2['test']['text'])
|
| 36 |
-
test_padded = pad_sequences(test_sequences, padding='post', truncating='post', maxlen=64)
|
| 37 |
-
|
| 38 |
-
reloaded_model = from_pretrained_keras('moshew/distilbilstm-finetuned-sst-2-english')
|
| 39 |
-
|
| 40 |
-
pred=reloaded_model.predict(test_padded)
|
| 41 |
-
pred_bin = np.argmax(pred,1)
|
| 42 |
-
accuracy_score(pred_bin, sst2['test']['label'])
|
| 43 |
-
reloaded_model.summary()
|
| 44 |
-
```
|
| 45 |
-
0.9176276771004942
|
| 46 |
|
|
|
|
| 47 |
|
| 48 |
## Training procedure
|
| 49 |
-
|
| 50 |
-
Distillation with data augmentation
|
| 51 |
|
| 52 |
### Training hyperparameters
|
| 53 |
|
|
|
|
| 4 |
|
| 5 |
## Model description
|
| 6 |
|
| 7 |
+
More information needed
|
| 8 |
|
| 9 |
+
## Intended uses & limitations
|
|
|
|
| 10 |
|
| 11 |
+
More information needed
|
| 12 |
|
| 13 |
+
## Training and evaluation data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
More information needed
|
| 16 |
|
| 17 |
## Training procedure
|
|
|
|
|
|
|
| 18 |
|
| 19 |
### Training hyperparameters
|
| 20 |
|
keras_metadata.pb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:919c45b0d0ee9e0d922c8b4db2ad15746e1c5fe92afd8384a09d9075c43bc24c
|
| 3 |
+
size 31191049
|
model.png
CHANGED
|
|
saved_model.pb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:05da91ebaaec30e75ef2ea2718c02bef1fab0a671dcd6e8f5e4acd832229ed18
|
| 3 |
+
size 4451217
|
variables/variables.data-00000-of-00001
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c26dab890f18c809e99d5a807d01325327075265ab409cbc8f8ce4bd0e9043b9
|
| 3 |
+
size 2644586
|
variables/variables.index
CHANGED
|
Binary files a/variables/variables.index and b/variables/variables.index differ
|
|
|