Skip to content

Commit 08489b4

Browse files
expert actions page
1 parent d2338dc commit 08489b4

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ obs, reward, terminate, truncate, info = env.step(a)
4343
introduction/basic_usage
4444
installation/installation
4545
rendering/rendering
46-
46+
usage/basic_usage
4747
```
4848

4949

docs/usage/basic_usage.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
layout: "contents"
3+
title: Generate data with expert policies
4+
firstpage:
5+
---
6+
7+
# Generate data with expert policies
8+
9+
## Expert Policies
10+
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.
11+
12+
## Using Expert Policies
13+
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.
14+
15+
16+
```python
17+
from metaworld import MT1
18+
19+
from metaworld.policies.sawyer_reach_v2_policy import SawyerReachV2Policy as p
20+
21+
mt1 = MT1('reach-v2', seed=42)
22+
env = mt1.train_classes['reach-v2']()
23+
env.set_task(mt1.train_tasks[0])
24+
obs, info = env.reset()
25+
26+
policy = p()
27+
28+
done = False
29+
30+
while not done:
31+
a = policy.get_action(obs)
32+
obs, _, _, _, info = env.step(a)
33+
done = int(info['success']) == 1
34+
35+
36+
```

0 commit comments

Comments
 (0)