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

Visualize a policy from a checkpoint #343

Closed
hai-h-nguyen opened this issue Apr 11, 2022 · 3 comments
Closed

Visualize a policy from a checkpoint #343

hai-h-nguyen opened this issue Apr 11, 2022 · 3 comments
Assignees

Comments

@hai-h-nguyen
Copy link

hai-h-nguyen commented Apr 11, 2022

Hello,

Is it supported to visualize a trained policy from a checkpoint? If yes, how would I do that? I saw there was a tutorial on how to evaluate a checkpoint, but I want to visually inspect the learned policy too.

@Lucaweihs Lucaweihs self-assigned this Apr 11, 2022
@Lucaweihs
Copy link
Collaborator

Hi @hai-h-nguyen,

This definitely should be possible depending on the type of visualization you're looking for. A few quick questions:

  1. What environment are you training on?
  2. What type of visualizations do you want? E.g.
  • Do you want to run your model on a single task in a loop just to get a sense of what it's doing?
  • Do you want to run your model on a whole bunch of episodes, save the results (e.g. to tensorboard or to videos on disk), and then look through them after the fact?

Some initial pointers:

  • We have a visualization tutorial as well that shows you how to visualize episodes in tensorboard. It's a bit more involved though as you need to have some idea of how things are being stored in AllenAct.
  • If you look at this file you can see how you can use the InferenceAgent class to run your model on a task in python while avoiding all the AllenAct training/evaluation infrastructure. Note that you'd need to pass the path to your model checkpoint in the call to InferenceAgent.from_experiment_config(...) as currently it just runs with a randomly initialized agent. Once you have this running you can visualize observations returned from the task however you like.
  • @mattdeitke recently made a PR Add Callback Support #339 which adds more functionality to AllenAct and lets you set up custom logging scripts. He's used this to, for instance, log from AllenAct to wand.ai.

@hai-h-nguyen
Copy link
Author

hai-h-nguyen commented Apr 11, 2022

Hi, thanks for a quick reply.

  1. I am training in my custom environments.
  2. I am looking for the first option - to get a sense of what it's doing over a number of episodes. I also wish to make a video later but I can just use a screen recording software for that purpose.
  3. Thanks I will look into those pointers first.

@hai-h-nguyen
Copy link
Author

Thanks, I am able to visualize the policy using InferenceAgent.

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

2 participants