python - RuntimeError: Attempted to use a closed Session in tflearn -
i want train model tflearn, error showed above. here training loop: btw splitted training inputs in seperate numpy files
for in range(epochs): file in filess: file = np.load(file) x = [] y = [] a, b in file: x.append(a) y.append(b[0]) x = np.array(x).reshape(-1,width,height,1) sd in range(len(y)): idx = genres.index(y[sd]) y[sd] = idx print(y) y = np.array(y) try: model.load(model_name) except: print("no model") model.fit({'input': x}, {'targets': y}, n_epoch=1, snapshot_step=500, show_metric=true, run_id=model_name) model.save(model_name)`
here full error message:
`traceback (most recent call last): file "main.py", line 39, in <module> model.fit({'input': x}, {'targets': y}, n_epoch=1, snapshot_step=500, show_metric=true, run_id=model_name) file "d:\anaconda3\envs\python35\lib\site-packages\tflearn\models\dnn.py", line 215, in fit callbacks=callbacks) file "d:\anaconda3\envs\python35\lib\site- packages\tflearn\helpers\trainer.py", line 356, in fit self.train_ops = original_train_ops file "d:\anaconda3\envs\python35\lib\contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) file "d:\anaconda3\envs\python35\lib\site- packages\tensorflow\python\framework\ops.py", line 3625, in get_controller yield default file "d:\anaconda3\envs\python35\lib\site- packages\tflearn\helpers\trainer.py", line 336, in fit show_metric) file "d:\anaconda3\envs\python35\lib\site- packages\tflearn\helpers\trainer.py", line 775, in _train tflearn.is_training(true, session=self.session) file "d:\anaconda3\envs\python35\lib\site-packages\tflearn\config.py", line 95, in is_training tf.get_collection('is_training_ops')[0].eval(session=session) file "d:\anaconda3\envs\python35\lib\site- packages\tensorflow\python\framework\ops.py", line 569, in eval return _eval_using_default_session(self, feed_dict, self.graph, session) file "d:\anaconda3\envs\python35\lib\site- packages\tensorflow\python\framework\ops.py", line 3741, in _eval_using_default_session return session.run(tensors, feed_dict) file "d:\anaconda3\envs\python35\lib\site- packages\tensorflow\python\client\session.py", line 778, in run run_metadata_ptr) file "d:\anaconda3\envs\python35\lib\site- packages\tensorflow\python\client\session.py", line 914, in _run raise runtimeerror('attempted use closed session.') runtimeerror: attempted use closed session.`
i hope can me cause tried time now, didnt found solutions
Comments
Post a Comment