wjh720 / QPLEX

87 stars 28 forks source link

KeyError: '__name__' #3

Open yyf17 opened 3 years ago

yyf17 commented 3 years ago

when I run the following command under the directory(/data/workspace/QPLEX/pymarl-master)

python3 src/main.py --config=qplex --env-config=matrix_game_2 with local_results_path='results/matrix/' save_model=True use_tensorboard=True save_model_interval=200000 t_max=210000 epsilon_finish=1.0

occured the errors as follows: [DEBUG 10:35:47] git.cmd Popen(['git', 'version'], cwd=/data/workspace/QPLEX/pymarl-master, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'version'], cwd=/data/workspace/QPLEX/pymarl-master, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'cat-file', '--batch-check'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=) [DEBUG 10:35:47] git.cmd Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'cat-file', '--batch-check'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=) [DEBUG 10:35:47] git.cmd Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=None) [DEBUG 10:35:47] git.cmd Popen(['git', 'cat-file', '--batch-check'], cwd=/data/workspace/QPLEX, universal_newlines=False, shell=None, istream=) src/main.py:79: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config_dict = yaml.load(f) src/main.py:49: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config_dict = yaml.load(f) [INFO 10:35:47] root Saving to FileStorageObserver in results/sacred. {'--beat-interval': None, '--capture': None, '--comment': None, '--debug': False, '--enforce_clean': False, '--file_storage': None, '--force': False, '--help': False, '--loglevel': None, '--mongo_db': None, '--name': None, '--pdb': False, '--print-config': False, '--priority': None, '--queue': False, '--s3': None, '--sql': None, '--tiny_db': None, '--unobserved': False, 'COMMAND': None, 'UPDATE': ['local_results_path=results/matrix/', 'save_model=True', 'use_tensorboard=True', 'save_model_interval=200000', 't_max=210000', 'epsilon_finish=1.0'], 'help': False, 'with': True} [DEBUG 10:35:47] pymarl Using capture mode "fd" [INFO 10:35:47] pymarl Running command 'my_main' [INFO 10:35:47] pymarl Started run with ID "1" [DEBUG 10:35:47] pymarl Starting Heartbeat [DEBUG 10:35:47] my_main Started [INFO 10:35:47] my_main Experiment Parameters: [INFO 10:35:47] my_main

{ 'action_selector': 'epsilon_greedy', 'adv_hypernet_embed': 64, 'adv_hypernet_layers': 3, 'agent': 'rnn', 'agent_output_type': 'q', 'batch_size': 32, 'batch_size_run': 1, 'buffer_cpu_only': True, 'buffer_size': 5000, 'burn_in_period': 32, 'checkpoint_path': '', 'critic_lr': 0.0005, 'demo_interval': 1000, 'double_q': True, 'env': 'matrix_game_2', 'env_args': { 'episode_limit': 1, 'is_print': False, 'n_actions': 3, 'n_agents': 2, 'obs_last_action': False, 'print_rew': False, 'print_steps': 1000, 'seed': 477239634, 'state_last_action': False}, 'epsilon_anneal_time': 50000, 'epsilon_finish': 1.0, 'epsilon_start': 1.0, 'evaluate': False, 'gamma': 0.99, 'grad_norm_clip': 10, 'hypernet_embed': 64, 'is_adv_attention': True, 'is_batch_rl': False, 'is_from_start': True, 'is_minus_one': True, 'is_save_buffer': False, 'is_stop_gradient': True, 'label': 'default_label', 'learner': 'dmaq_qatten_learner', 'learner_log_interval': 1000, 'load_buffer_id': 0, 'load_step': 0, 'local_results_path': 'results/matrix/', 'log_interval': 1000, 'lr': 0.0005, 'mac': 'basic_mac', 'mixer': 'dmaq', 'mixing_embed_dim': 32, 'name': 'qplex', 'num_circle': 1, 'num_kernel': 10, 'obs_agent_id': True, 'obs_last_action': True, 'optim_alpha': 0.99, 'optim_eps': 1e-05, 'repeat_id': 1, 'rnn_hidden_dim': 64, 'runner': 'episode', 'runner_log_interval': 1000, 'save_buffer_id': 0, 'save_buffer_interval': 1000, 'save_buffer_size': 10000, 'save_model': True, 'save_model_interval': 200000, 'save_replay': False, 'seed': 477239634, 't_max': 210000, 'target_update_interval': 200, 'test_greedy': True, 'test_interval': 1000, 'test_nepisode': 30, 'use_cuda': True, 'use_tensorboard': True, 'weighted_head': True}

