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

[rllib] Added evaluation script to RLLib #1295

Merged
merged 12 commits into from
Dec 11, 2017

Conversation

pschafhalter
Copy link
Contributor

What do these changes do?

  • Added evaluation script to RLLib
  • Added test for evaluation script

Related issue number

@pcmoritz pcmoritz requested a review from richardliaw December 6, 2017 01:36
@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2643/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2651/
Test FAILed.

@@ -139,6 +139,9 @@ docker run --rm --shm-size=10G --memory=10G $DOCKER_SHA \
--stop '{"training_iteration": 2}' \
--config '{"num_workers": 2, "use_lstm": false, "use_pytorch": true, "model": {"grayscale": true, "zero_mean": false, "dim": 80, "channel_major": true}}'

docker run --rm --shm-size=10G --memory=10G $DOCKER_SHA \
sh /ray/test/jenkins_tests/multi_node_tests/test_rllib_eval.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

required_named.add_argument(
"--env", type=str, required=True, help="The gym environment to use.")
parser.add_argument(
"--hide", default=False, action="store_const", const=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--no-render


EXAMPLE_USAGE = """
example usage:
./train.py /tmp/ray/checkpoint_dir/checkpoint-0 --run DQN --env CartPole-v0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say ./eval.py right?

import gym
import ray

from agent import get_agent_class
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from ray.tune.agent import

@@ -0,0 +1,52 @@
#!/usr/bin/env python

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you do the import future stuff from train.py as well here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed in the latest commit

"given a checkpoint.", epilog=EXAMPLE_USAGE)

parser.add_argument("checkpoint", type=str,
help="Checkpoint from which to evaluate.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should make the indentation consistent

"user-defined trainable function or class registered in the "
"tune registry.")
required_named.add_argument(
"--env", type=str, required=True, help="The gym environment to use.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need --config?

env = gym.make(args.env)
state = env.reset()
done = False
while not done:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider doing it in an infinite loop.

@richardliaw richardliaw changed the title Added evaluation script to RLLib [rllib] Added evaluation script to RLLib Dec 7, 2017

cls = get_agent_class(args.run)
agent = cls(env=args.env)
agent._restore(args.checkpoint)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agent.restore is the proper way

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2672/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2673/
Test FAILed.

@pcmoritz
Copy link
Contributor

pcmoritz commented Dec 8, 2017

@pschafhalter Can you rebase this on the latest master so we can see if it passes the Jenkins test you added?

@pschafhalter
Copy link
Contributor Author

@pcmoritz it should be rebased now

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2676/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2677/
Test PASSed.

@pcmoritz pcmoritz self-requested a review December 8, 2017 04:32
Copy link
Contributor

@pcmoritz pcmoritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pschafhalter LGTM, now that #1294 is fixed, can you re-introduce the loop in the shell script? All checkpoints should now start with index 1.

@pschafhalter
Copy link
Contributor Author

pschafhalter commented Dec 8, 2017

@pcmoritz are checkpoints for A3C fixed as well?

@pcmoritz
Copy link
Contributor

pcmoritz commented Dec 8, 2017

@pschafhalter No, they are not I think. Do you want to create a github issue about it?

@pschafhalter
Copy link
Contributor Author

@pcmoritz sure, I'll report it

Copy link
Contributor

@ericl ericl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Do you also want to update the docs (rllib.rst)?

@pschafhalter
Copy link
Contributor Author

@ericl yes, I'll update the docs as well. Should I create a new section or document the script under Getting Started?

@ericl
Copy link
Contributor

ericl commented Dec 8, 2017 via email

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2698/
Test PASSed.

@pschafhalter
Copy link
Contributor Author

@ericl I added some documentation. Let me know if there's anything I should change.

@@ -68,6 +68,35 @@ The most important options are for choosing the environment
with ``--env`` (any OpenAI gym environment including ones registered by the user
can be used) and for choosing the algorithm with ``--run``
(available options are ``PPO``, ``A3C``, ``ES`` and ``DQN``).
In order to save checkpoints from which to restore training
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a subsection ("Evaluating trained agents") and move to below the specifying params section below?

Copy link
Contributor

@ericl ericl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, one suggestion on organization since the added text is quite long.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2708/
Test PASSed.

@richardliaw richardliaw merged commit 20d6b74 into ray-project:master Dec 11, 2017
@pschafhalter pschafhalter deleted the rll-eval branch April 20, 2018 20:50
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

Successfully merging this pull request may close these issues.

5 participants