delinqu commited on
Commit
1a3c1fd
·
verified ·
1 Parent(s): 69788c1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model:
4
+ - google/paligemma-3b-pt-224
5
+ tags:
6
+ - lerobot
7
+ - torch
8
+ - pi0
9
+ datasets:
10
+ - IPEC-COMMUNITY/bridge_orig_lerobot
11
+ ---
12
+
13
+
14
+
15
+ download the model
16
+
17
+ ```bash
18
+ huggingface-cli download --resume-download --local-dir-use-symlinks False ${model} --local-dir $(basename ${model})
19
+ ```
20
+
21
+ install the [lerobot](https://github.com/huggingface/lerobot) package first
22
+
23
+ ```python
24
+ def auto_model_from_pretrained(path, **kwargs):
25
+ import sys
26
+ sys.path.append(path) # noqa
27
+
28
+ map_location = kwargs.pop("map_location", "cpu")
29
+ from modeling_pi0 import PI0Policy
30
+ return PI0Policy.from_pretrained(path, **kwargs).to(map_location)
31
+
32
+
33
+ policy = auto_model_from_pretrained(saved_model_path, map_location="cuda")
34
+
35
+ state = torch.rand(8)
36
+ image = np.array(Image.open("test/example.png"))
37
+ image = torch.from_numpy(image / 255).permute(2, 0, 1)
38
+
39
+ observation = {
40
+ "observation.state": state.unsqueeze(0).to("cuda"),
41
+ "observation.images.image_0": image.unsqueeze(0).to("cuda"),
42
+ "task": ["put the object in the box"],
43
+ }
44
+
45
+ action_chunk = policy.select_action(observation)[0].cpu().numpy()
46
+ ```