Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

DO NOT SUBMIT : String tensor #257

Closed
wants to merge 16 commits into from

Conversation

bileschi
Copy link
Contributor

@bileschi bileschi commented Jun 29, 2018

Description


For repository owners only:

Please remember to apply all applicable tags to your pull request.
Tags: FEATURE, BREAKING, BUG, PERF, DEV, DOC, SECURITY

For more info see: https://github.com/tensorflow/tfjs/blob/master/DEVELOPMENT.md


This change is Reviewable

@bileschi bileschi changed the title String tensor DO NOT SUBMIT : String tensor Jun 29, 2018
@bileschi
Copy link
Contributor Author

This branch is an exploration of how preprocessing layers might look. It is not intended for submission. Created this PR to enable easier sharing with interested parties.

@caisq
Copy link
Contributor

caisq commented Jun 30, 2018

Just a quick question before more thorough reviewing: why implement StringTensor in tfjs-layers? Shouldn't it be in tfjs-core and just be an additional dtype of the existing Tensor class?


Review status: 0 of 1 LGTMs obtained


Comments from Reviewable

@bileschi
Copy link
Contributor Author

bileschi commented Jun 30, 2018 via email

@tcboswell
Copy link

Some tests in src/engine/preprocessing_training.ts intend to really train a model with a vocabulary layer, going beyond what fitUnsupervised does. What should the trainable weight variables be, since the methods relevant to strings in preprocess_core.ts appear to only involve vocabulary management?

@tcboswell
Copy link

An afterthought which might answer the question.
I suppose that the vocabulary layer is indeed not intended to carry trainable variables, and that the point of the unit test involving the fit operation on a model with just a vocabulary layer was only to ensure that adding such a layer to a model would not interfere with the fit operation.

@bileschi
Copy link
Contributor Author

bileschi commented Sep 4, 2018

In the design that I am promoting, it will be possible to use the input data to adjust the VocabLayer's internal statistics. It is un settled at this point whether this will be an operation that is part of the PreproecessingLayer API, or whether it will be triggered by the model, or something else entirely.

Interested to hear your thoughts and preferences on the matter!

@tcboswell
Copy link

Thanks for your willingness to hear my thoughts on the matter. There are two things that come to mind now.

I assume that the updating process of the vocabulary layer is needed in a situation where a pre-trained model has been imported and should be re-trained, but in the new data there are vocabulary items which were not in the original data.

A first consideration is that this would also require that some imported weights in the model be augmented in size, and the enlarged weights would have to be initialised at the new points.

A second consideration is that what is imported typically consists not only of pre-trained model weights, but also so-called word embeddings like the GloVe pre-trained vectors, so there would also need to be a process for assigning embeddings to new vocabulary.

These are two situations which I remember encountering. Maybe accommodating them would be desiderata for typical users of the software.

@bileschi
Copy link
Contributor Author

bileschi commented Jan 4, 2019

This PR is superseded by the addition of string tensors in @tensorflow/tfjs-core #1408

@bileschi bileschi closed this Jan 4, 2019
@tcboswell
Copy link

tcboswell commented Jun 17, 2019 via email

@bileschi
Copy link
Contributor Author

Hi @tcboswell ,

Thanks for your interest! We decided to implement this another way. See here:
tensorflow/tfjs-core#1408 (which Layers depends on)

This functionality hasn't been pulled through to layers yet, though, since there currently aren't any Keras layers which take string tensors (though this is changing with addition of Keras preprocessing layers)

keras-team/governance@6eb818b#diff-759af1e95f3c3f6515f6287a1a786470R11

Is there something that you need tfjs-layers to do that wouldn't be covered by this?

Sincerely,
Stan

@tcboswell
Copy link

tcboswell commented Jun 18, 2019 via email

@bileschi
Copy link
Contributor Author

bileschi commented Jun 18, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants