-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2338dc
commit 08489b4
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
layout: "contents" | ||
title: Generate data with expert policies | ||
firstpage: | ||
--- | ||
|
||
# Generate data with expert policies | ||
|
||
## Expert Policies | ||
For each individual environment in Meta-World (i.e. reach, basketball, sweep) there are expert policies that solve the task. These policies can be used to generate expert data for imitation learning tasks. | ||
|
||
## Using Expert Policies | ||
The below example provides sample code for the reach environment. This code can be extended to the ML10/ML45/MT10/MT50 sets if a list of policies is maintained. | ||
|
||
|
||
```python | ||
from metaworld import MT1 | ||
|
||
from metaworld.policies.sawyer_reach_v2_policy import SawyerReachV2Policy as p | ||
|
||
mt1 = MT1('reach-v2', seed=42) | ||
env = mt1.train_classes['reach-v2']() | ||
env.set_task(mt1.train_tasks[0]) | ||
obs, info = env.reset() | ||
|
||
policy = p() | ||
|
||
done = False | ||
|
||
while not done: | ||
a = policy.get_action(obs) | ||
obs, _, _, _, info = env.step(a) | ||
done = int(info['success']) == 1 | ||
|
||
|
||
``` |