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 load model and visualize results #30

Open
darwinharianto opened this issue Sep 20, 2022 · 6 comments
Open

How to load model and visualize results #30

darwinharianto opened this issue Sep 20, 2022 · 6 comments

Comments

@darwinharianto
Copy link

Thank you for sharing!!

Using colored RWARE environment, I want to ask how to load and visualize trained models on colored rware

import gym

env = gym.make("rware-1color-tiny-4ag-v1", sensor_range=3, request_queue_size=6)
n_step = 1000 
model = load_something(model_path) # how do I load model?
for _ in range(n_step):
  obs = env.reset()
  actions = model.forward(obs)
  n_obs, reward, done, info = env.step(actions)
  print(f"{info=}")
  env.render()
  time.sleep(0.5)
  if (done):
    break
env.close()
@Xiyou521
Copy link

I have the same question. Can someone tell me how to visualize the experimental environment? Thank you very much.

1 similar comment
@SaraRezaei
Copy link

I have the same question. Can someone tell me how to visualize the experimental environment? Thank you very much.

@lcdbezerra
Copy link

From README:

Learnt models can be loaded using the checkpoint_path parameter, after which the learning will proceed from the corresponding timestep.

So I guess something like this:
python3 src/main.py --config=mappo --env-config=gymma with env_args.key="rware-1color-tiny-4ag-v1" checkpoint_path="/PATH_TO_MODEL"
You probably need to wrap the env around a render wrapper too, and make batch_run_size=1 so that you don't get multiple windows at a time.

@atapley
Copy link

atapley commented Nov 22, 2022

Yeah, same question from me - I posted a similar question a few days ago before I saw this. It looks like rendering is not currently implemented for non-sc2 environments. From my search it looks like the save_reply method needs to be manually implemented or a render flag will need to be added to the config and within the runner code. Hoping I'm wrong though and there's an out-of-the-box solution that I'm just missing

@abdulghani91
Copy link

I'm trying to run MAPPO or IPPO with sc2 environment but I couldn't figured out how to specify the maps.
I already us pymarl and run the algorithms with this code:

python3 src/main.py --config=qmix --env-config=sc2 with env_args.map_name=2s3z

I want to run epymarl with MAPPO or IPPO algorithms with the same map 2s3z from sc2. could any one help me with that?
I'm using this code:

python3.7 src/main.py --config=mappo --env-config=sc2 with env_args.time_limit=25 env_args.key="SMAC:2s3z"

I get this error:

sacred.utils.ConfigAddedError: Added new config entry that is not used anywhere
Conflicting configuration values:
env_args.key=SMAC:2s3z

@youchenlong
Copy link

python src/main.py --config=qmix --env-config=gymma with env_args.time_limit=25 env_args.key="mpe:SimpleSpeakerListener-v0" checkpoint_path="your path" evaluate=True render=True

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

7 participants