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

training = prepare_data(training) broken #7

Open
changbaishan opened this issue Jan 29, 2019 · 0 comments
Open

training = prepare_data(training) broken #7

changbaishan opened this issue Jan 29, 2019 · 0 comments

Comments

@changbaishan
Copy link

training = prepare_data(training)
validation = prepare_data(validation)
test = prepare_data(test)

print('Build model...')
print('Vocab size =', VOCAB)

AttributeError Traceback (most recent call last)
in
----> 1 training = prepare_data(training)
2 validation = prepare_data(validation)
3 test = prepare_data(test)
4
5 print('Build model...')

in (data)
1 to_seq = lambda X: pad_sequences(tokenizer.texts_to_sequences(X), maxlen=MAX_LEN)
----> 2 prepare_data = lambda data: (to_seq(data[0]), to_seq(data[1]), data[2])

in (X)
----> 1 to_seq = lambda X: pad_sequences(tokenizer.texts_to_sequences(X), maxlen=MAX_LEN)
2 prepare_data = lambda data: (to_seq(data[0]), to_seq(data[1]), data[2])

~\Anaconda3\lib\site-packages\keras_preprocessing\text.py in texts_to_sequences(self, texts)
276 A list of sequences.
277 """
--> 278 return list(self.texts_to_sequences_generator(texts))
279
280 def texts_to_sequences_generator(self, texts):

~\Anaconda3\lib\site-packages\keras_preprocessing\text.py in texts_to_sequences_generator(self, texts)
307 self.filters,
308 self.lower,
--> 309 self.split)
310 vect = []
311 for w in seq:

~\Anaconda3\lib\site-packages\keras_preprocessing\text.py in text_to_word_sequence(text, filters, lower, split)
56 translate_dict = dict((c, split) for c in filters)
57 translate_map = maketrans(translate_dict)
---> 58 text = text.translate(translate_map)
59
60 seq = text.split(split)

AttributeError: 'numpy.ndarray' object has no attribute 'translate'

I realize that this is a numpy issue. As a widely used libaray, numpy does not honor back compatibility. Can you please write some other code to take care of this problem?

In java, mvn tells you which version of jar should be used. It appears to me python is an open source wide west. Can you please tell me if there is a work around?

Thanks

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