ZibinDong commited on
Commit
a3cbbc7
·
verified ·
1 Parent(s): 0e08960

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -18
README.md CHANGED
@@ -15,23 +15,13 @@ tags: []
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,94 @@ 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
 
 
15
 
16
  <!-- Provide a longer summary of what this model is. -->
17
 
18
+ TODO
 
 
 
 
 
 
 
 
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
+
38
+ np.set_printoptions(suppress=True)
39
+
40
+ if __name__ == "__main__":
41
+ tokenizer = AutoModel.from_pretrained("ZibinDong/ActionCodec-Base", trust_remote_code=True)
42
+
43
+ q99 = np.array([0.9375, 0.91071427, 0.9375, 0.20357142, 0.26357144, 0.375, 1.0])
44
+ q01 = np.array([-0.87857145, -0.87589288, -0.9375, -0.15107143, -0.20678571, -0.27964285, 0.0])
45
+
46
+ # an example action from physical-intelligence/libero
47
+ action = np.array(
48
+ [
49
+ [0.3268, 0.2089, -0.3295, 0.0000, -0.0868, -0.0611, 1.0000],
50
+ [0.3696, 0.1955, -0.2866, 0.0000, -0.0793, -0.0643, 1.0000],
51
+ [0.3857, 0.1929, -0.2759, 0.0000, -0.0782, -0.0654, 1.0000],
52
+ [0.3964, 0.2089, -0.2786, 0.0000, -0.0761, -0.0654, 1.0000],
53
+ [0.3321, 0.1741, -0.3268, 0.0000, -0.0793, -0.0686, 1.0000],
54
+ [0.2250, 0.0964, -0.4232, 0.0000, -0.0932, -0.0761, 1.0000],
55
+ [0.0723, 0.0000, -0.5625, 0.0000, -0.1339, -0.0879, 1.0000],
56
+ [0.0536, 0.0000, -0.5652, 0.0000, -0.1521, -0.0921, 1.0000],
57
+ [0.0750, 0.0000, -0.5464, 0.0000, -0.1511, -0.0964, 1.0000],
58
+ [0.0723, 0.0000, -0.5411, 0.0000, -0.1414, -0.0986, 1.0000],
59
+ [0.0402, 0.0000, -0.5196, 0.0000, -0.1350, -0.1007, 1.0000],
60
+ [0.0080, 0.0000, -0.4795, 0.0000, -0.1189, -0.1018, 1.0000],
61
+ [0.0000, 0.0000, -0.4527, 0.0000, -0.0986, -0.1018, 1.0000],
62
+ [0.0000, 0.0000, -0.4313, 0.0000, -0.0846, -0.1018, 1.0000],
63
+ [-0.0455, -0.0268, -0.3509, 0.0000, -0.0568, -0.1018, 1.0000],
64
+ [-0.0964, -0.0482, -0.3321, 0.0000, -0.0439, -0.1039, 1.0000],
65
+ [-0.1768, -0.0562, -0.3402, 0.0000, -0.0300, -0.1050, 1.0000],
66
+ [-0.2438, -0.0429, -0.3187, 0.0000, -0.0193, -0.0996, 1.0000],
67
+ [-0.3054, -0.0054, -0.2893, 0.0000, -0.0139, -0.0932, 1.0000],
68
+ [-0.3509, 0.0000, -0.2598, 0.0000, -0.0054, -0.0879, 1.0000],
69
+ ],
70
+ )[None]
71
+
72
+ # normalization
73
+ normalized_action = np.copy(action)
74
+ normalized_action[..., :-1] = normalized_action[..., :-1] / np.maximum(np.abs(q99), np.abs(q01))[..., :-1]
75
+ normalized_action[..., -1] = normalized_action[..., -1] * 2.0 - 1.0 # scale to [-1, 1]
76
+ normalized_action = normalized_action.clip(-1.0, 1.0)
77
+
78
+ # tokenization
79
+ tokens = tokenizer.encode(normalized_action) # numpy (b, n, d) -> list of ints
80
+ print(tokens)
81
+
82
+ # decoding
83
+ decoded_action, padding_mask = tokenizer.decode(tokens) # list of ints -> numpy (b, n, d)
84
+
85
+ # calculate reconstruction error
86
+ mse_error = np.mean((normalized_action - decoded_action) ** 2)
87
+ l1_error = np.mean(np.abs(normalized_action - decoded_action))
88
+ print(f"Reconstruction MSE error: {mse_error:.6f}")
89
+ print(f"Reconstruction L1 error: {l1_error:.6f}")
90
+
91
+ ```
92
 
93
  ### Downstream Use [optional]
94
 
95
  <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
96
 
97
+ TODO
98
 
99
  ### Out-of-Scope Use
100
 
101
  <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
102
 
103
+ TODO
104
 
105
  ## Bias, Risks, and Limitations
106
 
107
  <!-- This section is meant to convey both technical and sociotechnical limitations. -->
108
 
109
+ TODO
110
 
111
  ### Recommendations
112
 
113
  <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
114
 
115
+ TODO
116
 
117
  ## How to Get Started with the Model
118
 
119
  Use the code below to get started with the model.
120
 
121
+ TODO
122
 
123
  ## Training Details
124