Client端启动推理配置参数

Client 端启动推理配置参数

这些字段交给推理任务,用来选 client、连服务、决定插值。它们本身不是每一拍的观测。会写进 WebSocket 请求的只有:instruction、embodiment、normalization、return_body、use_history、session_id,以及 RTC 运行时算出来的 use_rtc / inference_delay / num_flow_steps 等。

model_name、check_point 只做记录,不进请求,也不决定连哪台服务。权重在 model_address 那个进程里。

推理参数

(1)任务级字段

参数可选值默认说明
model_addressip:port,或 http:// / https:// / ws:// / wss:// URL无,必填模型服务地址。http 会改成 ws,https 会改成 wss。空字符串无法 INIT
instruction任意非空字符串脚本默认 model testing变成请求顶层的 instruction
robot_typedesktop、slave_arms、ex001。大小写不敏感无选 client。desktop 与 slave_arms 都走 Desktop。本机是 EX001 Orin 时,RTC / classic_async 会强制把 robot_type 改成 EX001,实际用 EX001OrinClientRTC
robot_modeend_pose、joints、joints_posend_posepublic_v2 只接受 end_pose。joints / joints_pos 在 INIT 时直接报错
infer_typesync、asyncsync粗分类。algorithm 为 pc_async、rtc、classic_async 时会被改成 async
model_name任意字符串空只进日志

(2)infer_params:时序

不写时使用默认值(下表默认值按 public_v2,命令里带 --embodiment 时自动启用)。也可以写成驼峰 inferParams。整段如果是字符串,client 会先 json.loads。

参数可选值默认说明
action_horizon正整数32client 认为模型一次输出多少个模型步。形式二服务端实际回 32 帧,client 用响应的真实长度
control_dt正数,单位秒0.005控制器一拍的时间。走 C++ dispatcher 时就是 200 Hz
interpolate_multiplier正数sync 7 / RTC 8一个模型步插成多少个控制步。模型步长 = control_dt × interpolate_multiplier。例如 0.005 × 7 = 0.035 秒,接近训练帧间隔 33.7 ms。选手可以按需调大,执行会变慢
ar_streamtrue、falseFALSE只允许同步 Desktop。true 且 algorithm 不是同步,或 infer_type 不是 sync,INIT 失败。EX001 不要开
cb_historyoff、shadow、auto、onoff只对同步 Desktop end_pose 有意义。on 要求服务端 metadata 声明支持,否则 INIT 失败。shadow 只旁路记录,不改请求

(3)async_params:协议和链路

参数可选值默认说明
api_schemainternal、public_v2internalpublic_v2 才是本文的报文。必须同时给 embodiment
embodiment与服务端附录完全一致的字符串,区分大小写无。public_v2 必填Desktop:teletwin_desktop/gripper-g、teletwin_desktop/gripper-h。EX001:quanta_x1_pro、quanta_x1_pro/gripper-g、quanta_x1_pro/gripper-h。训练名 ex_normal/gripper-G 与 quanta_x1_pro/gripper-g 是同一套统计量。表外的名字,服务端回 unknown_embodiment
normalization不写,或 provided。catalog 会改写成 provided不写,请求里就没有这个键client 拒绝 uploaded 和 prenormalized。provided 表示状态是物理量,统计量用该 embodiment 在 checkpoint 里的 min/delta
algorithm见下表不写 = 同步决定同步、PC 异步还是 RTC
rtc_modetraining_time、inference_timepublic_v2 下 algorithm 为 rtc 时默认 training_timetraining_time_rtc 会自动写成 training_time。inference_time_rtc 会写成 inference_time。写了别的字符串,client 构造失败
image_wire_formatbase64、jpeg。旧值 base64_jpeg 仍当 base64,jpeg_bytes / raw 仍当 jpegjpegjpeg = JPEG 字节(MessagePack bin,public_v2 默认);base64 = Base64 字符串。服务端两种都支持。Orin RTC 的 image_pipeline.wire 对应写成 raw 或 base64
execute_horizon整数,且 0 < execute_horizon < action_horizon6RTC:一个 chunk 执行多少个模型步后换下一块。会写进请求
delay_queue_size正整数10用最近多少次推理耗时估计 inference_delay。不进请求
initial_delay_estimate非负整数4还没有实测耗时时的延迟初值,单位是模型步
max_inference_delay正整数4client 侧把 inference_delay 截到这个上限。服务端 training RTC 只接受 1、2、3、4,更大回 rtc_delay_exceeds_training。和这台服务联调时应写成 4
num_flow_steps正整数10原样放进请求,覆盖这一次的 flow 步数。不写 RTC 时也可以单独加
rtc_cap_enabletrue、false。也接受 rtc-cap-enableFALSEtrue 时按延迟上限截断还没执行完的 chunk
max_guidance_weight数1只在 rtc_mode = inference_time 时写进请求
prefix_attention_schedule字符串。client 默认发出 "exp""exp"只在 inference_time 时写进请求
predict_action_offset非负整数1从上一 chunk 取 current_master_action 时的下标偏移。不单独出现在请求里
return_body对象,键是字符串、值是布尔。常用键:car_pose、head_pose、lift省略false 表示响应里不要那一项。桌面本体把某一项写成 true,服务端回 body_not_available
api_key字符串,或省略空非空时握手头是 Authorization: Bearer <api_key>。不进观测,日志里显示成 ***
interpolation_modelinear、polynomiallinearpolynomial 只支持 Desktop 的 training_time + end_pose,并且要再给 action_dt
consumer_rt_enabletrue、falseTRUERTC 消费者线程是否要实时调度
consumer_rt_priority整数 1 到 9950超出范围会被夹到这个区间
hil_min_interpolate_multiplier数RTC:等于 interpolate_multiplier运行中允许把插值倍数调到的下限
hil_max_interpolate_multiplier数,且不小于下限RTC:16上限。通过 /x2robot_client/interpolate_multiplier_delta 调整
camera_resize_width正整数实现默认缩到宽 480仅 EX001 Orin。板上把 NV12 缩到的宽度
camera_jpeg_quality整数 1 到 10085仅相机编码质量。Desktop RTC 也会读这个键
camera_max_skew_ms非负整数,毫秒实现默认仅 EX001 Orin。三路图之间允许的最大时间差
camera_snapshot_timeout_s正数,秒实现默认仅 EX001 Orin。等齐一帧三路图的超时