[INFO 10:35:49] my_main Beginning training for 210000 timesteps /data/workspace/QPLEX/pymarl-master/src/components/episode_buffer.py:104: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requiresgrad(True), rather than torch.tensor(sourceTensor). v = th.tensor(v, dtype=dtype, device=self.device) [INFO 10:35:49] my_main t_env: 1 / 210000 [INFO 10:35:49] my_main Estimated time left: 28 seconds. Time passed: 0 seconds [INFO 10:35:49] my_main Saving models to results/matrix/models/qplex2021-01-20_10-35-47/1 /home/yyf/anaconda3/envs/ma/lib/python3.6/site-packages/torch/nn/functional.py:1625: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead. warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.") action_pair_0_0 [0. 0.10165232] [ 0.06337885 -0.05444577] -0.44034332 8.0 action_pair_0_1 [0. 0.] [0.06337885 0.04720655] -0.4400812 -12.0 action_pair_0_2 [0. 0.16995847] [ 0.06337885 -0.12275192] -0.44051677 -12.0 action_pair_1_0 [0.07982428 0.10165232] [-0.01644544 -0.05444577] -0.4425343 -12.0 action_pair_1_1 [0.07982428 0. ] [-0.01644544 0.04720655] -0.44228593 0.0 action_pair_1_2 [0.07982428 0.16995847] [-0.01644544 -0.12275192] -0.44273216 0.0 action_pair_2_0 [0.19648269 0.10165232] [-0.13310385 -0.05444577] -0.44572845 -12.0 action_pair_2_1 [0.19648269 0. ] [-0.13310385 0.04720655] -0.44552478 0.0 action_pair_2_2 [0.19648269 0.16995847] [-0.13310385 -0.12275192] -0.44595572 0.0 [INFO 10:35:56] my_main Updated target network /home/yyf/anaconda3/envs/ma/lib/python3.6/site-packages/jsonpickle-1.4.2-py3.6.egg/jsonpickle/ext/numpy.py:291: UserWarning: ndarray is defined by reference to an object we do not know how to serialize. A deep copy is serialized instead, breaking memory aliasing. warnings.warn(msg) [INFO 10:36:03] my_main Updated target network [INFO 10:36:10] my_main Updated target network [INFO 10:36:18] my_main Updated target network [DEBUG 10:36:25] pymarl Stopping Heartbeat [ERROR 10:36:25] pymarl Failed after 0:00:38! Traceback (most recent call last): File "/data/workspace/CollaQ/third_party/sacred/sacred/experiment.py", line 319, in run_commandline options=args, File "/data/workspace/CollaQ/third_party/sacred/sacred/experiment.py", line 276, in run run() File "/data/workspace/CollaQ/third_party/sacred/sacred/run.py", line 238, in call self.result = self.main_function(args) File "/data/workspace/CollaQ/third_party/sacred/sacred/config/captured_function.py", line 42, in captured_function result = wrapped(args, **kwargs) File "src/main.py", line 35, in my_main run(_run, config, _log) File "/data/workspace/QPLEX/pymarl-master/src/run.py", line 51, in run run_sequential(args=args, logger=logger) File "/data/workspace/QPLEX/pymarl-master/src/run.py", line 345, in run_sequential logger.print_recent_stats() File "/data/workspace/QPLEX/pymarl-master/src/utils/logging.py", line 48, in print_recent_stats item = "{:.4f}".format(np.mean([x[1] for x in self.stats[k][-window:]])) File "<__array_function internals>", line 6, in mean File "/home/yyf/anaconda3/envs/ma/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 3373, in mean out=out, **kwargs) File "/home/yyf/anaconda3/envs/ma/lib/python3.6/site-packages/numpy/core/_methods.py", line 170, in _mean ret = ret.dtype.type(ret / rcount) AttributeError: 'torch.dtype' object has no attribute 'type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "src/main.py", line 98, in ex.run_commandline(params) File "/data/workspace/CollaQ/third_party/sacred/sacred/experiment.py", line 348, in run_commandline print_filtered_stacktrace() File "/data/workspace/CollaQ/third_party/sacred/sacred/utils.py", line 494, in print_filtered_stacktrace print(format_filtered_stacktrace(filter_traceback), file=sys.stderr) File "/data/workspace/CollaQ/third_party/sacred/sacred/utils.py", line 529, in format_filtered_stacktrace return "".join(filtered_traceback_format(tb_exception)) File "/data/workspace/CollaQ/third_party/sacred/sacred/utils.py", line 571, in filtered_traceback_format if not _is_sacred_frame(current_tb.tb_frame): File "/data/workspace/CollaQ/third_party/sacred/sacred/utils.py", line 490, in _is_sacred_frame return frame.f_globals["name"].split(".")[0] == "sacred" KeyError: 'name'

What's going on?

hejm37 commented 3 years ago

Hi, this bug is caused by the incorrect version of pytorch and numpy. Make sure you install the correct version of this two packages. You can find the correct version from QPLEX/pymarl-master/requirements.txt.