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

After loaded a saved model, DeepcutTokenizer not found function "todense()" #71

Open
sahussawud opened this issue Sep 28, 2021 · 0 comments

Comments

@sahussawud
Copy link

environments

  • deepcut==0.7.0
  • python3.7
  • collab notebook

saving part

tokenizer = DeepcutTokenizer(ngram_range=(1,3), max_df=1.0, min_df=0.0)
X = tokenizer.fit_tranform(tokenized_df) 

X_test = tokenizer.transform(test_df[:10]) # use built tokenizer vobalurary to transform new text
print(X_test.shape)

tokenizer.save_model(dirpath+'tokenizer.pickle') # save the tokenizer to use later

load part

X = deepcut.load_model(dirpath+'tokenizer.pickle')
# plot stuff 
fig, ax = plt.subplots(figsize=(12, 12))
ax.imshow(X.todense(), interpolation='nearest')
plt.tight_layout()

error found

AttributeError                            Traceback (most recent call last)
<ipython-input-14-0de8817a548e> in <module>()
      1 fig, ax = plt.subplots(figsize=(12, 12))
----> 2 ax.imshow(X.todense(), interpolation='nearest')
      3 plt.tight_layout()

AttributeError: 'DeepcutTokenizer' object has no attribute 'todense'
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