# \#transformers

**URL:** https://discuss.ai.google.dev/tag/transformers/347.md

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

---

## [Gemma 4 27B-A4B-it (MoE) on Vertex AI: vLLM Dependency Triangles, LoRA, and Vision Blockers](https://discuss.ai.google.dev/t/gemma-4-27b-a4b-it-moe-on-vertex-ai-vllm-dependency-triangles-lora-and-vision-blockers/141868)

<div class="topic-metadata">

**Author:** [@Manzela](https://discuss.ai.google.dev/u/Manzela)\
**Replies:** 1\
**Last updated:** [April 27, 2026, 12:54pm UTC](https://discuss.ai.google.dev/t/gemma-4-27b-a4b-it-moe-on-vertex-ai-vllm-dependency-triangles-lora-and-vision-blockers/141868 "2026-04-27T12:54:11Z")

</div>

Hello everyone, Over the past few weeks, I’ve been working on deploying Google’s Gemma 4 27B-A4B-it (Mixture-of-Experts) model on Vertex AI using vLLM. After extensive testing (30+ container/model versions), I successfu…

---

## [Tf.keras.Model and model class adaptation](https://discuss.ai.google.dev/t/tf-keras-model-and-model-class-adaptation/25541)

<div class="topic-metadata">

**Author:** [@MucTran](https://discuss.ai.google.dev/u/MucTran)\
**Replies:** 1\
**Last updated:** [February 23, 2026, 2:59pm UTC](https://discuss.ai.google.dev/t/tf-keras-model-and-model-class-adaptation/25541 "2026-02-23T14:59:15Z")

</div>

Hello everyone. I’m new to the tensorflow library and keras package so I am having some trouble in making adjustment to a 3D-UNET originally defined using Tf.keras.Model to an adaptation of another model defined using mo…

---

## [OpenAI’s GPT-2 param run model](https://discuss.ai.google.dev/t/openai-s-gpt-2-param-run-model/28273)

<div class="topic-metadata">

**Author:** [@Vit\_Saha](https://discuss.ai.google.dev/u/Vit_Saha)\
**Replies:** 1\
**Last updated:** [September 25, 2025, 5:28am UTC](https://discuss.ai.google.dev/t/openai-s-gpt-2-param-run-model/28273 "2025-09-25T05:28:52Z")

</div>

need short help to param run model. examle text = “start text” encoding the input text input\_ids = tokenizer.encode(text, return\_tensors=‘tf’) tf.random.set\_seed(randrange(1000000000000000)) // set top\_k = 50 and se…

---

## [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…

---

## [Tensorflow ver 2.17.0](https://discuss.ai.google.dev/t/tensorflow-ver-2-17-0/40921)

<div class="topic-metadata">

**Author:** [@Ali\_Riza\_SARAL](https://discuss.ai.google.dev/u/Ali_Riza_SARAL)\
**Replies:** 1\
**Last updated:** [July 21, 2025, 6:58am UTC](https://discuss.ai.google.dev/t/tensorflow-ver-2-17-0/40921 "2025-07-21T06:58:28Z")

</div>

I am using a custom transformer made with tensorflow by machinelearningmastery: https://machinelearningmastery.com/building-transformer-models-with-attention-crash-course-build-a-neural-machine-translator-in-12-days/ I …

---

## [Help! When building or training model get error: "ValueError: The first argument to \`Layer.call\` must always be passed. "](https://discuss.ai.google.dev/t/help-when-building-or-training-model-get-error-valueerror-the-first-argument-to-layer-call-must-always-be-passed/32011)

<div class="topic-metadata">

**Author:** [@Fox\_Jean](https://discuss.ai.google.dev/u/Fox_Jean)\
**Replies:** 1\
**Last updated:** [May 23, 2025, 8:52am UTC](https://discuss.ai.google.dev/t/help-when-building-or-training-model-get-error-valueerror-the-first-argument-to-layer-call-must-always-be-passed/32011 "2025-05-23T08:52:18Z")

</div>

After modified Huggingface Transformers TFBertModel to adapter-BERT, I got an error "ValueError: The first argument to Layer.call must always be passed. ". I used a Layer class to define adapter output layer, and wante…

---

## [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…

---

## [From tensorflow.keras.wrappers.scikit\_learn import KerasClassifier](https://discuss.ai.google.dev/t/from-tensorflow-keras-wrappers-scikit-learn-import-kerasclassifier/15790)

<div class="topic-metadata">

**Author:** [@Tauhid\_ullah\_shah](https://discuss.ai.google.dev/u/Tauhid_ullah_shah)\
**Replies:** 6\
**Last updated:** [April 15, 2024, 5:42am UTC](https://discuss.ai.google.dev/t/from-tensorflow-keras-wrappers-scikit-learn-import-kerasclassifier/15790 "2024-04-15T05:42:32Z")

</div>

I am running the following code "import os import sys import pandas as pd import numpy as np from sklearn.metrics import confusion\_matrix from sklearn.model\_selection import GridSearchCV import tensorflow as tf fr…

---

## [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 …

---

## [Create\_padding\_mask in Transformer code uses encoder input sequence for creating padding mask in 2nd attention block of the decoder](https://discuss.ai.google.dev/t/create-padding-mask-in-transformer-code-uses-encoder-input-sequence-for-creating-padding-mask-in-2nd-attention-block-of-the-decoder/25964)

<div class="topic-metadata">

**Author:** [@Abhishek\_Kishore](https://discuss.ai.google.dev/u/Abhishek_Kishore)\
**Replies:** 1\
**Last updated:** [December 12, 2024, 1:44pm UTC](https://discuss.ai.google.dev/t/create-padding-mask-in-transformer-code-uses-encoder-input-sequence-for-creating-padding-mask-in-2nd-attention-block-of-the-decoder/25964 "2024-12-12T13:44:00Z")

</div>

I am going through the Transformer code on tensorflow.org . def create\_masks(self, inp, tar): # Encoder padding mask (Used in the 2nd attention block in the decoder too.) padding\_mask = create\_padding\_mask(inp) …

---

## [Apply a traied model with tensorflow on transformer pipeline pop out error](https://discuss.ai.google.dev/t/apply-a-traied-model-with-tensorflow-on-transformer-pipeline-pop-out-error/31140)

<div class="topic-metadata">

**Author:** [@Sara\_Taylor](https://discuss.ai.google.dev/u/Sara_Taylor)\
**Replies:** 1\
**Last updated:** [November 22, 2024, 5:53am UTC](https://discuss.ai.google.dev/t/apply-a-traied-model-with-tensorflow-on-transformer-pipeline-pop-out-error/31140 "2024-11-22T05:53:26Z")

</div>

i’m using this github text summarization and I have a problem. I have been struggling for two week and I could not figure that out. im using a notebook from this github repository: GitHub - flogothetis/Abstractive-S…

---

## [How to calculate BLUE score, precision, recall, calibration, confusion matrix for transformer?](https://discuss.ai.google.dev/t/how-to-calculate-blue-score-precision-recall-calibration-confusion-matrix-for-transformer/29670)

<div class="topic-metadata">

**Author:** [@Nada\_Nasef](https://discuss.ai.google.dev/u/Nada_Nasef)\
**Replies:** 1\
**Last updated:** [October 11, 2024, 7:23am UTC](https://discuss.ai.google.dev/t/how-to-calculate-blue-score-precision-recall-calibration-confusion-matrix-for-transformer/29670 "2024-10-11T07:23:34Z")

</div>

how to calculate BLUE score, precision, recall, calibration, confusion matrix for transformer example presented in (Neural machine translation with a Transformer and Keras)( Modelo de transformador para compreensão da li…

---

## [GPT NEO-For COVID-19 Question Answering](https://discuss.ai.google.dev/t/gpt-neo-for-covid-19-question-answering/27709)

<div class="topic-metadata">

**Author:** [@kaysarulanas](https://discuss.ai.google.dev/u/kaysarulanas)\
**Replies:** 1\
**Last updated:** [October 10, 2024, 8:30am UTC](https://discuss.ai.google.dev/t/gpt-neo-for-covid-19-question-answering/27709 "2024-10-10T08:30:17Z")

</div>

I am working on a NLP project. It is about question answering system of COVID-19 where i am using covid-19 open resource dataset from Kaggle. I am using GPT-Neo for training my data. Initially I worked with a very small…

---

## [Exception encountered when calling layer 'softmax' (type Softmax)](https://discuss.ai.google.dev/t/exception-encountered-when-calling-layer-softmax-type-softmax/31904)

<div class="topic-metadata">

**Author:** [@Igor\_Lessio](https://discuss.ai.google.dev/u/Igor_Lessio)\
**Replies:** 1\
**Last updated:** [September 19, 2024, 6:04pm UTC](https://discuss.ai.google.dev/t/exception-encountered-when-calling-layer-softmax-type-softmax/31904 "2024-09-19T18:04:47Z")

</div>

Im trying to deploy a TFT on my data but even trying 4 different approach once i arrive intot he mutihead i keep having same error on and on. here the shapes and the code i use. Shapes for the data: Before splitting th…

---

## [Masking propagation through layers](https://discuss.ai.google.dev/t/masking-propagation-through-layers/30920)

<div class="topic-metadata">

**Author:** [@mk6](https://discuss.ai.google.dev/u/mk6)\
**Replies:** 1\
**Last updated:** [September 19, 2024, 7:38am UTC](https://discuss.ai.google.dev/t/masking-propagation-through-layers/30920 "2024-09-19T07:38:26Z")

</div>

I’m confused about the handling of mask since there seems confict to me. In tf.keras.layers.Masking: If any downstream layer does not support masking yet receives such an input mask, an exception will be raised. In…

---

## [T5 fine-tuned model: one method ignores min\_target\_length parameter while one does not](https://discuss.ai.google.dev/t/t5-fine-tuned-model-one-method-ignores-min-target-length-parameter-while-one-does-not/28635)

<div class="topic-metadata">

**Author:** [@Seungjun\_Lee](https://discuss.ai.google.dev/u/Seungjun_Lee)\
**Replies:** 1\
**Last updated:** [August 23, 2024, 9:46am UTC](https://discuss.ai.google.dev/t/t5-fine-tuned-model-one-method-ignores-min-target-length-parameter-while-one-does-not/28635 "2024-08-23T09:46:03Z")

</div>

I created a text summary model by fine-tuning t5 model, and while inferencing I got a one question. Following two methods were given same input text, min\_target\_length and max\_target\_length but two are yielding differe…

---

## [Issue with Deserializing a Custom Transformer Model in TensorFlow](https://discuss.ai.google.dev/t/issue-with-deserializing-a-custom-transformer-model-in-tensorflow/22865)

<div class="topic-metadata">

**Author:** [@Jade\_TTT](https://discuss.ai.google.dev/u/Jade_TTT)\
**Replies:** 1\
**Last updated:** [May 20, 2024, 3:41am UTC](https://discuss.ai.google.dev/t/issue-with-deserializing-a-custom-transformer-model-in-tensorflow/22865 "2024-05-20T03:41:09Z")

</div>

I’m encountering an issue when trying to deserialize a custom Transformer model in TensorFlow.And therefore I cannot save and load my model like this : model\_directory =“saved\_model.keras” transformer\_model.save(model\_di…

---

## [RESOURCE\_EXHAUSTED when running TimeDistributed on MultiHeadAttention](https://discuss.ai.google.dev/t/resource-exhausted-when-running-timedistributed-on-multiheadattention/32524)

<div class="topic-metadata">

**Author:** [@Shirel\_Attia](https://discuss.ai.google.dev/u/Shirel_Attia)\
**Replies:** 1\
**Last updated:** [January 29, 2024, 11:47pm UTC](https://discuss.ai.google.dev/t/resource-exhausted-when-running-timedistributed-on-multiheadattention/32524 "2024-01-29T23:47:02Z")

</div>

Hi , i have built a model for classification of time series using a transformer and i am getting an error also when i am reducing all the hyperparameters. here is my model : class Transformer\_layer(tf.keras.layers.Laye…

---

## [How do I use sentence-transformers/all-MiniLM-L6-v2 tflite model in android studio (kotlin)](https://discuss.ai.google.dev/t/how-do-i-use-sentence-transformers-all-minilm-l6-v2-tflite-model-in-android-studio-kotlin/30714)

<div class="topic-metadata">

**Author:** [@Aniruddh\_Singh](https://discuss.ai.google.dev/u/Aniruddh_Singh)\
**Replies:** 1\
**Last updated:** [January 23, 2024, 6:45am UTC](https://discuss.ai.google.dev/t/how-do-i-use-sentence-transformers-all-minilm-l6-v2-tflite-model-in-android-studio-kotlin/30714 "2024-01-23T06:45:15Z")

</div>

I have a tflite version of the hugging face model sentence-transformers/all-MiniLM-L6-v2… But i dont know how to shape the input and output tensor…basically the model gives encoding of a sentence but also does multiple …

---

## [Getting very less accuracy in vision transformer](https://discuss.ai.google.dev/t/getting-very-less-accuracy-in-vision-transformer/28685)

<div class="topic-metadata">

**Author:** [@AKASH\_KUMAR](https://discuss.ai.google.dev/u/AKASH_KUMAR)\
**Replies:** 0\
**Last updated:** [October 17, 2023, 8:34am UTC](https://discuss.ai.google.dev/t/getting-very-less-accuracy-in-vision-transformer/28685 "2023-10-17T08:34:25Z")

</div>

Can anyone tell me what’s wrong in my code, I am getting very less accuracy in vision transformer, I have at least of 600 samples of all 6 classes, I even used data augmentation as well. I am sharing ipynb link as well #…

---

## [What is the model suitable for time series forecasting?](https://discuss.ai.google.dev/t/what-is-the-model-suitable-for-time-series-forecasting/27668)

<div class="topic-metadata">

**Author:** [@ruorch](https://discuss.ai.google.dev/u/ruorch)\
**Replies:** 2\
**Last updated:** [October 13, 2023, 6:38pm UTC](https://discuss.ai.google.dev/t/what-is-the-model-suitable-for-time-series-forecasting/27668 "2023-10-13T18:38:38Z")

</div>

I would like to forecast a time series of commodity prices. At the moment, I am using LSTM, CNN, and transformer, but the accuracy is not improving.

---

## [Call Tensorflow Model in a loop leaks memory](https://discuss.ai.google.dev/t/call-tensorflow-model-in-a-loop-leaks-memory/12310)

<div class="topic-metadata">

**Author:** [@ALER\_EM](https://discuss.ai.google.dev/u/ALER_EM)\
**Replies:** 1\
**Last updated:** [September 25, 2023, 12:05pm UTC](https://discuss.ai.google.dev/t/call-tensorflow-model-in-a-loop-leaks-memory/12310 "2023-09-25T12:05:40Z")

</div>

source code in the decode\_sequence function if i try to call that function in a loop it would leak my memory transformer(\[tokenized\_input\_sentence, tokenized\_target\_sentence\]) gc.collect() not work tf.keras.backend…

---

## [Issue with HuggingFace psuh\_to\_hub](https://discuss.ai.google.dev/t/issue-with-huggingface-psuh-to-hub/27368)

<div class="topic-metadata">

**Author:** [@Seungjun\_Lee](https://discuss.ai.google.dev/u/Seungjun_Lee)\
**Replies:** 1\
**Last updated:** [June 20, 2023, 10:31am UTC](https://discuss.ai.google.dev/t/issue-with-huggingface-psuh-to-hub/27368 "2023-06-20T10:31:03Z")

</div>

Hi following Keras tutorial, I created a fine-tuned version of t5 model using Keras API, and inferencing works well. But I’m having a some problem with uploading the model to the hub As written in the tutorial, I tried…

---

## [Though Training accuracy is high performance on training data during inference in transformer translation is poor](https://discuss.ai.google.dev/t/though-training-accuracy-is-high-performance-on-training-data-during-inference-in-transformer-translation-is-poor/31994)

<div class="topic-metadata">

**Author:** [@Sitaraman\_VR](https://discuss.ai.google.dev/u/Sitaraman_VR)\
**Replies:** 0\
**Last updated:** [June 9, 2023, 3:19am UTC](https://discuss.ai.google.dev/t/though-training-accuracy-is-high-performance-on-training-data-during-inference-in-transformer-translation-is-poor/31994 "2023-06-09T03:19:27Z")

</div>

Hi, I am trying to code transformer architecture from scratch. I tried it on a toy translation problem from english to german. I see there is a tendency to overfit on the training data as a the validation loss is abou…

---

## [How Hugging Face improved Text Generation performance with XLA](https://discuss.ai.google.dev/t/how-hugging-face-improved-text-generation-performance-with-xla/27308)

<div class="topic-metadata">

**Author:** [@Sayak\_Paul](https://discuss.ai.google.dev/u/Sayak_Paul)\
**Replies:** 1\
**Last updated:** [June 8, 2023, 9:00am UTC](https://discuss.ai.google.dev/t/how-hugging-face-improved-text-generation-performance-with-xla/27308 "2023-06-08T09:00:15Z")

</div>

A couple months back, we introduced full-blown XLA support to the TensorFlow text generation models in :hugs: Transformers. Through these changes to incorporate XLA compatibility, we were able to significantly improve th…

---

## [How to extract body of a transformer like models and fine tune with that body on different data](https://discuss.ai.google.dev/t/how-to-extract-body-of-a-transformer-like-models-and-fine-tune-with-that-body-on-different-data/26689)

<div class="topic-metadata">

**Author:** [@Arjun\_Reddy](https://discuss.ai.google.dev/u/Arjun_Reddy)\
**Replies:** 2\
**Last updated:** [June 5, 2023, 6:25pm UTC](https://discuss.ai.google.dev/t/how-to-extract-body-of-a-transformer-like-models-and-fine-tune-with-that-body-on-different-data/26689 "2023-06-05T18:25:51Z")

</div>

In BERT like transformer model (I am not talking about BERT in this thread), it has 2 training objectives Masked Language Modeling and Next sentence prediction right? and BERT model is also supports different input shape…

---

## [Does TransformerEncoder layer accept built-in mask?](https://discuss.ai.google.dev/t/does-transformerencoder-layer-accept-built-in-mask/32367)

<div class="topic-metadata">

**Author:** [@Amin\_Shn](https://discuss.ai.google.dev/u/Amin_Shn)\
**Replies:** 1\
**Last updated:** [May 8, 2023, 3:37pm UTC](https://discuss.ai.google.dev/t/does-transformerencoder-layer-accept-built-in-mask/32367 "2023-05-08T15:37:49Z")

</div>

I want to use the Tensorflow/Keras TransformerEncoder layer (https://keras.io/api/keras\_nlp/layers/transformer\_encoder/), but I am not sure if it accepts a built-in mask (e.g. generated by the Masking() layer) or the “pa…

---

## [Save and restore transformer model](https://discuss.ai.google.dev/t/save-and-restore-transformer-model/11869)

<div class="topic-metadata">

**Author:** [@adabingw](https://discuss.ai.google.dev/u/adabingw)\
**Replies:** 1\
**Last updated:** [March 18, 2023, 10:14am UTC](https://discuss.ai.google.dev/t/save-and-restore-transformer-model/11869 "2023-03-18T10:14:51Z")

</div>

I trained a model on Jupyter Notebook using the transformer tutorial. However, I want to save the model and work on it more on my own project. However, I encountered an issue in saving. It fails to save the model using…

---

## [Main transformers use-cases and insights](https://discuss.ai.google.dev/t/main-transformers-use-cases-and-insights/28574)

<div class="topic-metadata">

**Author:** [@Iden\_Crisler](https://discuss.ai.google.dev/u/Iden_Crisler)\
**Replies:** 0\
**Last updated:** [February 7, 2023, 3:31pm UTC](https://discuss.ai.google.dev/t/main-transformers-use-cases-and-insights/28574 "2023-02-07T15:31:53Z")

</div>

Hi. I’m very new to transformers and wanted some insight on some of the main and upcoming use-cases of transformers. I did research some cases but it’s mostly based GBT, Codex, etc. and I wanted to know of a few niche/d…

[Next page](https://discuss.ai.google.dev/tag/transformers/347.md?match_all_tags=true&page=1&tags%5B%5D=transformers)
