Tflearn 问题 model.load

Tflearn issue over model.load

# restore all of our data structures
import pickle
import tflearn
import tensorflow as tf
import random
...
# load our saved model
model.load('./model.tflearn')

def clean_up_sentence(sentence):
    # tokenize the pattern
    sentence_words = nltk.word_tokenize(sentence)
    # stem each word

我的错误

$ python wrapper.py

Scipy not supported!
Traceback (most recent call last):
  File "wrapper.py", line 18, in <module>
    model.load('./model.tflearn')
NameError: name 'model' is not defined

有什么帮助吗?

我的模型写代码看起来像

model.fit(train_x, train_y, n_epoch=1000, batch_size=8, show_metric=True)
model.save('model.tflearn')

我正在使用 tflearn 开发一个聊天机器人,我训练了模型并保存了模型,但是当我再次加载它时它会抛出错误,同一目录中的 python 文件和模型都在同一目录中也是..

net = tflearn.input_data(shape=[None, len(train_x[0])])
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, len(train_y[0]), activation='softmax')
net = tflearn.regression(net)
model = tflearn.DNN(net, tensorboard_dir='tflearn_logs')
# load our saved model
model.load('./model.tflearn')

我忘了提到变量模型,这导致错误弹出。