PKU-RL / DGN

DGN Code
333 stars 89 forks source link

tensorflow.python.framework.errors_impl.NotFoundError: data/battle_model/trusty-battle-game-l; No such file or directory #21

Open bkzfyx opened 3 years ago

bkzfyx commented 3 years ago

When I run the multi_battle.py, the following error happened: Traceback (most recent call last): File "examples/multi_battle.py", line 215, in tf_model.load("data/battle_model", 0, 'trusty-battle-game-l') File "/home/bkz/Downloads/MAgent-master/python/magent/builtin/tf_model/base.py", line 55, in load saver.restore(self.sess, os.path.join(dir_name, (self.subclassname + "%d") % epoch)) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/training/saver.py", line 1276, in restore if not checkpoint_management.checkpoint_exists(compat.as_text(save_path)): File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func return func(*args, **kwargs) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/training/checkpoint_management.py", line 372, in checkpoint_exists if file_io.get_matching_files(pathname): File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 363, in get_matching_files return get_matching_files_v2(filename) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 384, in get_matching_files_v2 compat.as_bytes(pattern)) tensorflow.python.framework.errors_impl.NotFoundError: data/battle_model/trusty-battle-game-l; No such file or directory

Could you please tell me how to solve the problem or the reason of the problem? Thank you very much!

Ppaddington commented 3 years ago

When I run the multi_battle.py, the following error happened: Traceback (most recent call last): File "examples/multi_battle.py", line 215, in tf_model.load("data/battle_model", 0, 'trusty-battle-game-l') File "/home/bkz/Downloads/MAgent-master/python/magent/builtin/tf_model/base.py", line 55, in load saver.restore(self.sess, os.path.join(dir_name, (self.subclassname + "%d") % epoch)) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/training/saver.py", line 1276, in restore if not checkpoint_management.checkpoint_exists(compat.as_text(save_path)): File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func return func(*args, **kwargs) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/training/checkpoint_management.py", line 372, in checkpoint_exists if file_io.get_matching_files(pathname): File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 363, in get_matching_files return get_matching_files_v2(filename) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 384, in get_matching_files_v2 compat.as_bytes(pattern)) tensorflow.python.framework.errors_impl.NotFoundError: data/battle_model/trusty-battle-game-l; No such file or directory

Could you please tell me how to solve the problem or the reason of the problem? Thank you very much!

tf_model = DeepQNetwork(env, handles[1], 'trusty-battle-game-l', use_conv=True)

tf_model.load("data/battle_model", 0, 'trusty-battle-game-l')

Like me, comment out the following line of code. The author did not give his trained model.

bkzfyx commented 3 years ago

When I run the multi_battle.py, the following error happened: Traceback (most recent call last): File "examples/multi_battle.py", line 215, in tf_model.load("data/battle_model", 0, 'trusty-battle-game-l') File "/home/bkz/Downloads/MAgent-master/python/magent/builtin/tf_model/base.py", line 55, in load saver.restore(self.sess, os.path.join(dir_name, (self.subclassname + "%d") % epoch)) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/training/saver.py", line 1276, in restore if not checkpoint_management.checkpoint_exists(compat.as_text(save_path)): File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func return func(*args, **kwargs) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/training/checkpoint_management.py", line 372, in checkpoint_exists if file_io.get_matching_files(pathname): File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 363, in get_matching_files return get_matching_files_v2(filename) File "/home/bkz/.local/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 384, in get_matching_files_v2 compat.as_bytes(pattern)) tensorflow.python.framework.errors_impl.NotFoundError: data/battle_model/trusty-battle-game-l; No such file or directory Could you please tell me how to solve the problem or the reason of the problem? Thank you very much!

tf_model = DeepQNetwork(env, handles[1], 'trusty-battle-game-l', use_conv=True)

tf_model.load("data/battle_model", 0, 'trusty-battle-game-l')

Like me, comment out the following line of code. The author did not give his trained model.

Thank you very much, but what is the impact of the line which has been omitted? I don't know clearly the relation between the trained model and the training process of the code.

george22294 commented 2 years ago

Even this answer is late, I think it will be useful for future readers. The DQN pretrained model can be found here: 'https://raw.githubusercontent.com/merrymercy/merrymercy.github.io/master/_data/magent/battle_model.tar.gz

There are two model: a) trusty-battle-game-l/tfdqn_0.index b)trusty-battle-game-r/tfdqn_0.index

Based on the code, the right model is (a). I found this link in this script of MAgent platform.

george22294 commented 1 year ago

trusty-battle-game-l.zip

The above link does not work any more. I have attached the model to this comment.