import torch
import torch.nn as nn
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
this is my code i get the following attached error.
This code is executed in VScode
import torch
import torch.nn as nn
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
this is my code i get the following attached error.
This code is executed in VScode
Welcome to the Tensorflow Forum,
In Tensorflow 2.x, the tf.compat
module has been deprecated. Please make sure to use the latest version of Keras/Tensorflow.
Moreover, the keras.preprocessing.*
module is also deprecated and it is recommended to use equivalent API’s for your use case
Instead of keras.preprocessing.text.Tokenizer
, you can use tf.keras.layers.TextVectorization
which provides equivalent functionality through a layer which accepts tf.Tensor
input
Similarly, instead of keras.preprocessing.sequence.pad_sequences
you can use tf.keras.utils.pad_sequences
Thank you!