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

token_model Problem #6

Open
alialwehaibi opened this issue Dec 5, 2017 · 3 comments
Open

token_model Problem #6

alialwehaibi opened this issue Dec 5, 2017 · 3 comments

Comments

@alialwehaibi
Copy link

alialwehaibi commented Dec 5, 2017

After running this following code, I receive 'ModuleNotFoundError: No module named 'token_model''

`
with open('tweets1k.txt', 'r') as infile:
tweets = infile.readlines()

tokenizer = WordTokenizer()
tokenizer.build_vocab(tweets)

ds = Dataset(tweets, emojis, tokenizer=tokenizer)
ds.update_test_indices(test_size=0.2)
ds.save('dataset')

factory = TokenModelFactory(1, tokenizer.token_index, max_tokens=100, embedding_type='glove.6B.100d')
word_encoder_model = YoonKimCNN()
model = factory.build_model(token_encoder_model=word_encoder_model)
model.compile(optimizer='adam', loss='categorical_crossentropy')
model.summary()
`
How to solve that, please.

@seb-at-nzrs
Copy link

A quick workaround is edit keras_text/models/init.py to look like this

from .token_model import TokenModelFactory
from .sentence_model import SentenceModelFactory
from .sequence_encoders import *

Notice the period in front of each module.

@alialwehaibi
Copy link
Author

Unable to locate init.py on my system! Do you have any idea how to locate the path? I am using mac ios.

@pabshazon
Copy link

pabshazon commented Apr 7, 2018

Because He means edit
keras_text/models/__init__.py
look for that ;)

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

3 participants