322 questions
3
votes
1
answer
58
views
How to fix ValueError: Only instances of keras.Layer can be added to a Sequential model when adding tensorflow_hub.KerasLayer?
I am learning TensorFlow and transfer learning, and I am trying to add a TensorFlow Hub feature extractor to a Keras Sequential model. But I get this error:
ValueError: Only instances of keras.Layer ...
1
vote
1
answer
90
views
How can I save a model with input shape (1, None, None, 3) with None fixed to 256?
I have questions about a model obtained from TensorFlow Hub.
I am trying to use "movenet" with the following source code.
https://www.kaggle.com/models/google/movenet/tensorFlow2
(1) The ...
1
vote
0
answers
69
views
I cannot transfer learning YAMNET for multi-label problem
I'm using this tutorial to apply transfer learning to my dataset which has 32 classes of audio.
https://www.tensorflow.org/tutorials/audio/transfer_learning_audio?hl=en
But this does not seem to work ...
-2
votes
1
answer
34
views
About tensorflow_hub
hi guys i'm successfully import tensorflow_hub.
but when I trey to run this code part
"
**IMAGE_SHAPE = (224, 224)
classifier = tf.keras.Sequential([
hub.KerasLayer(classifier_model, input_shape=...
1
vote
4
answers
2k
views
Only instances of `keras.Layer` can be added to a Sequential model
I encountered an error related to Sequential while working with TensorFlow Hub. Can anyone help me with this?"
enter image description here
"ValueError: Only instances of keras.Layer can be ...
6
votes
9
answers
10k
views
error : Only instances of `keras.Layer` can be added to a Sequential model
I simply want to wrap the model as a keras layer but it simply is not happening ans keeps showing this error to me, i don't know if it's the keras or tensorflow version but i don't want to change them ...
0
votes
0
answers
229
views
Tensorflow Hub: AttributeError: module 'tensorflow_hub' has no attribute 'load'
Got this error message. Used Pycharm IDE for Python.
This is the code I had used:
import tensorflow_hub as hub
embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder-large/5")...
3
votes
2
answers
2k
views
Issue with BERT Preprocessor model in TF2 and python
I am trying to use BERT to do a text classification project. However I keep running into this error
`
ValueError Traceback (most recent call last)
Cell In[37], line 4
...
0
votes
2
answers
3k
views
Module 'tensorflow_hub' has no attribute 'Module'
I used Jupyter Notebook to do ELMo to extract features.
However, when I am trying to run the code
!pip install tensorflow
!pip install tensorflow-hub
import tensorflow_hub as hub
import tensorflow as ...
1
vote
0
answers
42
views
TensorFlow_Hub saved model online accessibility?
I've followed the TensorFlow_Hub documentation to retrain one of their models to identify one of 20 cat breeds from an image. I'm doing this for school, and part of it requires me making it available ...
0
votes
1
answer
493
views
TensorFlow saved_model.pb cannot be loaded correctly
I have downloaded a model from Hub. The archive contains TensorFlow 2 saved model and if decompressed shows a file named saved_model.pb and a variables folder that inside has 2 files variables.data-...
0
votes
1
answer
593
views
Why is Tensorflow Hub giving 403 Error suddenly?
Created a project almost a year ago that uses TensorFlow models. All has been working fine up until this morning. Suddenly our application has started getting errors to fetch models at the following ...
0
votes
1
answer
88
views
tensorflow hub in flutter_android
I want to use the model food_V1, https://tfhub.dev/google/aiy/vision/classifier/food_V1/1 in Flutter, but when I download the model, there is no labels.txt file. There is only one tflite file and I ...
0
votes
1
answer
1k
views
Tensorflow-Hub Modules not loading
I am trying to use the universal sentence encoder 4, It works on my desktop at home but I am not home so I am having to re-set everything up. I am using this all in a virtual environment. I have ...
0
votes
1
answer
177
views
miniconda3 -> Jupyter -> tensorflow-hub -> [SSL: CERTIFICATE_VERIFY_FAILED]
When I try to load a model from tensorflow hub like:
INPUT_SHAPE = [None, IMG_SIZE, IMG_SIZE, 3]
OUTPUT_SHAPE = len(unique_labels)
MODEL_URL = "https://tfhub.dev/google/imagenet/...
0
votes
1
answer
368
views
TypeError: 'AutoTrackable' object is not callable when loading BERT module from TF Hub
In my code I wish to create a tokenizer from a pretrained TF Hub BERT module. Following is my code:
sess = tf.compat.v1.Session()
bert_path = "https://tfhub.dev/google/bert_uncased_L-12_H-768_A-...
1
vote
0
answers
69
views
convert Tensorflow Hub model to TF Lite
I tried to convert a model downloaded from tensorflow hub: faster_rcnn/openimages_v4/inception_resnet_v2 to TF Lite without success.
This model interests me in particular because it has been trained ...
-1
votes
2
answers
690
views
How to decode token ids into words?
The text preprocessing models on the hub describe how to convert an input sentence, like "I am a boy", into token ids. But it does not show me how to convert those token ids back into words. ...
1
vote
1
answer
245
views
AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'monitoring'
Recently installed tensorflow and tensorflow_hub in a miniconda environment and have an issue when trying to run a script. Receive the following error:
Traceback (most recent call last):
File "/...
0
votes
1
answer
852
views
Convert a model from tf_hub to onnx using tf2onnx
I downloaded a model from tensorflow hub, and then tried to convert it into onnx using tf2onnx (https://github.com/onnx/tensorflow-onnx).
However the model does not seem to work properly after ...
0
votes
1
answer
75
views
Yamnet TF_hub - No algorithm worked CUDNN_STATUS_EXECUTION_FAILED
I defined a yamnet model of tensorflow 2 tensorflow_hub:
yamnet_model = hub.load('https://tfhub.dev/google/yamnet/1')
wav_data, sample_rate = librosa.load(wav_file_name, sr=16000)
scores, spectogram =...
1
vote
0
answers
163
views
How to read files in parallel with tf.data.Dataset.from_generator?
I have successfully created a TF dataset using tf.data.Dataset.from_generator that reads several binary files in sequence and converts them to strings. The code looks like this:
my_dataset = tf.data....
0
votes
1
answer
56
views
Why does estimator.export_saved_model complain about missing variables after TF2 migration?
I'm doing distillation with a teacher and student BERT model and exporting the student model with estimator.export_saved_model. This worked fine in TF1, but I moved to TF2 to be able to use multi-gpu ...
0
votes
1
answer
127
views
How to manage model file, when load more than 2 models downloading mannually from Tensorflow Hub?
I tried to download model from the url
It showed error: URLError: <urlopen error [Errno 101] Network is unreachable>
and solved this problem with How to load TF hub model from local system
But ...
3
votes
2
answers
608
views
Problems with tensorflow_hub in google Colab
I'm trying to play with BERT in Google Colab and
import tensorflow_hub as hub
but it raising ValueError:
The name 'tf.TrackableConstant' has already been registered to a serializable class. Found: &...
0
votes
1
answer
437
views
NotFoundError using BERT Preprocessing from TFHub
I'm trying to use the pre-trained BERT models on TensorFlow Hub to do some simple NLP. I'm on a 2021 MacBook Pro (Apple Silicon) with Python 3.9.13 and TensorFlow v2.9.2. However, preprocessing any ...
0
votes
1
answer
553
views
Why is the validation accuracy low even though I'm using a pretrained model?
I am trying to classify 10 species of birds on google colab using a pretrained model from tensorflow hub which has been trained on 964 species of birds. But when I train it, the accuracy isn't as high ...
2
votes
1
answer
1k
views
ValueError: When input_signature is provided, all inputs to the Python function must be convertible to tensors:
I have pyspark df like this:
id desc
1 abd hdbh jbj
2 sgjhd jhdgh gjhg
3 bvj hvhgvgh
4 jkjb bhj
Now I want to convert my desc column to vector so I'm using Google sentence ...
1
vote
2
answers
371
views
Tensorflow Hub Loaded Model - ValueError: Signature specifies 343 arguments, got: 342
I'm passing a Numpy array, image, to 'process_image'. It is then processed, turned into a TensorSpec object with the dimensions and dtype required by the Tensorflow Hub model.
def image_preprocessing(...
0
votes
1
answer
246
views
fine-tune the model from TensorFlow Hub
I have used this code from the TensorFlow website:
https://www.tensorflow.org/tutorials/images/transfer_learning_with_hub
I have to implement the entire code without any problem, but I am wondering ...
0
votes
1
answer
857
views
Issue Using tensorflow hub Universal Sentence Encoder with local runtime and GPU in Google Colab
I am working through a machine learning course to learn tensorflow. In one of the project I was performing text classification using a tensorflow_hub pre trained embedding, the Universal sentence ...
0
votes
1
answer
49
views
How to avoid outputting a auto generated directory when downloading tensorflow hub module
Code:
import os
path = "https://tfhub.dev/google/universal-sentence-encoder-multilingual/3" + "?tf-hub-format=compressed"
os.environ["TFHUB_CACHE_DIR"] = '/...
1
vote
0
answers
115
views
How to make observation a string in custom PyEnvironment
In the tensorflow documentation for TF-Agents Environments there is an example of an environment for a simple (blackjack inspired) card game.
The __init__ looks like the following:
class CardGameEnv(...
0
votes
1
answer
2k
views
tensorflow hub example throws an error when Float16 is enabled
I am trying to load a model from Tensorflowhub using example code. It works perfect with the FP32. As soon as I add the tf.keras.mixed_precision.set_global_policy('mixed_float16') to enable mixed ...
0
votes
1
answer
53
views
Running TF Hub Model sfaster by transfer learning?
I have a project where I want to detect humans from images. I have implemented the code so that I use pre-trained TF Hub Models that are available at: https://github.com/tensorflow/models/blob/master/...
1
vote
0
answers
523
views
RoBERTa example from tfhub produces error "During Variant Host->Device Copy: non-DMA-copy attempted of tensor type: string"
I would like to use the roberta-base model from tfhub. I am trying to run the example below, although I get an error when I try to feed sentences to model as input. I get the following error Invalid ...
0
votes
1
answer
97
views
Error while working on chatbot-universal-sentence-encoder
I am trying "chatbot.py" and I am getting below error.
Traceback (most recent call last):
File "chatbot.py", line 11, in
embeddings = model(df["MESSAGE"].values)["...
0
votes
1
answer
463
views
How to use tensorflow hub in Azure ML
I am trying to use TensorFlow Hub in Azure ML Studio
I am using the kernel Python 3.8 PT and TF
And I installed a few modules:
!pip install bert-for-tf2
!pip install sentencepiece
!pip install "...
0
votes
1
answer
357
views
Error while creating a model for binary classification for text classification
code:
model = create_model()
model.compile(optimize=tf.keras.optimizers.Adam(learning_rate=2e-5),
loss=tf.keras.losses.BinaryCrossentropy(),
metrics=[tf.keras.metrics....
2
votes
1
answer
2k
views
How to load a model using Tensorflow Hub and make a prediction?
This should be a simple task: Download a model saved in tensorflow_hub format, load using tensorflow_hub, and use..
This is the model I am trying to use (simCLR stored in Google Cloud): https://...
0
votes
1
answer
1k
views
Yamnet audio classification for feature extraction
I am currently working on audio classification task and using Yamnet which is a pretrained model from tfhub.. I am using it to extract embeddings from audios and then i use another simple ...
0
votes
0
answers
3k
views
Can't open .tflite file downloaded from TensorFlow hub
I'm trying to download a style transfer model, and I want to get style bottlenecks from a bunch of images. Here's the code, which I sourced from this site.
style_predict_path = tf.keras.utils.get_file(...
2
votes
1
answer
353
views
Why some TensorFlow-Hub models are not fine tunable?
I am just learning image classification with TensorFlow and found that there is a TensorFlow hub where we can use a lot of models for a lot of classification tasks. For example, I want to build food ...
0
votes
1
answer
238
views
tensorflow: doesn't appear to be using GPU for compute
I have downloaded and am using a tensorflow hub model.
The model creation code is:
model_url = "https://tfhub.dev/google/imagenet/mobilenet_v3_large_075_224/feature_vector/5" # "https:/...
0
votes
1
answer
162
views
Creating appropriate dataset for tensorflow multilabel classification model: "ValueError: setting an array element with a sequence"
I'm trying to train a multiclass image classification model, based on this model:
https://tfhub.dev/google/imagenet/inception_v3/feature_vector/5
And taking some code from here:
https://colab.research....
0
votes
1
answer
613
views
BERT encodings from TensorFlow hub
I am using the following code to generate embeddings for my text classification.
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_text as text
bert_preprocess =hub.KerasLayer(&...
0
votes
1
answer
116
views
Is there a faster way to convert sentences to TFHUB embeddings?
So I am involved in a project that involves feeding a combination of text embeddings and image vectors into a DNN to arrive at the result. Now for the word embedding part, I am using TFHUB's Electra ...
0
votes
1
answer
641
views
Is there a common label.txt file for quantized TFLite image classification models?
I have built an android ML image classification app using the starter model from Tensorflow.org/lite. The starter model includes the .TFLite model and also an accompanying label.txt file. I now want ...
0
votes
1
answer
146
views
Tensorflow loss function no gradient provided
Currently I try to code my own loss function, but when returning the result (a tensor that consists of a list with the loss values) I get the following error:
ValueError: No gradients provided for any ...
2
votes
1
answer
849
views
tensorflow_hub returns NotImplementedError when saving a keras model
Tried to save a Keras model by following the TensorFlow tutorial.
from tensorflow.keras.layers import Dense, Input
from tensorflow.keras.models import Model
import tensorflow_hub as hub
import ...