question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An estimate of when the tf TextVectorization layer will be implemented in tfjs?

See original GitHub issue

I have a question

TensorFlow.js version

1.7.4r1

Browser version

Google Chrome Version 81.0.4044.138 (Official Build) (64-bit)

Describe the problem or feature request

Is there a timeline to implement the tf TextVectorization layer in tfjs?

I build a keras model in python using this layer: from tensorflow.python.keras.layers.preprocessing import text_vectorization TextVectorization.
it works, code snippet:

   vectorize_layer = text_vectorization.TextVectorization(
          max_tokens=400,
          output_mode='tf-idf', name="textvectorizing")
    vectorize_layer.adapt(np.array(text_data))
    input_text = tf.keras.Input(shape=(1,),dtype=tf.string, name="text")
    text_vectorized = vectorize_layer(input_text)

but when I imported to tfjs, I get this message

errors.ts:48 Uncaught (in promise) Error: Unknown layer: TextVectorization. This may be due to one of the following reasons:
1. The layer is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.
2. The custom layer is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().
    at new t (errors.ts:48)
    at deserializeKerasObject (generic_utils.ts:242)
    at deserialize (serialization.ts:31)

Thank you!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
zliendocommented, May 22, 2020

Thank you @rthadur for the prompt response, ok, I will give it a try on contributing its implementation, I’m building a POC, for the final model I may use embeddings instead.

I’ll read about how to contribute

0reactions
zliendocommented, Jun 11, 2020

Hi @imartinezl , I did implement js logic to do the tf-idf transform vectorization (which works for the POC that I am working on), but I haven’t implemented it as a layer for a tensorflow model yet. I did get approval from my director to contribute to this open source repository, still I have to go through my company levels of approval for this type of external contributions (routine reviews), then it may take some time before my contribution to this repository (which I am looking forward too! exciting! )

Read more comments on GitHub >

github_iconTop Results From Across the Web

tf.keras.layers.TextVectorization | TensorFlow v2.11.0
A preprocessing layer which maps text features to integer sequences.
Read more >
You should try the new TensorFlow's TextVectorization layer.
OOV data is optional when appending additional data in tf-idf mode; if an OOV value is supplied it will overwrite the existing OOV...
Read more >
tensorflow metrics example
Here, I will create one named tf: $ conda create -n tf python=3. In TensorFlow 1. bitwise. Erbt von: Metric, Layer, Module Aliasnamen...
Read more >
Keras Text Vectorization Layer: Configure, Adapt, Use, Save ...
Today, we will deal with the tf.keras. layers. TextVectorization layer which: turns raw strings into an encoded representation that ...
Read more >
Keras Tutorial | An Introduction for Beginners - Great Learning
tf.keras.preprocessing.text_dataset_from_directory is used for the same ... Keras supports a text vectorization layer, which can be directly used in the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found