sequence-base 0.3.15__tar.gz → 0.3.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sequence_base-0.3.15 → sequence_base-0.3.17}/PKG-INFO +2 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/README.md +2 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/pyproject.toml +4 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/__init__.py +20 -5
- sequence_base-0.3.17/sequence_base/codec/__init__.py +19 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/codec/image.py +11 -62
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/constants/env.py +0 -7
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/constants/headers.py +0 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/constants/version.py +3 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/__init__.py +13 -1
- sequence_base-0.3.17/sequence_base/contract/act.py +17 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/connect.py +2 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/deployments.py +26 -18
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/flags.py +14 -31
- sequence_base-0.3.17/sequence_base/contract/io.py +17 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/policy.py +55 -10
- sequence_base-0.3.17/sequence_base/contract/templates.py +33 -0
- sequence_base-0.3.17/sequence_base/contract/wire.py +53 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/errors/transport.py +0 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/obs/log.py +1 -1
- sequence_base-0.3.17/sequence_base/presets/__init__.py +4 -0
- sequence_base-0.3.17/sequence_base/presets/robot_arm.py +197 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schema_export.py +8 -0
- sequence_base-0.3.17/sequence_base/schemas/ActRequest.json +69 -0
- sequence_base-0.3.17/sequence_base/schemas/ActResponse.json +79 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ActionChunk.json +3 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ActionContract.json +3 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ActionStep.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/AdapterTransform.json +1 -1
- sequence_base-0.3.17/sequence_base/schemas/AddLocal.json +27 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Autoscaler.json +2 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/BenchmarkConditionSpec.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/BenchmarkRegisterRequest.json +47 -4
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/BenchmarkSpec.json +45 -3
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/BenchmarkStatusResponse.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/BootstrapResponse.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Camera.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ClampInfo.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/CodeBundle.json +2 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Concurrency.json +2 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Conditions.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ConnectRequest.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ConnectResponse.json +15 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/DeploymentAccepted.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/DeploymentPolicy.json +27 -6
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/DeploymentRequest.json +74 -11
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/DeploymentStatusResponse.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Embodiment.json +3 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ErrorBody.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ErrorCodes.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Estimate.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/EvalDryRunResponse.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/EvalReport.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/EvalRequest.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/EvalResponse.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ImageFrame.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ImageSpec.json +44 -2
- sequence_base-0.3.17/sequence_base/schemas/ImageStepAddLocal.json +42 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ImageStepApt.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ImageStepEnv.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ImageStepRun.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ImageStepUvPip.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/InferParam.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Lease.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/LossyTransform.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/MetricAgg.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Observation.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/ObservationContract.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/PolicyRegistration.json +73 -10
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/PolicySpec.json +72 -9
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Proprioception.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/RenderSpec.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Resources.json +2 -2
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/RolloutResult.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/SecretCreateRequest.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/SecretInfo.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/SecretRef.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/SeqFlags.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Step.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/SuiteAgg.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/TaskAgg.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Timeouts.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/UploadTarget.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/UsageReport.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/Variant.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/VolumeAttach.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/VolumeFile.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/VolumeInfo.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/VolumeMount.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/VolumeRef.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/VolumeUploadRequest.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/VolumeUploadResponse.json +1 -1
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/schemas/WarmingError.json +1 -1
- sequence_base-0.3.17/sequence_base/telemetry/__init__.py +8 -0
- sequence_base-0.3.17/sequence_base/telemetry/events.py +50 -0
- sequence_base-0.3.15/sequence_base/codec/__init__.py +0 -25
- sequence_base-0.3.15/sequence_base/codec/resize.py +0 -147
- sequence_base-0.3.15/sequence_base/contract/act.py +0 -100
- sequence_base-0.3.15/sequence_base/contract/io.py +0 -110
- sequence_base-0.3.15/sequence_base/telemetry/__init__.py +0 -13
- sequence_base-0.3.15/sequence_base/telemetry/events.py +0 -101
- {sequence_base-0.3.15 → sequence_base-0.3.17}/.gitignore +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/auth.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/constants/__init__.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/accounts.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/benchmarks.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/errors.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/eval.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/contract/volumes.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/errors/__init__.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/obs/__init__.py +0 -0
- {sequence_base-0.3.15 → sequence_base-0.3.17}/sequence_base/obs/rid.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sequence-base
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.17
|
|
4
4
|
Summary: Shared foundation for the Sequences platform — wire contract, correlation, error taxonomy, constants. Used by the robot SDK, gateway, and container harness.
|
|
5
|
-
Requires-Python: >=3.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: pydantic>=2.0
|
|
7
7
|
Provides-Extra: codec
|
|
8
8
|
Requires-Dist: numpy>=1.26; extra == 'codec'
|
|
@@ -34,5 +34,5 @@ values (per-model client_resize, pricing, licensing) stay out — in container /
|
|
|
34
34
|
`pip install -e .` (core = pydantic). The image codec pulls PIL/numpy, so it is an optional extra —
|
|
35
35
|
`pip install -e ".[codec]"` — which the gateway (which never encodes/decodes) skips.
|
|
36
36
|
|
|
37
|
-
Extracted from
|
|
38
|
-
|
|
37
|
+
Extracted from the original backend's schema and observability modules. Renamed from `sequence-contract` once it
|
|
38
|
+
grew past just the contract.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sequence-base"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.17"
|
|
4
4
|
description = "Shared foundation for the Sequences platform — wire contract, correlation, error taxonomy, constants. Used by the robot SDK, gateway, and container harness."
|
|
5
|
-
|
|
5
|
+
# 3.10, not 3.11: `seq` (which imports this) must run on ROS 2 Humble's Python 3.10, and nothing here needs 3.11.
|
|
6
|
+
# {2026-10-03 the full suite on CPython 3.10.20: "147 PASSED"; vermin --eval-annotations: "MINIMUM REQUIRED VERSIONS: 3.9"}
|
|
7
|
+
requires-python = ">=3.10"
|
|
6
8
|
dependencies = ["pydantic>=2.0"]
|
|
7
9
|
|
|
8
10
|
# codec (image encode/decode) is P1 and pulls PIL/numpy — an optional extra so the gateway, which
|
|
@@ -14,6 +14,10 @@ catalogue values stay in container / gateway / spec.py.
|
|
|
14
14
|
# contract — the full shared wire contract (obs/action + registry + deployments + connect + eval +
|
|
15
15
|
# accounts + error bodies). One definition per shape; see sequence_base/contract for the grouping.
|
|
16
16
|
from sequence_base.contract import ( # noqa: F401 (re-export surface)
|
|
17
|
+
ActRequest,
|
|
18
|
+
ActResponse,
|
|
19
|
+
AddLocal,
|
|
20
|
+
ImageStepAddLocal,
|
|
17
21
|
Camera,
|
|
18
22
|
Embodiment,
|
|
19
23
|
ObservationContract,
|
|
@@ -24,6 +28,8 @@ from sequence_base.contract import ( # noqa: F401 (re-export surface)
|
|
|
24
28
|
VolumeUploadRequest,
|
|
25
29
|
VolumeUploadResponse,
|
|
26
30
|
parse_vol,
|
|
31
|
+
TEMPLATE_SCHEME,
|
|
32
|
+
parse_template,
|
|
27
33
|
ActionChunk,
|
|
28
34
|
ActionContract,
|
|
29
35
|
ActionSpace,
|
|
@@ -110,8 +116,6 @@ from sequence_base.errors.transport import (
|
|
|
110
116
|
# auth — Bearer secret helpers (gateway direct-connect / internal; container guard; worker emit)
|
|
111
117
|
from sequence_base import auth
|
|
112
118
|
|
|
113
|
-
# telemetry — cold-start event schema (worker emits, gateway ingests)
|
|
114
|
-
from sequence_base.telemetry.events import WorkerLogEvent
|
|
115
119
|
|
|
116
120
|
# NOTE: codec (image encode/decode) is intentionally NOT re-exported here — it needs PIL + numpy
|
|
117
121
|
# (the [codec] extra), and the gateway installs the light core. Import it explicitly where needed:
|
|
@@ -120,8 +124,10 @@ from sequence_base.telemetry.events import WorkerLogEvent
|
|
|
120
124
|
__all__ = [
|
|
121
125
|
# contract 4 — /act data plane
|
|
122
126
|
"ImageFrame", "Proprioception", "Observation", "ActionSpace", "ActionStep", "ActionChunk",
|
|
127
|
+
"ActRequest", "ActResponse",
|
|
123
128
|
# contract 1 — flags + policy registry
|
|
124
|
-
"SeqFlags", "ImageStepUvPip", "ImageStepApt", "ImageStepEnv", "ImageStepRun", "
|
|
129
|
+
"SeqFlags", "ImageStepUvPip", "ImageStepApt", "ImageStepEnv", "ImageStepRun", "AddLocal", "ImageStepAddLocal",
|
|
130
|
+
"ImageStep", "ImageSpec",
|
|
125
131
|
"VolumeMount", "VolumeRef", "Concurrency", "ActionContract", "Camera", "ObservationContract", "Embodiment",
|
|
126
132
|
"PolicySpec", "PolicyRegistration",
|
|
127
133
|
# contract 2 — deployments
|
|
@@ -139,6 +145,8 @@ __all__ = [
|
|
|
139
145
|
"SecretRef", "SecretCreateRequest", "SecretInfo", "BootstrapResponse", "UsageReport",
|
|
140
146
|
# contract 7 — volumes (uploaded checkpoints and datasets)
|
|
141
147
|
"VolumeFile", "VolumeUploadRequest", "UploadTarget", "VolumeUploadResponse", "VolumeInfo", "parse_vol",
|
|
148
|
+
# official template weights
|
|
149
|
+
"TEMPLATE_SCHEME", "parse_template",
|
|
142
150
|
# error bodies + version
|
|
143
151
|
"ErrorCode", "ErrorBody", "WarmingError", "ERRORS", "ErrorSpec", "code_for_status", "CONTRACT_VERSION",
|
|
144
152
|
# obs
|
|
@@ -146,7 +154,14 @@ __all__ = [
|
|
|
146
154
|
# errors (exception taxonomy)
|
|
147
155
|
"TransportUnavailable", "TransportWarming", "TransportRejected", "TransportOverloaded",
|
|
148
156
|
# auth + telemetry
|
|
149
|
-
"auth",
|
|
157
|
+
"auth",
|
|
150
158
|
]
|
|
151
159
|
|
|
152
|
-
|
|
160
|
+
try:
|
|
161
|
+
# The installed distribution's own number, so this can never drift from pyproject.toml again (it said 0.3.6
|
|
162
|
+
# while the package was 0.3.12). A source tree that was never installed reports "dev".
|
|
163
|
+
from importlib.metadata import PackageNotFoundError, version as _version
|
|
164
|
+
|
|
165
|
+
__version__ = _version("sequence-base")
|
|
166
|
+
except PackageNotFoundError: # pragma: no cover - running from an uninstalled checkout
|
|
167
|
+
__version__ = "dev"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Image codec — the frame <-> wire transform, shared so the SDK (encode) and the worker (decode) cannot drift
|
|
3
|
+
on the wire format.
|
|
4
|
+
|
|
5
|
+
Needs Pillow + numpy: `pip install 'sequence-base[codec]'`. The gateway, which neither encodes nor
|
|
6
|
+
decodes, installs the light core and never imports this.
|
|
7
|
+
|
|
8
|
+
from sequence_base.codec import encode, decode
|
|
9
|
+
"""
|
|
10
|
+
from sequence_base.codec.image import (
|
|
11
|
+
DEFAULT_JPEG_QUALITY,
|
|
12
|
+
MAX_UPLOAD_EDGE,
|
|
13
|
+
decode,
|
|
14
|
+
decode_depth,
|
|
15
|
+
encode,
|
|
16
|
+
encode_depth,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
__all__ = ["encode", "decode", "encode_depth", "decode_depth", "DEFAULT_JPEG_QUALITY", "MAX_UPLOAD_EDGE"]
|
|
@@ -15,7 +15,6 @@ import base64
|
|
|
15
15
|
import io
|
|
16
16
|
from typing import Any
|
|
17
17
|
|
|
18
|
-
from .resize import MAX_UPLOAD_EDGE, ResizeSpec, filters, refuse_wrong_aspect, resize_with_pad
|
|
19
18
|
|
|
20
19
|
# Quality 95, and the number is measured rather than chosen for looking safe. On a real DROID frame
|
|
21
20
|
# with the sampling noise pinned, the encoding moves the resulting action by: q95 0.51% of action
|
|
@@ -25,20 +24,22 @@ from .resize import MAX_UPLOAD_EDGE, ResizeSpec, filters, refuse_wrong_aspect, r
|
|
|
25
24
|
# {sequences-models models/pi05_droid/handler.py "Q95 MAX|DELTA| 0.0048 0.51% ... Q85 1.86%"}
|
|
26
25
|
DEFAULT_JPEG_QUALITY = 95
|
|
27
26
|
|
|
27
|
+
# The longest edge `encode` uploads. Every policy resizes a frame to its own input size anyway, so pixels above
|
|
28
|
+
# that only cost transport — and past a point they do not cost, they fail: a body over ~2 MB was dropped by a
|
|
29
|
+
# worker queue with no error and no job id, surfacing as a hang. 640 is above every input size in use (pi0.5's
|
|
30
|
+
# 224), so it discards nothing a policy reads. [MEASURED 2026-09-12: capping the long edge at 640 took a
|
|
31
|
+
# three-view observation from 1.98 MB to 0.12 MB]
|
|
32
|
+
MAX_UPLOAD_EDGE = 640
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
|
|
35
|
+
def encode(frame: Any, *, quality: int = DEFAULT_JPEG_QUALITY) -> str:
|
|
30
36
|
"""
|
|
31
37
|
One camera frame to the base64 image that `ImageFrame.data` carries.
|
|
32
38
|
|
|
33
39
|
`frame` may be a numpy array, a PIL image, raw `bytes` already encoded, or a `str` already base64
|
|
34
40
|
— the last two pass through untouched, so a caller with their own pipeline is not forced through
|
|
35
|
-
this one.
|
|
36
|
-
|
|
37
|
-
`spec` (a `ResizeSpec`) carries the model's geometry. When it declares a training aspect ratio, a
|
|
38
|
-
frame outside it is REFUSED — see `refuse_wrong_aspect`, not quietly reshaped. With no spec (or no
|
|
39
|
-
`client_resize`) the frame falls to `MAX_UPLOAD_EDGE`. Codec is JPEG at `quality`, unconditionally
|
|
40
|
-
— every served handler asks for JPEG in as many words, so there is no size probe and no second
|
|
41
|
-
encode. {handlers pi05_droid/cosmos3/groot all "SEND BASE64 JPEG"}
|
|
41
|
+
this one. A frame whose long edge is over `MAX_UPLOAD_EDGE` is scaled down to it first. Codec is
|
|
42
|
+
JPEG at `quality`, unconditionally.
|
|
42
43
|
"""
|
|
43
44
|
if isinstance(frame, str):
|
|
44
45
|
return frame
|
|
@@ -56,59 +57,7 @@ def encode(frame: Any, spec: ResizeSpec | None = None, *, quality: int = DEFAULT
|
|
|
56
57
|
img = frame if hasattr(frame, "save") else Image.fromarray(frame)
|
|
57
58
|
if img.mode != "RGB":
|
|
58
59
|
img = img.convert("RGB")
|
|
59
|
-
|
|
60
|
-
# Downscale before encoding. Every model resizes the frame to its own input size anyway, so pixels
|
|
61
|
-
# above that only cost transport — and past a point they do not cost, they fail (a body over ~2 MB
|
|
62
|
-
# is dropped by the worker queue with no error and no job id, surfacing as a hang). The target and
|
|
63
|
-
# the filter both come from the spec; neither is derived here. `client_resize=None` means the
|
|
64
|
-
# model declined pre-resizing and is not a gap: it falls to the cap below, as an unknown model
|
|
65
|
-
# does. HOW the frame reaches that size comes from `input_resize` ("pad" = the server's own
|
|
66
|
-
# resize_with_pad, "stretch" = unconditional interpolate).
|
|
67
|
-
want = None
|
|
68
|
-
cr = spec.client_resize if spec else None
|
|
69
|
-
if cr:
|
|
70
|
-
# `shortest_edge` scales the short side to n and lets the ratio follow — the only way to
|
|
71
|
-
# express a server step defined as "SmallestMaxSize(256)" (1280x720 and 1920x1080 both to
|
|
72
|
-
# 455x256), which no fixed [w, h] covers. round(), matching albumentations. `size` is a fixed
|
|
73
|
-
# target.
|
|
74
|
-
if "shortest_edge" in cr:
|
|
75
|
-
# Shrink only. SmallestMaxSize also UPSCALES a frame whose short edge is under the target,
|
|
76
|
-
# and reproducing that here is strictly worse: the payload grows and the upscale happens
|
|
77
|
-
# in PIL when the server was going to do it in cv2 anyway. Leaving a small frame alone
|
|
78
|
-
# hands the whole operation to the server, where it is exact.
|
|
79
|
-
n = int(cr["shortest_edge"])
|
|
80
|
-
if min(img.size) > n:
|
|
81
|
-
scale = n / min(img.size)
|
|
82
|
-
want = (max(1, round(img.width * scale)), max(1, round(img.height * scale)))
|
|
83
|
-
else:
|
|
84
|
-
want = img.size
|
|
85
|
-
else:
|
|
86
|
-
want = (int(cr["size"][0]), int(cr["size"][1]))
|
|
87
|
-
if img.size != want:
|
|
88
|
-
# The filter is named by the server, not chosen here: this resize stands in for one the
|
|
89
|
-
# model's own transform would otherwise run, so it has to be the SAME operation. An
|
|
90
|
-
# unrecognised name raises rather than falling back — a silent default is how the LANCZOS
|
|
91
|
-
# bug shipped. {MEASURED: BILINEAR to pi05's content block is 0.000/255, LANCZOS 0.779/15}
|
|
92
|
-
try:
|
|
93
|
-
resample = filters()[cr["filter"]]
|
|
94
|
-
except KeyError:
|
|
95
|
-
raise ValueError(
|
|
96
|
-
f"{spec.label} asks for resize filter {cr['filter']!r}, which this version of "
|
|
97
|
-
f"sequence-base does not implement (has: {sorted(filters())}). Upgrade, or pass "
|
|
98
|
-
f"an already-encoded frame to bypass this step."
|
|
99
|
-
) from None
|
|
100
|
-
# Refused before either branch, not inside "pad": a stretch model distorts a wrong ratio
|
|
101
|
-
# instead of letterboxing it, which is worse rather than exempt.
|
|
102
|
-
refuse_wrong_aspect(img, spec.aspect_ratio, max(want), spec.label)
|
|
103
|
-
if "shortest_edge" in cr:
|
|
104
|
-
# Already proportional, so nothing to letterbox — and letterboxing would actively
|
|
105
|
-
# damage it (a spurious black row the server carries into its crop as if it were scene).
|
|
106
|
-
img = img.resize(want, resample)
|
|
107
|
-
elif (spec.input_resize or "pad") == "pad":
|
|
108
|
-
img = resize_with_pad(img, want[0], want[1], resample)
|
|
109
|
-
else:
|
|
110
|
-
img = img.resize(want, resample)
|
|
111
|
-
elif max(img.size) > MAX_UPLOAD_EDGE:
|
|
60
|
+
if max(img.size) > MAX_UPLOAD_EDGE:
|
|
112
61
|
scale = MAX_UPLOAD_EDGE / max(img.size)
|
|
113
62
|
# round() not int(): int() truncates a 640.9 on one axis and 359.9 on the other, drifting the
|
|
114
63
|
# aspect ratio by up to half a percent for no reason.
|
|
@@ -5,10 +5,3 @@ INTERNAL_SECRET = "SEQ_INTERNAL_SECRET" # auth for container → gateway teleme
|
|
|
5
5
|
GATEWAY_URL = "SEQ_GATEWAY_URL" # where the container sends telemetry
|
|
6
6
|
VOLUME_ROOT = "SEQ_VOLUME_ROOT" # where fetched weights land
|
|
7
7
|
MANIFEST = "SEQ_MANIFEST" # the policy manifest a container serves
|
|
8
|
-
|
|
9
|
-
# Weight store (Cloudflare R2).
|
|
10
|
-
DIST_ENDPOINT = "SEQ_DIST_ENDPOINT"
|
|
11
|
-
DIST_BUCKET = "SEQ_DIST_BUCKET"
|
|
12
|
-
DIST_KEY = "SEQ_DIST_KEY"
|
|
13
|
-
DIST_SECRET = "SEQ_DIST_SECRET"
|
|
14
|
-
DIST_REGION = "SEQ_DIST_REGION"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"""HTTP header names — one source, so sdk / gateway / container never spell them differently."""
|
|
2
2
|
|
|
3
3
|
REQUEST_ID = "X-Seq-Request-Id" # correlation id; == sequence_base.obs.rid.HEADER
|
|
4
|
-
MODEL = "X-Seq-Model" # gateway → worker model routing
|
|
5
4
|
AUTH_SCHEME = "Bearer" # scheme for SEQ_DIRECT_SECRET on the direct-connect path
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
# across deployments / repos can tell which version of a shape it is validating against. MUST change
|
|
5
5
|
# whenever any shared wire shape changes (a field added / removed / retyped) — that is what makes
|
|
6
6
|
# contract evolution mechanically detectable instead of eyeballed. Bump on any shape change.
|
|
7
|
-
CONTRACT_VERSION = "0.4.
|
|
7
|
+
CONTRACT_VERSION = "0.4.14" # 0.4.13 -> 0.4.14: the /act wire is opaque (ActRequest.inputs / ActResponse.outputs); action / observation contracts optional + DeploymentPolicy/PolicySpec/ConnectResponse .io; the robot-arm types live in sequence_base.presets.robot_arm (contract.act / contract.io re-export them); ImageStepAddLocal (seq.Image.add_local_*); ActionSpace.JOINT_VELOCITY (pi0.5 DROID's joint velocities + gripper position)
|
|
8
|
+
# previous: 0.4.13 # 0.4.12 -> 0.4.13: template://<name>[@v<n>] — official template weights (parse_template); gs:// / s3:// / https:// still accepted until their removal
|
|
9
|
+
# previous: 0.4.12 # 0.4.11 -> 0.4.12: one error definition — ErrorBody is every non-2xx body (detail, code, retryable, retry_after_s, request_id, hint, details), ErrorCode covers every case, ERRORS / ErrorCodes.json give each code its status, retryability, SDK class and CLI exit code
|
|
8
10
|
# previous: 0.4.11 # 0.4.10 -> 0.4.11: weights in named parts (weights_name, extra_weights)
|
|
9
11
|
# previous: 0.4.8 # 0.4.7 -> 0.4.8: ImageSpec.python, ImageStepRun.secrets, Resources.region, DeploymentRequest/BenchmarkRegisterRequest.image_context
|
|
10
12
|
# previous: 0.4.7 # 0.4.6 -> 0.4.7: ActionContract.bounds / max_delta / on_violation (action limits)
|
|
@@ -12,6 +12,9 @@ from sequence_base.contract.act import (
|
|
|
12
12
|
Proprioception,
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
+
# contract 4, version 2 — the opaque /act envelope (inputs in, outputs out)
|
|
16
|
+
from sequence_base.contract.wire import ActRequest, ActResponse
|
|
17
|
+
|
|
15
18
|
# contract 1 — lifecycle flags + policy registry
|
|
16
19
|
from sequence_base.contract.flags import SeqFlags
|
|
17
20
|
from sequence_base.contract.policy import (
|
|
@@ -26,6 +29,8 @@ from sequence_base.contract.policy import (
|
|
|
26
29
|
ImageStepEnv,
|
|
27
30
|
ImageStepRun,
|
|
28
31
|
ImageStepUvPip,
|
|
32
|
+
AddLocal,
|
|
33
|
+
ImageStepAddLocal,
|
|
29
34
|
PolicyRegistration,
|
|
30
35
|
PolicySpec,
|
|
31
36
|
VolumeMount,
|
|
@@ -88,6 +93,9 @@ from sequence_base.contract.accounts import (
|
|
|
88
93
|
UsageReport,
|
|
89
94
|
)
|
|
90
95
|
|
|
96
|
+
# official template weights — template://<name>[@v<n>]
|
|
97
|
+
from sequence_base.contract.templates import TEMPLATE_SCHEME, parse_template
|
|
98
|
+
|
|
91
99
|
# contract 7 — volumes (uploaded checkpoints and datasets)
|
|
92
100
|
from sequence_base.contract.volumes import (
|
|
93
101
|
MAX_FILES,
|
|
@@ -107,9 +115,11 @@ from sequence_base.contract.errors import ERRORS, ErrorBody, ErrorCode, ErrorSpe
|
|
|
107
115
|
__all__ = [
|
|
108
116
|
# contract 4
|
|
109
117
|
"ImageFrame", "Proprioception", "Observation", "ActionSpace", "ActionStep", "ActionChunk",
|
|
118
|
+
"ActRequest", "ActResponse",
|
|
110
119
|
# contract 1
|
|
111
120
|
"SeqFlags",
|
|
112
|
-
"ImageStepUvPip", "ImageStepApt", "ImageStepEnv", "ImageStepRun", "
|
|
121
|
+
"ImageStepUvPip", "ImageStepApt", "ImageStepEnv", "ImageStepRun", "AddLocal", "ImageStepAddLocal", "ImageStep",
|
|
122
|
+
"ImageSpec",
|
|
113
123
|
"VolumeMount", "VolumeRef", "Concurrency", "ActionContract", "Camera", "ObservationContract", "Embodiment",
|
|
114
124
|
"PolicySpec", "PolicyRegistration",
|
|
115
125
|
# contract 2
|
|
@@ -128,6 +138,8 @@ __all__ = [
|
|
|
128
138
|
# contract 7
|
|
129
139
|
"MAX_FILES", "MAX_UPLOAD_BYTES", "VolumeFile", "VolumeUploadRequest", "UploadTarget", "VolumeUploadResponse",
|
|
130
140
|
"VolumeInfo", "check_volume_name", "parse_vol",
|
|
141
|
+
# official template weights
|
|
142
|
+
"TEMPLATE_SCHEME", "parse_template",
|
|
131
143
|
# errors
|
|
132
144
|
"ErrorCode", "ErrorBody", "WarmingError", "ERRORS", "ErrorSpec", "code_for_status",
|
|
133
145
|
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The robot-arm /act data types, re-exported from their home in `sequence_base.presets.robot_arm`.
|
|
3
|
+
|
|
4
|
+
They are no longer the platform's wire: since contract 0.4.14 the worker passes a policy's `inputs` through untouched
|
|
5
|
+
(`sequence_base.contract.wire`). This module keeps `from sequence_base.contract.act import Observation` resolving to the
|
|
6
|
+
same classes for the gateway, harness and SDK code that still uses the preset.
|
|
7
|
+
"""
|
|
8
|
+
from sequence_base.presets.robot_arm import ( # noqa: F401 — re-exports
|
|
9
|
+
ActionChunk,
|
|
10
|
+
ActionSpace,
|
|
11
|
+
ActionStep,
|
|
12
|
+
ImageFrame,
|
|
13
|
+
Observation,
|
|
14
|
+
Proprioception,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = ["ImageFrame", "Proprioception", "Observation", "ActionSpace", "ActionStep", "ActionChunk"]
|
|
@@ -57,3 +57,5 @@ class ConnectResponse(BaseModel):
|
|
|
57
57
|
action: ActionContract | None = None
|
|
58
58
|
observation: ObservationContract | None = None
|
|
59
59
|
embodiment: str | None = None
|
|
60
|
+
# The deployment's own description of its inputs and outputs (DeploymentPolicy.io), when the author wrote one.
|
|
61
|
+
io: str | None = None
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
2
|
契约 2 — `POST /v1/deployments` (SDK `seq deploy` → gateway) and its responses.
|
|
3
3
|
|
|
4
|
-
The request is the normalized wire form of a PolicySpec: one big body (
|
|
5
|
-
|
|
4
|
+
The request is the normalized wire form of a PolicySpec: one big body (new config adds a field, never a
|
|
5
|
+
new endpoint) whose sub-shapes reuse contract 1's types
|
|
6
6
|
(ImageSpec, VolumeMount, Concurrency, ActionContract). Field names align with the PolicySpec side —
|
|
7
7
|
`gpu` is normalized to list[str] here, the memory field is `memory_gb` (goal 7).
|
|
8
8
|
|
|
@@ -21,6 +21,7 @@ from typing import Literal
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
|
22
22
|
|
|
23
23
|
from sequence_base.contract.accounts import SecretRef
|
|
24
|
+
from sequence_base.contract.templates import TEMPLATE_SCHEME, parse_template
|
|
24
25
|
from sequence_base.contract.volumes import VOL_SCHEME, parse_vol
|
|
25
26
|
from sequence_base.contract.io import Embodiment, ObservationContract
|
|
26
27
|
from sequence_base.contract.policy import (
|
|
@@ -46,7 +47,7 @@ __all__ = [
|
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
class Resources(BaseModel):
|
|
49
|
-
"""
|
|
50
|
+
"""The hardware a worker runs on. `gpu` is list[str] (the PolicySpec `str | list[str]` normalized)."""
|
|
50
51
|
|
|
51
52
|
model_config = ConfigDict(extra="forbid")
|
|
52
53
|
|
|
@@ -59,7 +60,7 @@ class Resources(BaseModel):
|
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
class Autoscaler(BaseModel):
|
|
62
|
-
"""
|
|
63
|
+
"""How the deployment scales. Defaults mirror PolicySpec so an omitted block scales to zero."""
|
|
63
64
|
|
|
64
65
|
model_config = ConfigDict(extra="forbid")
|
|
65
66
|
|
|
@@ -103,8 +104,9 @@ class InferParam(BaseModel):
|
|
|
103
104
|
|
|
104
105
|
|
|
105
106
|
class DeploymentPolicy(BaseModel):
|
|
106
|
-
"""The policy block of the deployments body. `handler_ref`
|
|
107
|
-
|
|
107
|
+
"""The policy block of the deployments body. Only `handler_ref` is required. The robot-arm preset's contracts
|
|
108
|
+
(`action`, `observation`, `embodiments`) are optional since contract 0.4.14: a deployment that declares none is held
|
|
109
|
+
to nothing and its inputs / outputs pass through the worker untouched.
|
|
108
110
|
|
|
109
111
|
`secrets` carries the policy's declared secret BUNDLES BY NAME ONLY (list[SecretRef]) — the gateway
|
|
110
112
|
validates each name exists and belongs to the deployer at submit time (accounts ⑦ / S3 goal 14), and the
|
|
@@ -115,7 +117,7 @@ class DeploymentPolicy(BaseModel):
|
|
|
115
117
|
model_config = ConfigDict(extra="forbid")
|
|
116
118
|
|
|
117
119
|
handler_ref: str
|
|
118
|
-
action: ActionContract
|
|
120
|
+
action: ActionContract | None = None
|
|
119
121
|
streaming: bool = False
|
|
120
122
|
frames_per_chunk: int | None = None
|
|
121
123
|
secrets: list[SecretRef] = Field(default_factory=list)
|
|
@@ -123,11 +125,14 @@ class DeploymentPolicy(BaseModel):
|
|
|
123
125
|
# contracts for a multi-embodiment policy — the worker picks one by the session's embodiment.
|
|
124
126
|
observation: ObservationContract | None = None
|
|
125
127
|
embodiments: dict[str, Embodiment] | None = None
|
|
126
|
-
# Did the author declare `action=` (or embodiments)?
|
|
127
|
-
#
|
|
128
|
-
#
|
|
129
|
-
#
|
|
128
|
+
# Did the author declare `action=` (or embodiments)? SDKs before contract 0.4.14 always sent an `action` (a
|
|
129
|
+
# placeholder when none was declared); only a declared contract is enforced on the worker and handed to the robot.
|
|
130
|
+
# None (an older SDK) is treated as undeclared, so an older policy is never refused for the placeholder it never
|
|
131
|
+
# chose. A current SDK sends `action` only when declared. {io-contract.md "旧 SDK 写的 POLICY 照样能 BUILD"}
|
|
130
132
|
action_declared: bool | None = None
|
|
133
|
+
# The author's own description of what infer() takes and returns; stored, handed to the robot at connect, never
|
|
134
|
+
# interpreted by the platform.
|
|
135
|
+
io: str | None = Field(default=None, max_length=4000)
|
|
131
136
|
# The inference parameters @seq.infer takes beyond the observation (name -> type, default). None: an older
|
|
132
137
|
# SDK that did not look; {}: the policy declares none.
|
|
133
138
|
params: dict[str, InferParam] | None = Field(default=None, max_length=32)
|
|
@@ -148,7 +153,7 @@ request limit (base64 adds a third)."""
|
|
|
148
153
|
|
|
149
154
|
class CodeBundle(BaseModel):
|
|
150
155
|
"""The policy's own source, shipped with the deploy so the worker can import `policy.handler_ref`
|
|
151
|
-
|
|
156
|
+
— the entrypoint module, mounted for it. A gzip'd tar of the handler's top-level module
|
|
152
157
|
or package, base64 on the wire, with the sha256 of the decoded bytes so a truncated or altered upload
|
|
153
158
|
is refused at the edge instead of failing as an ImportError on a GPU."""
|
|
154
159
|
|
|
@@ -202,7 +207,7 @@ class DeploymentRequest(BaseModel):
|
|
|
202
207
|
autoscaler: Autoscaler = Field(default_factory=Autoscaler)
|
|
203
208
|
# An omitted @seq.concurrent must NOT send null: the gateway would then have no concurrency to scale by.
|
|
204
209
|
# Materialize the spec default — contracts.md §2's example {"max_inputs": 1, "target_inputs": 1}, i.e.
|
|
205
|
-
# one input per container
|
|
210
|
+
# one input per container — same discipline as `autoscaler`
|
|
206
211
|
# (goal 13).
|
|
207
212
|
concurrency: Concurrency = Field(default_factory=lambda: Concurrency(max_inputs=1, target_inputs=1))
|
|
208
213
|
timeouts: Timeouts | None = None
|
|
@@ -225,21 +230,24 @@ class DeploymentRequest(BaseModel):
|
|
|
225
230
|
|
|
226
231
|
@model_validator(mode="after")
|
|
227
232
|
def _weights_have_an_origin(self) -> "DeploymentRequest":
|
|
228
|
-
"""The checkpoint the build provisions:
|
|
229
|
-
|
|
230
|
-
empty. PolicySpec already enforces this for SDK-authored deploys; this holds it for any POSTed body."""
|
|
233
|
+
"""The checkpoint the build provisions: an official template://, an hf:// repo or an uploaded vol:// volume —
|
|
234
|
+
and, until they are removed, a gs:// or s3:// prefix or an https:// file — never empty. PolicySpec already enforces this for SDK-authored deploys; this holds it for any POSTed body."""
|
|
231
235
|
from sequence_base.contract.policy import check_weights_parts
|
|
232
236
|
|
|
233
237
|
check_weights_parts(self.weights_name, dict(self.extra_weights or {}))
|
|
234
238
|
for what, ref in [("weights.uri", self.weights)] + [(f"extra_weights[{n!r}].uri", r)
|
|
235
239
|
for n, r in (self.extra_weights or {}).items()]:
|
|
236
240
|
uri = ref.uri.strip()
|
|
241
|
+
if uri.startswith(TEMPLATE_SCHEME):
|
|
242
|
+
parse_template(uri)
|
|
243
|
+
continue
|
|
237
244
|
if uri.startswith(VOL_SCHEME):
|
|
238
245
|
parse_vol(uri)
|
|
239
246
|
continue
|
|
240
247
|
if not any(uri.startswith(s) and len(uri) > len(s) for s in _WEIGHTS_SCHEMES):
|
|
241
|
-
raise ValueError(f"{what} must be a
|
|
242
|
-
"
|
|
248
|
+
raise ValueError(f"{what} must be a template://<name> official template, an hf://org/model repo or "
|
|
249
|
+
"a vol://<name> volume (gs://, s3:// and https:// are still accepted until they "
|
|
250
|
+
"are removed)")
|
|
243
251
|
return self
|
|
244
252
|
|
|
245
253
|
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
reads back. One IntFlag, so a registration can carry several lifecycle entrypoints in one integer and
|
|
4
4
|
the harness recovers each by testing a bit.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
a thin adaptation of Modal's loader; the rest are platform-only lifecycle hooks Modal has no analogue
|
|
9
|
-
for (a warm-up hook, a plan step, and the benchmark SETUP / RESET / CHECK / SCORE quartet).
|
|
6
|
+
One bit per lifecycle hook: load, infer, an episode boundary and shutdown for a policy; a warm-up hook and a
|
|
7
|
+
plan step; and the benchmark SETUP / RESET / CHECK / SCORE quartet.
|
|
10
8
|
|
|
11
9
|
eval-raw revision: the platform provides the reset→step→check loop as a tool; the user defines the goal
|
|
12
10
|
through four hooks — SETUP (load sim + assets), RESET (build one episode's env), CHECK (per-step: read raw
|
|
@@ -14,10 +12,10 @@ env state → done + user-named metrics), SCORE (cross-episode aggregate). RESET
|
|
|
14
12
|
the new hook bits. The old single-hook `ROLLOUT` is DEPRECATED: bit 8192 stays reserved (never reused for
|
|
15
13
|
another member) but appears in NO bindings — the setup/reset/check/score model replaces it.
|
|
16
14
|
|
|
17
|
-
The exact bit values are the contract
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
The exact bit values are the contract: a registration serialized by one version must decode the same in
|
|
16
|
+
another. A member taking the wrong value, WARMUP collapsing back into LOAD, RESET/CHECK overlapping an
|
|
17
|
+
existing bit, or ROLLOUT being re-bound is caught bit-by-bit (see tests), not waved away with "an IntFlag
|
|
18
|
+
is naturally bit-composable".
|
|
21
19
|
"""
|
|
22
20
|
from __future__ import annotations
|
|
23
21
|
|
|
@@ -25,18 +23,18 @@ from enum import IntFlag
|
|
|
25
23
|
|
|
26
24
|
|
|
27
25
|
class SeqFlags(IntFlag):
|
|
28
|
-
# ──
|
|
29
|
-
LOAD = 2 #
|
|
30
|
-
SHUTDOWN = 8 #
|
|
31
|
-
INFER = 16 #
|
|
32
|
-
ON_EPISODE = 1024 #
|
|
26
|
+
# ── a policy's lifecycle ────────────────────────────────────────────────────────────────────────
|
|
27
|
+
LOAD = 2 # load weights into VRAM (one-shot; no snapshot bisection)
|
|
28
|
+
SHUTDOWN = 8 # teardown / release the container
|
|
29
|
+
INFER = 16 # the obs→ActionChunk call
|
|
30
|
+
ON_EPISODE = 1024 # sticky / session boundary for stateful policies
|
|
33
31
|
|
|
34
|
-
# ──
|
|
32
|
+
# ── each an independent bit, disjoint from the four above ──────────────────────────────────────
|
|
35
33
|
# WARMUP is its OWN bit, NOT an alias of LOAD (S1.yaml goal 5 — "WARMUP=1(独立 bit,明确不并入
|
|
36
34
|
# LOAD)"). A policy may bind @seq.load and @seq.warmup to two different methods → two independent
|
|
37
35
|
# bindings, so the bit must be distinct from LOAD. Value 1 is bit 0, unused by any mapped flag.
|
|
38
|
-
WARMUP = 1 # JIT warm-up hook
|
|
39
|
-
PLAN = 4 # a policy planning step
|
|
36
|
+
WARMUP = 1 # JIT warm-up hook, kept separate from LOAD
|
|
37
|
+
PLAN = 4 # a policy planning step — bit 2
|
|
40
38
|
# benchmark lifecycle (eval-raw: platform provides the loop tool, user hooks the goal in) — each an
|
|
41
39
|
# independent, disjoint bit, disjoint too from every mapped bit:
|
|
42
40
|
SETUP = 4096 # load sim + assets, once (≈ @seq.load)
|
|
@@ -49,21 +47,6 @@ class SeqFlags(IntFlag):
|
|
|
49
47
|
ROLLOUT = 8192
|
|
50
48
|
|
|
51
49
|
|
|
52
|
-
# Authoritative "member → Modal counterpart" list. Anything here must equal the bit above; anything in
|
|
53
|
-
# PLATFORM_ONLY must be disjoint from every mapped bit and from each other.
|
|
54
|
-
MODAL_MAPPING: dict[str, str] = {
|
|
55
|
-
"LOAD": "ENTER",
|
|
56
|
-
"SHUTDOWN": "EXIT",
|
|
57
|
-
"INFER": "CALLABLE_INTERFACE",
|
|
58
|
-
"ON_EPISODE": "~SESSIONED",
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
# Platform-only members Modal has no flag for. ROLLOUT is included: it is still a real (if deprecated)
|
|
62
|
-
# member and its bit must stay disjoint from every other, so the disjointness check must cover it.
|
|
63
|
-
PLATFORM_ONLY: frozenset[str] = frozenset(
|
|
64
|
-
{"WARMUP", "PLAN", "SETUP", "SCORE", "RESET", "CHECK", "ROLLOUT"}
|
|
65
|
-
)
|
|
66
|
-
|
|
67
50
|
# The benchmark lifecycle bits a live registration may bind (eval-raw): SETUP / RESET / CHECK / SCORE.
|
|
68
51
|
# ROLLOUT is deliberately absent — deprecated, never bound.
|
|
69
52
|
BENCHMARK_BINDABLE: frozenset[SeqFlags] = frozenset(
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The robot-arm I/O contracts (`action=`, `observation=`, `embodiments=`), re-exported from
|
|
3
|
+
`sequence_base.presets.robot_arm`.
|
|
4
|
+
|
|
5
|
+
Declaring one is optional since contract 0.4.14: a deployment that declares none is held to nothing, and its
|
|
6
|
+
`inputs` / `outputs` pass through the worker untouched. A declared contract is still enforced by the worker and
|
|
7
|
+
handed to the robot at connect. {gs-plans/custom-io/README.md "2. worker:原样交给用户代码"}
|
|
8
|
+
"""
|
|
9
|
+
from sequence_base.presets.robot_arm import ( # noqa: F401 — re-exports
|
|
10
|
+
PROPRIO_FIELDS,
|
|
11
|
+
ActionContract,
|
|
12
|
+
Camera,
|
|
13
|
+
Embodiment,
|
|
14
|
+
ObservationContract,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = ["ActionContract", "PROPRIO_FIELDS", "Camera", "ObservationContract", "Embodiment"]
|