Instructions to use AlexWortega/tinyvla-microduck-stage25 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LeRobot
How to use AlexWortega/tinyvla-microduck-stage25 with LeRobot:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Microduck
How to use AlexWortega/tinyvla-microduck-stage25 with Microduck:
# Replace SLOT with the slot specified in the model card (walk, stand, sitstand, ground_pick, kick_left, kick_right, roulade). sudo robotctl policy load SLOT AlexWortega/tinyvla-microduck-stage25
- Notebooks
- Google Colab
- Kaggle
File size: 4,718 Bytes
5d7d734 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
import numpy as np
CONTROL_HZ = 50
OBSERVATION_HZ = 10
CONTROL_DECIMATION = CONTROL_HZ // OBSERVATION_HZ
# Two seconds of 50 Hz control predicted from every 10 Hz observation.
CHUNK_SIZE = 100
EPISODE_DURATION_S = 5.0
TERMINAL_STABILIZATION_S = 1.5
RECOVERY_STABLE_S = 0.5
STATE_DIM = 61
ACTION_DIM = 14
EMBODIMENT_ID = 24
POLICY_REVISION = "916c1e1ee11f8460506532e037a4cf1aa110aca6"
MICRODUCK_RL_REVISION = "d424a0c899f6b33cbd3daeb279913134349c0b63"
TINYVLA_REVISION = "565d139f4960174fdd3006ec57c25ac62e129245"
DEFAULT_POSE = np.array(
[
0.0,
-0.0873,
-0.4579,
-0.0049,
0.4530,
0.3491,
0.3491,
0.0,
0.0,
0.0,
0.0873,
0.4579,
0.0049,
-0.4530,
],
dtype=np.float32,
)
@dataclass(frozen=True)
class BehaviorSpec:
name: str
policy_file: str
scene_file: str
duration_s: float
start_keyframe: str
handoff_policy_file: str | None = None
handoff_after_s: float | None = None
phase_period_s: float | None = None
kind: Literal[
"stand",
"walking",
"sitstand",
"phase",
"kick",
"roulade",
"roller",
"recovery",
] = "stand"
BEHAVIORS: tuple[BehaviorSpec, ...] = (
BehaviorSpec(
"stand",
"alpha_stand.onnx",
"scene.xml",
EPISODE_DURATION_S,
"STAND",
kind="stand",
),
BehaviorSpec(
"walking",
"alpha_walking.onnx",
"scene.xml",
EPISODE_DURATION_S,
"STAND",
handoff_policy_file="alpha_stand.onnx",
handoff_after_s=4.0,
kind="walking",
),
BehaviorSpec(
"sitstand",
"alpha_sitstand.onnx",
"scene.xml",
EPISODE_DURATION_S,
"STAND",
kind="sitstand",
),
BehaviorSpec(
"ground_pick",
"alpha_ground_pick.onnx",
"scene.xml",
EPISODE_DURATION_S,
"STAND",
handoff_policy_file="alpha_stand.onnx",
handoff_after_s=2.8,
phase_period_s=4.0,
kind="phase",
),
BehaviorSpec(
"kick_left",
"ball_kick_left.onnx",
"scene_ball.xml",
5.0,
"STAND",
handoff_policy_file="alpha_stand.onnx",
handoff_after_s=3.0,
kind="kick",
),
BehaviorSpec(
"kick_right",
"ball_kick_right.onnx",
"scene_ball.xml",
5.0,
"STAND",
handoff_policy_file="alpha_stand.onnx",
handoff_after_s=3.0,
kind="kick",
),
BehaviorSpec(
"roller",
"roller.onnx",
"scene_rollers.xml",
EPISODE_DURATION_S,
"STAND",
handoff_policy_file="alpha_stand.onnx",
handoff_after_s=4.0,
kind="roller",
),
BehaviorSpec(
"roller_crouch",
"roller_crouch.onnx",
"scene_rollers.xml",
EPISODE_DURATION_S,
"STAND",
handoff_policy_file="roller.onnx",
handoff_after_s=3.5,
phase_period_s=5.0,
kind="phase",
),
BehaviorSpec(
"roulade",
"roulade.onnx",
"scene.xml",
5.0,
"STAND",
handoff_policy_file="alpha_stand.onnx",
handoff_after_s=2.0,
kind="roulade",
),
)
RECOVERY_BEHAVIORS: tuple[BehaviorSpec, ...] = (
BehaviorSpec(
"recovery",
"alpha_stand.onnx",
"scene.xml",
EPISODE_DURATION_S,
"STAND",
kind="recovery",
),
BehaviorSpec(
"recovery_roller",
"alpha_stand.onnx",
"scene_rollers.xml",
EPISODE_DURATION_S,
"STAND",
kind="recovery",
),
)
ALL_BEHAVIORS: tuple[BehaviorSpec, ...] = BEHAVIORS + RECOVERY_BEHAVIORS
def split_for_ordinal(ordinal: int, episodes_per_policy: int) -> str:
"""Put the final 10% of each teacher into validation."""
n_validation = max(1, round(episodes_per_policy * 0.1))
return "validation" if ordinal >= episodes_per_policy - n_validation else "train"
def validate_contract() -> None:
if CONTROL_HZ % OBSERVATION_HZ:
raise ValueError("observation rate must divide the control rate")
if len(DEFAULT_POSE) != ACTION_DIM:
raise ValueError("default pose and action dimensions disagree")
if any(b.duration_s != EPISODE_DURATION_S for b in ALL_BEHAVIORS):
raise ValueError("every episode must be exactly five seconds")
names = [b.name for b in ALL_BEHAVIORS]
if len(names) != len(set(names)):
raise ValueError("behavior names must be unique")
|