Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Lambda encodings #1

Open
asah opened this issue Jul 18, 2017 · 0 comments
Open

remove Lambda encodings #1

asah opened this issue Jul 18, 2017 · 0 comments

Comments

@asah
Copy link
Owner

asah commented Jul 18, 2017

Currently, Keras code uses Lambda functions for encoding the characters, which breaks two things:

  1. can't run keras-js (in browser prediction): https://github.com/transcranial/keras-js
  2. trained models (.hdf5) are specific to the given encoding

The code to replace:

def binarize(x, sz=97):
import tensorflow as tf2
return tf2.to_float(tf2.one_hot(x, sz, on_value=1, off_value=0, axis=-1))

def binarize_outshape(in_shape, sz=97):
return in_shape[0], in_shape[1], sz
...
embedded = Lambda(binarize, output_shape=binarize_outshape)(line_of_code_input)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant