Update README.md
Browse files
README.md
CHANGED
@@ -19,21 +19,15 @@ Example on SST-2 test dataset classification:
|
|
19 |
from datasets import load_dataset
|
20 |
import numpy as np
|
21 |
from sklearn.metrics import accuracy_score
|
22 |
-
|
23 |
from keras.preprocessing.text import Tokenizer
|
24 |
from keras.utils import pad_sequences
|
25 |
import tensorflow as tf
|
26 |
-
|
27 |
from huggingface_hub import from_pretrained_keras
|
28 |
|
29 |
from datasets import load_dataset
|
30 |
sst2 = load_dataset("SetFit/sst2")
|
31 |
augmented_sst2_dataset = load_dataset("jmamou/augmented-glue-sst2")
|
32 |
|
33 |
-
oov_token = '<UNK>' # Required only if test is not given
|
34 |
-
pad_type = 'post'
|
35 |
-
trunc_type = 'post'
|
36 |
-
|
37 |
# Tokenize our training data
|
38 |
tokenizer = Tokenizer(num_words=10000)
|
39 |
tokenizer.fit_on_texts(augmented_sst2_dataset['train']['sentence'])
|
@@ -42,7 +36,7 @@ tokenizer.fit_on_texts(augmented_sst2_dataset['train']['sentence'])
|
|
42 |
test_sequences = tokenizer.texts_to_sequences(sst2['test']['text'])
|
43 |
|
44 |
# Pad the training sequences
|
45 |
-
test_padded = pad_sequences(test_sequences, padding=pad_type, truncating=trunc_type, maxlen=64)
|
46 |
|
47 |
reloaded_model = from_pretrained_keras('moshew/distilbilstm-finetuned-sst-2-english')
|
48 |
|
|
|
19 |
from datasets import load_dataset
|
20 |
import numpy as np
|
21 |
from sklearn.metrics import accuracy_score
|
|
|
22 |
from keras.preprocessing.text import Tokenizer
|
23 |
from keras.utils import pad_sequences
|
24 |
import tensorflow as tf
|
|
|
25 |
from huggingface_hub import from_pretrained_keras
|
26 |
|
27 |
from datasets import load_dataset
|
28 |
sst2 = load_dataset("SetFit/sst2")
|
29 |
augmented_sst2_dataset = load_dataset("jmamou/augmented-glue-sst2")
|
30 |
|
|
|
|
|
|
|
|
|
31 |
# Tokenize our training data
|
32 |
tokenizer = Tokenizer(num_words=10000)
|
33 |
tokenizer.fit_on_texts(augmented_sst2_dataset['train']['sentence'])
|
|
|
36 |
test_sequences = tokenizer.texts_to_sequences(sst2['test']['text'])
|
37 |
|
38 |
# Pad the training sequences
|
39 |
+
test_padded = pad_sequences(test_sequences, padding=pad_type = 'post', truncating=trunc_type = 'post', maxlen=64)
|
40 |
|
41 |
reloaded_model = from_pretrained_keras('moshew/distilbilstm-finetuned-sst-2-english')
|
42 |
|