ZibinDong commited on
Commit
948a48a
·
verified ·
1 Parent(s): 1bc40b2

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +59 -21
README.md CHANGED
@@ -2,7 +2,6 @@
2
  library_name: transformers
3
  tags: []
4
  ---
5
-
6
  # Model Card for Model ID
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
@@ -13,25 +12,16 @@ tags: []
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
  ### Model Sources [optional]
29
 
30
  <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
  ## Uses
37
 
@@ -41,37 +31,85 @@ This is the model card of a 🤗 transformers model that has been pushed on the
41
 
42
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  ### Downstream Use [optional]
47
 
48
  <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
 
50
- [More Information Needed]
51
 
52
  ### Out-of-Scope Use
53
 
54
  <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
 
56
- [More Information Needed]
57
 
58
  ## Bias, Risks, and Limitations
59
 
60
  <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
- [More Information Needed]
63
 
64
  ### Recommendations
65
 
66
  <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
  ## How to Get Started with the Model
71
 
72
  Use the code below to get started with the model.
73
 
74
- [More Information Needed]
75
 
76
  ## Training Details
77
 
 
2
  library_name: transformers
3
  tags: []
4
  ---
 
5
  # Model Card for Model ID
6
 
7
  <!-- Provide a quick summary of what the model is/does. -->
 
12
 
13
  ### Model Description
14
 
15
+ ActionCodec model trained on 3 embodiments:
16
+ - franka_libero_20hz_1s
17
+ - widowx_bridge_5hz_3s
18
+ - franka_droid_15hz_1s
 
 
 
 
 
 
 
19
 
20
  ### Model Sources [optional]
21
 
22
  <!-- Provide the basic links for the model. -->
23
 
24
+ TODO
 
 
25
 
26
  ## Uses
27
 
 
31
 
32
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
33
 
34
+ ```python
35
+ import numpy as np
36
+ from transformers import AutoModel
37
+ np.set_printoptions(suppress=True)
38
+ if __name__ == "__main__":
39
+ tokenizer = AutoModel.from_pretrained("ZibinDong/ActionCodec-Base-RVQft", trust_remote_code=True)
40
+ q99 = np.array([0.9375, 0.91071427, 0.9375, 0.20357142, 0.26357144, 0.375, 1.0])
41
+ q01 = np.array([-0.87857145, -0.87589288, -0.9375, -0.15107143, -0.20678571, -0.27964285, 0.0])
42
+ # an example action from physical-intelligence/libero
43
+ action = np.array(
44
+ [
45
+ [0.3268, 0.2089, -0.3295, 0.0000, -0.0868, -0.0611, 1.0000],
46
+ [0.3696, 0.1955, -0.2866, 0.0000, -0.0793, -0.0643, 1.0000],
47
+ [0.3857, 0.1929, -0.2759, 0.0000, -0.0782, -0.0654, 1.0000],
48
+ [0.3964, 0.2089, -0.2786, 0.0000, -0.0761, -0.0654, 1.0000],
49
+ [0.3321, 0.1741, -0.3268, 0.0000, -0.0793, -0.0686, 1.0000],
50
+ [0.2250, 0.0964, -0.4232, 0.0000, -0.0932, -0.0761, 1.0000],
51
+ [0.0723, 0.0000, -0.5625, 0.0000, -0.1339, -0.0879, 1.0000],
52
+ [0.0536, 0.0000, -0.5652, 0.0000, -0.1521, -0.0921, 1.0000],
53
+ [0.0750, 0.0000, -0.5464, 0.0000, -0.1511, -0.0964, 1.0000],
54
+ [0.0723, 0.0000, -0.5411, 0.0000, -0.1414, -0.0986, 1.0000],
55
+ [0.0402, 0.0000, -0.5196, 0.0000, -0.1350, -0.1007, 1.0000],
56
+ [0.0080, 0.0000, -0.4795, 0.0000, -0.1189, -0.1018, 1.0000],
57
+ [0.0000, 0.0000, -0.4527, 0.0000, -0.0986, -0.1018, 1.0000],
58
+ [0.0000, 0.0000, -0.4313, 0.0000, -0.0846, -0.1018, 1.0000],
59
+ [-0.0455, -0.0268, -0.3509, 0.0000, -0.0568, -0.1018, 1.0000],
60
+ [-0.0964, -0.0482, -0.3321, 0.0000, -0.0439, -0.1039, 1.0000],
61
+ [-0.1768, -0.0562, -0.3402, 0.0000, -0.0300, -0.1050, 1.0000],
62
+ [-0.2438, -0.0429, -0.3187, 0.0000, -0.0193, -0.0996, 1.0000],
63
+ [-0.3054, -0.0054, -0.2893, 0.0000, -0.0139, -0.0932, 1.0000],
64
+ [-0.3509, 0.0000, -0.2598, 0.0000, -0.0054, -0.0879, 1.0000],
65
+ ],
66
+ )[None]
67
+ # normalization
68
+ normalized_action = np.copy(action)
69
+ normalized_action[..., :-1] = normalized_action[..., :-1] / np.maximum(np.abs(q99), np.abs(q01))[..., :-1]
70
+ normalized_action[..., -1] = normalized_action[..., -1] * 2.0 - 1.0 # scale to [-1, 1]
71
+ normalized_action = normalized_action.clip(-1.0, 1.0)
72
+ # tokenization
73
+ tokens = tokenizer.encode(normalized_action) # numpy (b, n, d) -> list of ints
74
+ print(tokens)
75
+ # decoding
76
+ decoded_action, padding_mask = tokenizer.decode(tokens) # list of ints -> numpy (b, n, d)
77
+ # calculate reconstruction error
78
+ mse_error = np.mean((normalized_action - decoded_action) ** 2)
79
+ l1_error = np.mean(np.abs(normalized_action - decoded_action))
80
+ print(f"Reconstruction MSE error: {mse_error:.6f}")
81
+ print(f"Reconstruction L1 error: {l1_error:.6f}")
82
+ ```
83
 
84
  ### Downstream Use [optional]
85
 
86
  <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
87
 
88
+ TODO
89
 
90
  ### Out-of-Scope Use
91
 
92
  <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
93
 
94
+ TODO
95
 
96
  ## Bias, Risks, and Limitations
97
 
98
  <!-- This section is meant to convey both technical and sociotechnical limitations. -->
99
 
100
+ TODO
101
 
102
  ### Recommendations
103
 
104
  <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
105
 
106
+ TODO
107
 
108
  ## How to Get Started with the Model
109
 
110
  Use the code below to get started with the model.
111
 
112
+ TODO
113
 
114
  ## Training Details
115