# Tag Info

3

For TF2: try: # Disable all GPUS tf.config.set_visible_devices([], 'GPU') visible_devices = tf.config.get_visible_devices() for device in visible_devices: assert device.device_type != 'GPU' except: # Invalid device or cannot modify virtual devices once initialized. pass

1

If the accuracy is not changing, it means the optimizer has found a local minimum for the loss. Try to use weighting on classes to avoid this from sklearn.utils import compute_class_weight classWeight = compute_class_weight('balanced', outputLabels, outputs) classWeight = dict(enumerate(classWeight)) model.fit(X_train, y_train, batch_size = batch_size, ...

1

Your model is clearly overfitting. You should use higher dropout value like 0.5 .For better generalization use deep models. And you can also use early stopping so that your model stops training before significantly overfitting.

1

As far as I am aware you also need to save and load the tokenizer you used. The tokenizer is not fitted/trained and therefore is outputting nothing sensible for the model to predict on.

1

In neural networks meant for classification, you need a linear layer before the softmax to project the internal representation, which has some dimensionality $d_i$, to the output space, which has dimensionality $d_o$ equal the number of choices (5 in your case). So you either place a Dense(5) layer after the BiLSTM or you take the output of the BiLSTM "...

1

The algorithm converts your categorical labels into one hot encode before calculating loss. So you don't have to carry the burden.

1

You can't do this in Tensorflow. For reference see: https://github.com/tensorflow/tensorflow/issues/33131

Only top voted, non community-wiki answers of a minimum length are eligible