All Questions

Tagged with
Filter by
Sorted by
Tagged with
7 votes
1 answer
21k views

Unable to train my keras model : (Data cardinality is ambiguous:)

I am using the bert-for-tf2 library to do a Multi-Class Classification problem. I created the model but training throws the following error: -----------------------------------------------------------...
Amal Vijayan's user avatar
4 votes
1 answer
3k views

Difference between Tokenizer and TextVectorization layer in tensorflow

New to TensorFlow I saw couple of small NLP projects where people use the 'tf.keras.preprocessing.Tokenizer' to pre-process their text (link: https://www.tensorflow.org/api_docs/python/tf/keras/...
Jay ra1's user avatar
  • 71
3 votes
1 answer
3k views

How to make custom validation_step in tensorflow 2 Tensorflow 2 / Keras?

I have a question regarding the validation Data. I have this neural network and I divided my data into train_generator, val_generator, test_generator. I made a custom model with a custom fit. class ...
Serj Ionescu's user avatar
3 votes
1 answer
1k views

How to normalize output from BERT classifier

I've trained a BERT classifier using HuggingFace transformers.TFBertForSequenceClassification classifier. It's working fine, but when using the model.predict() method, it gives a tuple as output which ...
Bitswazsky's user avatar
  • 4,498
2 votes
2 answers
5k views

error Node: 'binary_crossentropy/Cast' Cast string to float is not supported while train model

i want to train my data i already make my data to string with word2vec pretrain model from here https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.id.300.vec.gz and success to make a model, but ...
nikko's user avatar
  • 35
2 votes
1 answer
153 views

Parallel Convolutions using Keras

What i am trying to do is create a text classification model which combines CNNS and word embeddings.The basic idea is that we have an Embedding layer at the start of the network and then 2 parallel ...
los los los's user avatar
2 votes
1 answer
125 views

I have trained a custom transformer model on language modeling, now how do I make predictions with it?

I have trained a transformer model on language modeling (i.e predicting the next character given the context) on a dataset. CONTEXT_LENGTH = 200, I want the model to predict when the input is not of ...
qmzp's user avatar
  • 49
2 votes
1 answer
1k views

Tensorflow loading weights on CPU when model is trained on GPU

I wrote a Bert model in Colab and I trained it using GPU and downloaded the weights for further inference. For prediction, I don't need GPU and I was testing on my local machine without GPU. But I was ...
Akash Tadwai's user avatar
1 vote
2 answers
483 views

TF predict multiple predictions at once

I am trying to batch predict a number of inputs to my model which expects an input containing 2 1D lists of a fixed size like this: [<tf.Tensor: shape=(1, 150), dtype=int64, numpy=array([[2, 924, ....
Kurt's user avatar
  • 176
1 vote
0 answers
170 views

Transformer model using functional API

I started learning NLP a couple of months ago. So now i am trying to implement transformer model using functional API and i want to train this transformer model using model.fit. Encoder and Decoder ...
R.tahir's user avatar
  • 11
1 vote
1 answer
502 views

The problem with tf.keras.datasets.imdb.load_data

from keras.datasets import imdb (X_train, y_train), (X_test, y_test) = imdb.load_data(path="imdb.npz", num_words=10, ...
Anonymous's user avatar
0 votes
1 answer
927 views

ModelCheckpoint not saving checkpoint files (.h5 files)

model = Model(sequence_input, preds) adadelta = tf.keras.optimizers.Adadelta(lr=0.9, rho=0.95, epsilon=None, decay=0.002) lr_metric = get_lr_metric(adadelta) model.compile(loss='...
triggerDiscipline's user avatar
0 votes
1 answer
160 views

BERT to XLNET train model

I'm trying to do something like this in XLNet but I can't find this part in the documentation, any help would be valuable, thanks! # we access the transformer model within our bert object using the ...
isaac.af95's user avatar
0 votes
0 answers
20 views

Vanishing Gradient in Keras Spelling Correction Model

I'd like some help with the following problem. I'm working on a spelling correction model using Tensorflow (Keras). I'm using "binary accuracy" and "accuracy" as my metrics. ...
Tunde's user avatar
  • 11
0 votes
0 answers
71 views

Predicting the next word using KerasNLP

I'm using KerasNLP to generate next sequence and predicting the next word. For that, I'm following Colab. I'm getting trouble in converting the logits into tokens & words. So here is the summary ...
Mustansar Saeed's user avatar
0 votes
0 answers
7 views

Tensorflow Keras InvalıdArgumentError

I tried to develop a simple chatbot with seq2seq architecture and it gave the following error that I could not solve. Code : import tensorflow as tf import numpy as np from tensorflow.keras.models ...
willy.js's user avatar
0 votes
1 answer
464 views

Tensorflow Keras load_model does not load the Model anymore after updating from tf 2.7

After Updating from tf 2.7 to any higher tensorflow version (i have tested them all), the loading of my previously trained models does not work anymore. When I downgrade Tensorflow the imports work ...
Error404's user avatar
  • 134
-1 votes
1 answer
87 views

loss value deep learning model is inf

I train a RNN deep learning model as bellow: model = Sequential() initializer = tf.keras.initializers.RandomNormal(mean=.5, stddev=1) model.add(LSTM(512, return_sequences=True, dropout=0.2,input_shape=...
afrooz's user avatar
  • 1