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

how to display and continue train? #11

Open
Jiang1206 opened this issue Apr 20, 2021 · 2 comments
Open

how to display and continue train? #11

Jiang1206 opened this issue Apr 20, 2021 · 2 comments

Comments

@Jiang1206
Copy link

I'm very interested in this project and try to use it, but I'm not very clear about the code running. I encountered the following problems :

  1. I try to run python -m maddpg_o/experiments/train_normal --display to display the render, but it not work,only training and not display. what should i do?

  2. When the training process is interrupted, I try to add --restore to train_grassland_epc.sh to continue training, but the designated --load-dir can not continue training, is the designated XX right?

@lzh-awesome
Copy link

@Jiang1206 i have the same problems with you.i want to see the gif while training. i also find the param --display doesn't work, only training but not display.this repo use --save-gif-data to save gif-data,--render-gif to render gif,but error occurs as follow:
(DARL) lzh@lzh:~/epciclr2020-master$ bash train_grassland_att.sh
/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
arglist Namespace(adv_num_units=None, adv_policy='maddpg', adv_share_weights=True, alpha=0.0, batch_size=1024, benchmark=False, benchmark_iters=10000, checkpoint_rate=1000, gamma=0.95, good_num_units=None, good_policy='att-maddpg', good_share_weights=True, load_dir='./test/grassland_att_maddpg_vs_maddpg_3-3', lr=0.01, map_size='normal', max_episode_len=25, n_cpu_per_agent=50, n_envs=100, no_wheel=False, num_adversaries=3, num_episodes=1000, num_food=4, num_good=3, num_units=32, render_gif=True, restore=False, save_dir='./result/grassland_att_maddpg_vs_maddpg_3-3', save_gif_data=False, save_rate=1000, save_summary=True, scenario='grassland', show_attention=False, sight=100.0, timeout=0.03, train_rate=100, use_gpu=False)
collaborate!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
step 0
<mpe_local.multiagent.core.Agent object at 0x7fcd7bdd6f90> 0.4684688118032705 0.16335185712704492
<mpe_local.multiagent.core.Agent object at 0x7fcd7bddf2d0> -0.10195838246557276 -0.39889553780498166
<mpe_local.multiagent.core.Agent object at 0x7fcd7bddffd0> -0.19384971553561936 -0.7719600924113763
<mpe_local.multiagent.core.Agent object at 0x7fcda0ac9f90> -0.3486847856606383 -0.058348183584626456
<mpe_local.multiagent.core.Agent object at 0x7fcd7be38e50> 0.4716939570295191 0.7397263145673387
<mpe_local.multiagent.core.Agent object at 0x7fcd7bde6590> -0.7219922968790204 0.04681808024141132
<mpe_local.multiagent.core.Landmark object at 0x7fcd7bde6a10> -0.441491092426334 -0.5367035254244059
<mpe_local.multiagent.core.Landmark object at 0x7fcd7bde6c90> 0.20347805705033506 0.2878178351567865
<mpe_local.multiagent.core.Landmark object at 0x7fcd7bde6ed0> -0.6017387856782823 0.42144077074574693
<mpe_local.multiagent.core.Landmark object at 0x7fcd7bded150> -0.10416289694013015 -0.833392872054225
Traceback (most recent call last):
File "/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/lzh/software/anaconda3/envs/DARL/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/lzh/epciclr2020-master/maddpg_o/experiments/train_normal.py", line 6, in
train(arglist)
File "/home/lzh/epciclr2020-master/maddpg_o/experiments/train_helper/train_helpers.py", line 798, in train
frames = env.render_from_memory(gif_data, mode='rgb_array')
File "/home/lzh/epciclr2020-master/mpe_local/multiagent/environment.py", line 232, in render_from_memory
ret.append(self.render(mode=mode, world=world)[0])
File "/home/lzh/epciclr2020-master/mpe_local/multiagent/environment.py", line 342, in render
results.append(self.viewers[i].render(return_rgb_array = mode=='rgb_array')) # todo
File "/home/lzh/epciclr2020-master/mpe_local/multiagent/rendering.py", line 104, in render
arr = np.fromstring(image_data.data, dtype=np.uint8, sep='')
AttributeError: 'ImageData' object has no attribute 'data'
please let me know if you solve this problem!!!!thxs

@Aib-star
Copy link

Has this problem been solved?

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

3 participants