Update app.py
Browse files
app.py
CHANGED
|
@@ -169,7 +169,9 @@ def load_data():
|
|
| 169 |
X_train_seq = [torch.tensor(seq) for seq in X_train_seq]
|
| 170 |
|
| 171 |
# Padding the sequences correctly
|
| 172 |
-
|
|
|
|
|
|
|
| 173 |
vocab_size = len(tokenizer.get_vocab())
|
| 174 |
|
| 175 |
return X_train_pad, texts, class_mapping, vocab_size
|
|
|
|
| 169 |
X_train_seq = [torch.tensor(seq) for seq in X_train_seq]
|
| 170 |
|
| 171 |
# Padding the sequences correctly
|
| 172 |
+
X_train_seq_reversed = [seq.flip(0) for seq in X_train_seq]
|
| 173 |
+
X_train_pad_reversed = pad_sequence(X_train_seq_reversed, batch_first=True, padding_value=0)
|
| 174 |
+
X_train_pad = X_train_pad_reversed.flip(1)
|
| 175 |
vocab_size = len(tokenizer.get_vocab())
|
| 176 |
|
| 177 |
return X_train_pad, texts, class_mapping, vocab_size
|