token_model Problem
alialwehaibi opened this issue · comments
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.
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.
Unable to locate init.py on my system! Do you have any idea how to locate the path? I am using mac ios.
Because He means edit
keras_text/models/__init__.py
look for that ;)