algorithm 的取值:

写入的值实际链路
不写、sync同步。Desktop → DesktopClient,EX001 → EX001Client。Orin 同步仍是 EX001Client,只换相机来源
training_time_rtcRTC,rtc_mode 固定为 training_time
classic_async与 RTC 同一类 client,但不按 RTC 引导字段调度。EX001 Orin 上仍是 EX001OrinClientRTC

具体示例

三份都是 public_v2。夹爪后缀按实机改成 gripper-g 或 gripper-h。

(1)示例 1:TeleTwin Desktop 同步模式

对应第一节 1.(1)的发送和接收。observation.state 只有左右臂。

{
  "model_address": "wss://maas-api.x2robot.com/v1/vla/wallx",
  "model_name": "desktop_pick",
  "robot_type": "desktop",
  "robot_mode": "end_pose",
  "instruction": "pick up the cup",
  "infer_type": "sync",
  "infer_params": {
    "action_horizon": 32,
    "control_dt": 0.005,
    "interpolate_multiplier": 7,
    "async_params": {
      "api_schema": "public_v2",
      "api_key": "<API_KEY>",
      "embodiment": "teletwin_desktop/gripper-g",
      "normalization": "provided",
      "algorithm": "sync"
    }
  }
}

(2)示例 2:Quanta_X1_Pro(x86)RTC 模式

对应第一节 2.(2)。max_inference_delay 写成 4,与服务端 trained_max_delay 对齐。稳态帧会带 use_rtc 和 prev_action_chunk。

{
  "model_address": "wss://maas-api.x2robot.com/v1/vla/wallx",
  "model_name": "ex001_fold",
  "robot_type": "ex001",
  "robot_mode": "end_pose",
  "instruction": "fold the towel",
  "infer_type": "async",
  "infer_params": {
    "action_horizon": 32,
    "control_dt": 0.005,
    "interpolate_multiplier": 8,
    "async_params": {
      "api_schema": "public_v2",
      "api_key": "<API_KEY>",
      "embodiment": "quanta_x1_pro/gripper-g",
      "normalization": "provided",
      "algorithm": "training_time_rtc",
      "execute_horizon": 6,
      "delay_queue_size": 10,
      "initial_delay_estimate": 4,
      "max_inference_delay": 4,
      "num_flow_steps": 10,
      "rtc_cap_enable": false
    }
  }
}

(3)示例 3:Quanta_X1_Pro(Orin)RTC 模式

报文对应第一节 3.(2)。机器是 Orin 时,同一份 robot_type: "ex001" 会选 EX001OrinClientRTC。这里额外关掉响应里的头、升降、底盘,并写上 Orin 相机参数。请求的 observation.state 里这三项仍然在。

{
  "model_address": "wss://maas-api.x2robot.com/v1/vla/wallx",
  "model_name": "ex001_orin_fold",
  "robot_type": "ex001",
  "robot_mode": "end_pose",
  "instruction": "fold the towel",
  "infer_type": "async",
  "infer_params": {
    "action_horizon": 32,
    "control_dt": 0.005,
    "interpolate_multiplier": 8,
    "async_params": {
      "api_schema": "public_v2",
      "api_key": "<API_KEY>",
      "embodiment": "quanta_x1_pro/gripper-g",
      "normalization": "provided",
      "algorithm": "training_time_rtc",
      "execute_horizon": 6,
      "delay_queue_size": 10,
      "initial_delay_estimate": 4,
      "max_inference_delay": 4,
      "num_flow_steps": 10,
      "camera_resize_width": 480,
      "camera_jpeg_quality": 85,
      "camera_max_skew_ms": 30,
      "camera_snapshot_timeout_s": 0.2,
      "return_body": {
        "car_pose": false,
        "head_pose": false,
        "lift": false
      }
    }
  }
}

本页内容