-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Conversation
Merged build finished. Test FAILed. |
Test FAILed. |
Merged build finished. Test FAILed. |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
python/ray/rllib/eval.py
Outdated
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--no-render
python/ray/rllib/eval.py
Outdated
|
||
EXAMPLE_USAGE = """ | ||
example usage: | ||
./train.py /tmp/ray/checkpoint_dir/checkpoint-0 --run DQN --env CartPole-v0 |
There was a problem hiding this comment.
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?
python/ray/rllib/eval.py
Outdated
import gym | ||
import ray | ||
|
||
from agent import get_agent_class |
There was a problem hiding this comment.
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 | |||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
python/ray/rllib/eval.py
Outdated
"given a checkpoint.", epilog=EXAMPLE_USAGE) | ||
|
||
parser.add_argument("checkpoint", type=str, | ||
help="Checkpoint from which to evaluate.") |
There was a problem hiding this comment.
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
python/ray/rllib/eval.py
Outdated
"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.") |
There was a problem hiding this comment.
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?
python/ray/rllib/eval.py
Outdated
env = gym.make(args.env) | ||
state = env.reset() | ||
done = False | ||
while not done: |
There was a problem hiding this comment.
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.
python/ray/rllib/eval.py
Outdated
|
||
cls = get_agent_class(args.run) | ||
agent = cls(env=args.env) | ||
agent._restore(args.checkpoint) |
There was a problem hiding this comment.
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
Merged build finished. Test FAILed. |
Test FAILed. |
Merged build finished. Test FAILed. |
Test FAILed. |
@pschafhalter Can you rebase this on the latest master so we can see if it passes the Jenkins test you added? |
2906b21
to
a7ed5e2
Compare
@pcmoritz it should be rebased now |
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
There was a problem hiding this 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.
@pcmoritz are checkpoints for A3C fixed as well? |
@pschafhalter No, they are not I think. Do you want to create a github issue about it? |
@pcmoritz sure, I'll report it |
There was a problem hiding this 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)?
@ericl yes, I'll update the docs as well. Should I create a new section or document the script under Getting Started? |
Let's integrate it into getting started
…On Fri, Dec 8, 2017, 12:04 AM Peter Schafhalter ***@***.***> wrote:
@ericl <https://github.com/ericl> yes, I'll update the docs as well.
Should I create a new section or document the script under Getting Started?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1295 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAA6SnwPeKRfJAmKriFy3MtPvXOJrPhVks5s-O15gaJpZM4Q3Opy>
.
|
Merged build finished. Test PASSed. |
Test PASSed. |
@ericl I added some documentation. Let me know if there's anything I should change. |
doc/source/rllib.rst
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
Merged build finished. Test PASSed. |
Test PASSed. |
What do these changes do?
Related issue number