# Keras

**URL:** https://discuss.ai.google.dev/c/keras/22.md?page=1

[Latest](https://discuss.ai.google.dev/latest.md) · [Categories](https://discuss.ai.google.dev/categories.md) · [Tags](https://discuss.ai.google.dev/tags.md)

**Page:** 2

---

## [Error from Tuner component: ValueError: Missing data for input “image\_xf\_input”](https://discuss.ai.google.dev/t/error-from-tuner-component-valueerror-missing-data-for-input-image-xf-input/31294)

<div class="topic-metadata">

**Author:** [@Aly\_SEGNANE](https://discuss.ai.google.dev/u/Aly_SEGNANE)\
**Replies:** 1\
**Last updated:** [July 28, 2025, 8:46am UTC](https://discuss.ai.google.dev/t/error-from-tuner-component-valueerror-missing-data-for-input-image-xf-input/31294 "2025-07-28T08:46:32Z")

</div>

Hi there, I’m new here and I don’t if it is the right place to post this but I’m going to throw it out in case anyone here can help. It’d be appreciated!!! Well, Here is what I did: I was learning about TFX pipeline a…

---

## [Optimizing seq2seq decoding script](https://discuss.ai.google.dev/t/optimizing-seq2seq-decoding-script/28299)

<div class="topic-metadata">

**Author:** [@acraev](https://discuss.ai.google.dev/u/acraev)\
**Replies:** 1\
**Last updated:** [July 25, 2025, 4:21am UTC](https://discuss.ai.google.dev/t/optimizing-seq2seq-decoding-script/28299 "2025-07-25T04:21:37Z")

</div>

Hello everyone, I am a beginner in Keras/TensorFlow. I am fitting a seq2seq Transformer model and I made my model based on Chollet’s book “Deep Learning with Python” where he shows seq2seq model on an example of machine…

---

## [Problem that Keras PointNet accepts different input formats of pointclouds when feeding with tf.data.Dataset while train](https://discuss.ai.google.dev/t/problem-that-keras-pointnet-accepts-different-input-formats-of-pointclouds-when-feeding-with-tf-data-dataset-while-train/35603)

<div class="topic-metadata">

**Author:** [@Pa0815](https://discuss.ai.google.dev/u/Pa0815)\
**Replies:** 1\
**Last updated:** [July 18, 2025, 4:55am UTC](https://discuss.ai.google.dev/t/problem-that-keras-pointnet-accepts-different-input-formats-of-pointclouds-when-feeding-with-tf-data-dataset-while-train/35603 "2025-07-18T04:55:12Z")

</div>

For a machine learning task I have coded with support of the internet a configurable PoinNet Version in tensorflow keras. The keras example from PointNet I got here: Point cloud classification with PointNet I am using t…

---

## [Seamlessly Loading HuggingFace Transformers into Multi-Backend KerasHub Models](https://discuss.ai.google.dev/t/seamlessly-loading-huggingface-transformers-into-multi-backend-kerashub-models/93932)

<div class="topic-metadata">

**Author:** [@laxma\_patlolla](https://discuss.ai.google.dev/u/laxma_patlolla)\
**Replies:** 0\
**Last updated:** [July 15, 2025, 1:11am UTC](https://discuss.ai.google.dev/t/seamlessly-loading-huggingface-transformers-into-multi-backend-kerashub-models/93932 "2025-07-15T01:11:36Z")

</div>

KerasHub simplifies the use of HuggingFace Transformers models through its built-in converters. These converters automatically handle the process of translating HuggingFace model checkpoints into a format that’s compatib…

---

## [\[Announcement\] A guide/Article on Function calling with kerasHub](https://discuss.ai.google.dev/t/announcement-a-guide-article-on-function-calling-with-kerashub/93664)

<div class="topic-metadata">

**Author:** [@laxma\_patlolla](https://discuss.ai.google.dev/u/laxma_patlolla)\
**Replies:** 0\
**Last updated:** [July 13, 2025, 7:58am UTC](https://discuss.ai.google.dev/t/announcement-a-guide-article-on-function-calling-with-kerashub/93664 "2025-07-13T07:58:42Z")

</div>

I’m excited to share that I’ve published a new article on Medium titled “Function Calling with KerasHub.” In this piece, I explore how function calling can enhance the capabilities of modern AI systems, with a special fo…

---

## [Passing meta data from data Loader to custom loss function](https://discuss.ai.google.dev/t/passing-meta-data-from-data-loader-to-custom-loss-function/34449)

<div class="topic-metadata">

**Author:** [@paras\_Joshi](https://discuss.ai.google.dev/u/paras_Joshi)\
**Replies:** 1\
**Last updated:** [July 7, 2025, 6:28am UTC](https://discuss.ai.google.dev/t/passing-meta-data-from-data-loader-to-custom-loss-function/34449 "2025-07-07T06:28:20Z")

</div>

I am trying to pass meta-data, for the reference labels that i will be using in a custom loss function. I am accessing the input (to model), labels, meta-data through the data loader. however I can’t seem to figure out a…

---

## [When function call() is called in the custom training?](https://discuss.ai.google.dev/t/when-function-call-is-called-in-the-custom-training/89314)

<div class="topic-metadata">

**Author:** [@DEV\_AI](https://discuss.ai.google.dev/u/DEV_AI)\
**Replies:** 1\
**Last updated:** [July 2, 2025, 3:29pm UTC](https://discuss.ai.google.dev/t/when-function-call-is-called-in-the-custom-training/89314 "2025-07-02T15:29:38Z")

</div>

I follow this guide for KD Knowledge Distillation and the source as class Distiller(keras.Model): def \_\_init\_\_(self, student, teacher): super().\_\_init\_\_() self.teacher = teacher self.student …

---

## [Subclassed model not saved by ModelCheckpoint callback](https://discuss.ai.google.dev/t/subclassed-model-not-saved-by-modelcheckpoint-callback/51494)

<div class="topic-metadata">

**Author:** [@lbrandao](https://discuss.ai.google.dev/u/lbrandao)\
**Replies:** 1\
**Last updated:** [June 27, 2025, 5:24am UTC](https://discuss.ai.google.dev/t/subclassed-model-not-saved-by-modelcheckpoint-callback/51494 "2025-06-27T05:24:24Z")

</div>

Hi, I’m using Keras and TensorFlow 2.12.0 to implement a subclassed model with custom methods, such as a custom train\_step. To save the model, I use the ModelCheckpoint callback. My goal is to save not only the model’s…

---

## [Tensorboard and Trainer pattern not working together](https://discuss.ai.google.dev/t/tensorboard-and-trainer-pattern-not-working-together/62486)

<div class="topic-metadata">

**Author:** [@Geraud](https://discuss.ai.google.dev/u/Geraud)\
**Replies:** 1\
**Last updated:** [June 27, 2025, 5:03am UTC](https://discuss.ai.google.dev/t/tensorboard-and-trainer-pattern-not-working-together/62486 "2025-06-27T05:03:02Z")

</div>

I’m using the Keras Trainer pattern as illustrated here. The issue when using this pattern is that when you use Tensorboard only the top level weights are being recorded. The reason for this is that Tensorboard is recor…

---

## [XLA JIT Compile causing Memory Leak](https://discuss.ai.google.dev/t/xla-jit-compile-causing-memory-leak/31958)

<div class="topic-metadata">

**Author:** [@loneil](https://discuss.ai.google.dev/u/loneil)\
**Replies:** 2\
**Last updated:** [May 26, 2025, 3:21pm UTC](https://discuss.ai.google.dev/t/xla-jit-compile-causing-memory-leak/31958 "2025-05-26T15:21:02Z")

</div>

Hi, I’m currently working with TensorFlow 2.13.0, with CUDA 11.8. I’ve noticed that when enabling XLA , i.e., by passing in jit\_compile=True to my Keras model’s compile() method, that I get a decent speed up, GPU utili…

---

## [ModuleNotFoundError: No module named 'optree'](https://discuss.ai.google.dev/t/modulenotfounderror-no-module-named-optree/31224)

<div class="topic-metadata">

**Author:** [@javvadqamar](https://discuss.ai.google.dev/u/javvadqamar)\
**Replies:** 3\
**Last updated:** [April 1, 2025, 2:24pm UTC](https://discuss.ai.google.dev/t/modulenotfounderror-no-module-named-optree/31224 "2025-04-01T14:24:20Z")

</div>

import tensorflow as tf from tensorflow.keras.models import Model from tensorflow.keras.layers import Input,LSTM,Dense this issue is arising when im using kaggle tpu ModuleNotFoundError Tracebac…

---

## [ModuleNotFoundError: No module named 'keras.engine'](https://discuss.ai.google.dev/t/modulenotfounderror-no-module-named-keras-engine/30242)

<div class="topic-metadata">

**Author:** [@Leo\_Verheyden](https://discuss.ai.google.dev/u/Leo_Verheyden)\
**Replies:** 11\
**Last updated:** [March 20, 2025, 1:05pm UTC](https://discuss.ai.google.dev/t/modulenotfounderror-no-module-named-keras-engine/30242 "2025-03-20T13:05:27Z")

</div>

Hello , can someone help me ? ModuleNotFoundError: No module named ‘keras.engine’ This is the message I received anaytime. in colab in pycharm . I try to make a model by training , I use few github mask rcnn and n…

---

## [Handling mixed inputs to keras model](https://discuss.ai.google.dev/t/handling-mixed-inputs-to-keras-model/68861)

<div class="topic-metadata">

**Author:** [@Josh\_Mcdonald](https://discuss.ai.google.dev/u/Josh_Mcdonald)\
**Replies:** 1\
**Last updated:** [March 3, 2025, 6:40am UTC](https://discuss.ai.google.dev/t/handling-mixed-inputs-to-keras-model/68861 "2025-03-03T06:40:49Z")

</div>

Hello - New to TF/keras and trying to understand why this model is compiling but not training appropriately. \[IN\] def prepare\_data\_for\_keras(df): """Prepares a DataFrame for Keras NN modeling Args: df:…

---

## [UserWarning: Do not pass an \`input\_shape\`/\`input\_dim\` argument to a layer](https://discuss.ai.google.dev/t/userwarning-do-not-pass-an-input-shape-input-dim-argument-to-a-layer/68342)

<div class="topic-metadata">

**Author:** [@khteh](https://discuss.ai.google.dev/u/khteh)\
**Replies:** 2\
**Last updated:** [February 25, 2025, 10:53am UTC](https://discuss.ai.google.dev/t/userwarning-do-not-pass-an-input-shape-input-dim-argument-to-a-layer/68342 "2025-02-25T10:53:10Z")

</div>

x\_train shape: (750, 1753) model = models.Sequential() model.add(layers.Dense(10, input\_dim=x\_train.shape\[1\], activation='relu')) model.add(layers.Dense(1, activation='sigmoid')) Runtime warning: /home/khteh/.local…

---

## [Getting 'Killed' while trying to run 'pytest keras\_cv'](https://discuss.ai.google.dev/t/getting-killed-while-trying-to-run-pytest-keras-cv/29892)

<div class="topic-metadata">

**Author:** [@Sarthak\_Jain](https://discuss.ai.google.dev/u/Sarthak_Jain)\
**Replies:** 1\
**Last updated:** [February 6, 2025, 6:18am UTC](https://discuss.ai.google.dev/t/getting-killed-while-trying-to-run-pytest-keras-cv/29892 "2025-02-06T06:18:24Z")

</div>

Followed each and every step as mentioned here keras-cv/CONTRIBUTING.md at c8efcd78c64fc67f2f5238b5107be581d3899286 · keras-team/keras-cv · GitHub. I think the issue is probably related to CPU usage (not sure though but …

---

## [Multiple optimizer keras](https://discuss.ai.google.dev/t/multiple-optimizer-keras/64063)

<div class="topic-metadata">

**Author:** [@DerFrederikHD](https://discuss.ai.google.dev/u/DerFrederikHD)\
**Replies:** 2\
**Last updated:** [February 3, 2025, 10:46am UTC](https://discuss.ai.google.dev/t/multiple-optimizer-keras/64063 "2025-02-03T10:46:51Z")

</div>

Im trying to use 2 optimizers for different variables. I am using keras. The parts that are commented out is what I am trying to do, but with a modern tensorflow/keras version # var\_D = \[v for v in tf.global\_variables()…

---

## [Fit customization](https://discuss.ai.google.dev/t/fit-customization/62518)

<div class="topic-metadata">

**Author:** [@Loic\_Gouarin](https://discuss.ai.google.dev/u/Loic_Gouarin)\
**Replies:** 7\
**Last updated:** [January 27, 2025, 5:51am UTC](https://discuss.ai.google.dev/t/fit-customization/62518 "2025-01-27T05:51:26Z")

</div>

Hello, I tried to customize fit method by creating a new model for PINNs simulation. I have created a train\_step method decorated with @tf.function. I wrote a method inside this class to look at the performance of my t…

---

## [Keras Transformer Implementation Error](https://discuss.ai.google.dev/t/keras-transformer-implementation-error/60365)

<div class="topic-metadata">

**Author:** [@QichengMa](https://discuss.ai.google.dev/u/QichengMa)\
**Replies:** 1\
**Last updated:** [January 16, 2025, 9:43am UTC](https://discuss.ai.google.dev/t/keras-transformer-implementation-error/60365 "2025-01-16T09:43:58Z")

</div>

Dear All, I am new to implement Transformer with Keras, I could not figure out the solution for this following error: Here is my input tokens: (base) $ cat trainingSet\_7mer\_1.token.txt 18,0,11,10,7,14,2 18,0,1,6,7,1…

---

## [How to fix this? AttributeError: ‘NoneType’ object has no attribute ‘update\_state’](https://discuss.ai.google.dev/t/how-to-fix-this-attributeerror-nonetype-object-has-no-attribute-update-state/60653)

<div class="topic-metadata">

**Author:** [@NYLY](https://discuss.ai.google.dev/u/NYLY)\
**Replies:** 1\
**Last updated:** [January 16, 2025, 9:23am UTC](https://discuss.ai.google.dev/t/how-to-fix-this-attributeerror-nonetype-object-has-no-attribute-update-state/60653 "2025-01-16T09:23:23Z")

</div>

I have problem with this: AttributeError: ‘NoneType’ object has no attribute ‘update\_state’ My code: latent\_dim = 100 batch\_size = 32 my\_discriminator = keras.models.Sequential(\[ keras.Input(shape=(784,)), keras.layers…

---

## [Fine-tuning GPT2 for text summary](https://discuss.ai.google.dev/t/fine-tuning-gpt2-for-text-summary/32670)

<div class="topic-metadata">

**Author:** [@Seungjun\_Lee](https://discuss.ai.google.dev/u/Seungjun_Lee)\
**Replies:** 1\
**Last updated:** [December 27, 2024, 12:58pm UTC](https://discuss.ai.google.dev/t/fine-tuning-gpt2-for-text-summary/32670 "2024-12-27T12:58:43Z")

</div>

Hello y’all I’m trying to create a text summary ml model by fine-tuning GPT2. And here is my current code import tensorflow as tf from transformers import GPT2Tokenizer import keras\_nlp from transformers import TFGPT2L…

---

## [I have been training a decoder based transformer for word generation. But it keeps generating the same words over and over again](https://discuss.ai.google.dev/t/i-have-been-training-a-decoder-based-transformer-for-word-generation-but-it-keeps-generating-the-same-words-over-and-over-again/29032)

<div class="topic-metadata">

**Author:** [@Progress\_Munoriarwa](https://discuss.ai.google.dev/u/Progress_Munoriarwa)\
**Replies:** 1\
**Last updated:** [December 20, 2024, 9:32am UTC](https://discuss.ai.google.dev/t/i-have-been-training-a-decoder-based-transformer-for-word-generation-but-it-keeps-generating-the-same-words-over-and-over-again/29032 "2024-12-20T09:32:51Z")

</div>

I have been trying to create a decoder based transformer for text generation and the text its generating is the same no matter the input sequence The following is my code some of , the code for preprocessing was remove …

---

## [Subclassing keras.model to create a custom autoregressive LSTM model with multi-column input](https://discuss.ai.google.dev/t/subclassing-keras-model-to-create-a-custom-autoregressive-lstm-model-with-multi-column-input/32122)

<div class="topic-metadata">

**Author:** [@Hayden\_Collins](https://discuss.ai.google.dev/u/Hayden_Collins)\
**Replies:** 1\
**Last updated:** [December 20, 2024, 4:44am UTC](https://discuss.ai.google.dev/t/subclassing-keras-model-to-create-a-custom-autoregressive-lstm-model-with-multi-column-input/32122 "2024-12-20T04:44:58Z")

</div>

Hello. I posted this on SO a few weeks ago, but didn’t get any responses. I’m hoping some of you folks can help me. I’m trying to create a model to forecast energy grid load (net electricity consumed by the grid) based …

---

## [Trying to create a english story generator with BERT model and graph execution error came unwanted](https://discuss.ai.google.dev/t/trying-to-create-a-english-story-generator-with-bert-model-and-graph-execution-error-came-unwanted/30297)

<div class="topic-metadata">

**Author:** [@Neo\_TheOne](https://discuss.ai.google.dev/u/Neo_TheOne)\
**Replies:** 1\
**Last updated:** [December 19, 2024, 9:29am UTC](https://discuss.ai.google.dev/t/trying-to-create-a-english-story-generator-with-bert-model-and-graph-execution-error-came-unwanted/30297 "2024-12-19T09:29:31Z")

</div>

There seems to be a problem during the execution of the TensorFlow graph, specifically in the node model/tf\_distil\_bert\_model/distilbert/embeddings/Gather\_1 . I am using winows 10, tensorflow and keras both version 2.1…

---

## [Keras Hub and Universal Sentence Encoder](https://discuss.ai.google.dev/t/keras-hub-and-universal-sentence-encoder/49335)

<div class="topic-metadata">

**Author:** [@rcauvin](https://discuss.ai.google.dev/u/rcauvin)\
**Replies:** 2\
**Last updated:** [December 13, 2024, 3:34pm UTC](https://discuss.ai.google.dev/t/keras-hub-and-universal-sentence-encoder/49335 "2024-12-13T15:34:53Z")

</div>

I have a binary classification model that uses Universal Sentence Encoder as a preprocessing layer to convert email subject lines to fixed-length embeddings. (The layer is trainable so that it can learn from my corpus of…

---

## [Model input incompatible with the Layer](https://discuss.ai.google.dev/t/model-input-incompatible-with-the-layer/25825)

<div class="topic-metadata">

**Author:** [@XO-NANO](https://discuss.ai.google.dev/u/XO-NANO)\
**Replies:** 1\
**Last updated:** [December 12, 2024, 2:20am UTC](https://discuss.ai.google.dev/t/model-input-incompatible-with-the-layer/25825 "2024-12-12T02:20:47Z")

</div>

I have created a custom tuner that explores multiple hyperparameters to optimize my model. The custom tuner calls on my a preprocess function that creates time windows (the length of which is a hyperparameter) that are t…

---

## [How to get logits from trained tensorflow model](https://discuss.ai.google.dev/t/how-to-get-logits-from-trained-tensorflow-model/53230)

<div class="topic-metadata">

**Author:** [@SAL](https://discuss.ai.google.dev/u/SAL)\
**Replies:** 1\
**Last updated:** [December 10, 2024, 9:27am UTC](https://discuss.ai.google.dev/t/how-to-get-logits-from-trained-tensorflow-model/53230 "2024-12-10T09:27:12Z")

</div>

I have a trained TensorFlow classification model (52 classes). the 3 last layers are: model.add(LSTM(70, return\_sequences=False, unroll=True) model.add(Dense(50)) model.add(Dense(52, activation='softmax')) I want to g…

---

## [Need help with custom data loading in Keras\_CV](https://discuss.ai.google.dev/t/need-help-with-custom-data-loading-in-keras-cv/31339)

<div class="topic-metadata">

**Author:** [@Daniel\_Luba](https://discuss.ai.google.dev/u/Daniel_Luba)\
**Replies:** 1\
**Last updated:** [December 6, 2024, 1:28pm UTC](https://discuss.ai.google.dev/t/need-help-with-custom-data-loading-in-keras-cv/31339 "2024-12-06T13:28:38Z")

</div>

Hello, I am new to Keras\_CV and Computer vision as a whole, I am trying to load in a image dataset from Kaggle - Underwater Object Detection Dataset | Kaggle - And I am using this tutorial from the keras website for a gu…

---

## [Keras Community Meeting Dec 6th 11am PT](https://discuss.ai.google.dev/t/keras-community-meeting-dec-6th-11am-pt/52850)

<div class="topic-metadata">

**Author:** [@monicadsong](https://discuss.ai.google.dev/u/monicadsong)\
**Replies:** 0\
**Last updated:** [December 5, 2024, 8:40pm UTC](https://discuss.ai.google.dev/t/keras-community-meeting-dec-6th-11am-pt/52850 "2024-12-05T20:40:55Z")

</div>

Hey all– We have an exciting community meeting coming up tomorrow Friday 11AM where Divya from the Keras team will be presenting KerasHub (our new pre-trained model library! :tada:) followed by a Q&A session. The meeti…

---

## [Which File should I use from my cancerTumor.pb model folder](https://discuss.ai.google.dev/t/which-file-should-i-use-from-my-cancertumor-pb-model-folder/32473)

<div class="topic-metadata">

**Author:** [@Zm\_476](https://discuss.ai.google.dev/u/Zm_476)\
**Replies:** 2\
**Last updated:** [November 28, 2024, 5:28am UTC](https://discuss.ai.google.dev/t/which-file-should-i-use-from-my-cancertumor-pb-model-folder/32473 "2024-11-28T05:28:34Z")

</div>

Hello, Pretty new to Tensorflow so wondering which file I should import for my application. The file folder is called cancerTumor.pb (as it is finding out if a tumor is cancerous or non cancerous. There are 3 files an…

---

## [Multiclass Segmentation Hausdorff Distance](https://discuss.ai.google.dev/t/multiclass-segmentation-hausdorff-distance/51283)

<div class="topic-metadata">

**Author:** [@Sara\_Ortega\_Espina](https://discuss.ai.google.dev/u/Sara_Ortega_Espina)\
**Replies:** 1\
**Last updated:** [November 25, 2024, 10:57am UTC](https://discuss.ai.google.dev/t/multiclass-segmentation-hausdorff-distance/51283 "2024-11-25T10:57:37Z")

</div>

Hi everyone, I wanted to address a problem I’ve been facing for the past week. I am currently working on a U-Net multiclass segmentation model, which works fine. The input is a (192, 192, 1) MRI image of a rat’s brain, …

[Previous page](https://discuss.ai.google.dev/c/keras/22.md)

[Next page](https://discuss.ai.google.dev/c/keras/22.md?page=2)
