技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
embodied-dataflow【数据与研究】Build and troubleshoot DreamerV3 Embodied Env, Agent, Driver, Replay, Stream, wrapper, and custom environment dataflow contracts.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task is about the Embodied runtime layer that feeds
DreamerV3: environment adapters, custom Env contracts, Agent.policy() data
shapes, Driver stepping/callbacks, replay insertion/sampling, streams, and
wrappers. It is intentionally safe: it documents and checks data contracts, not
training quality.
embodied.Env adapter.act_space must include reset, why observations need
reward, is_first, is_last, and is_terminal, or why log/ keys do not
reach the policy.Driver(...).on_step(...) callbacks into replay with stable worker ids.NormalizeAction, ClipAction,
UnifyDtypes, CheckSpaces, DiscretizeAction, ResizeImage, TimeLimit,
and RestartOnException.configs.yaml, run-loop selection, logging/checkpoints, and train
smoke commands belong to sibling sub-skill train-configure.jax-models.results-ops.Read references/api-contracts.md before
implementing or reviewing any Env, Agent, Driver, Replay, or Stream
code. It contains the exact key, shape, callback, and sample/update
contracts.
Read references/env-integration.md when adding a built-in or custom environment adapter, selecting wrappers, or deciding which optional dependency boundary applies.
Read references/replay-and-streams.md when replay sampling is empty, samples appear non-contiguous, priorities are updated, chunks are saved/loaded, or stream combinators are used.
Read references/troubleshooting.md when an
error mentions reset, CheckSpaces, dtype/shape bounds, parallel workers,
replay waiting, optional environment imports, or stream assertions.
Run scripts/check_embodied_contracts.py as a local contract smoke before training. It supports:
python scripts/check_embodied_contracts.py --help
python scripts/check_embodied_contracts.py --all
python scripts/check_embodied_contracts.py --mode env
python scripts/check_embodied_contracts.py --mode replay
python scripts/check_embodied_contracts.py --mode driver
python scripts/check_embodied_contracts.py --mode env --factory my_pkg.envs:make_env
The checker uses a tiny dummy-like environment by default and can validate a user-provided zero-argument environment factory. It does not train.
obs_space, act_space, step(action), and close().act_space['reset'] = elements.Space(bool) even if the wrapped
backend resets internally.reward, is_first, is_last, and is_terminal on every step.step({'reset': True, ...}) return the first observation of a new
episode with is_first=True, is_last=False, and reward normally 0.0.UnifyDtypes and then CheckSpaces during debugging.env mode before connecting a policy or replay.import embodied
from embodied.envs import dummy
def make_env():
return dummy.Dummy('disc', length=100)
env0 = make_env()
agent = embodied.RandomAgent(env0.obs_space, env0.act_space)
env0.close()
replay = embodied.Replay(length=16, capacity=1000)
driver = embodied.Driver([make_env, make_env], parallel=False)
driver.reset(agent.init_policy)
driver.on_step(lambda tran, worker: replay.add(tran, worker=worker))
driver(agent.policy, steps=64)
batch = replay.sample(batch=4, mode='train')
assert batch['is_first'].shape[:2] == (4, 16)
Keep the callback worker id when adding to replay. Worker ids keep sequences
from separate environment streams from crossing.
Use these as final native candidates after the whole DreamerV3 skill is integrated and its verification plan allows native tests:
embodied/tests/test_driver.py::TestDriver::test_episode_length: driver
reset/episode-length semantics on the dummy environment.embodied/tests/test_replay.py::TestReplay::test_sample_single: replay
single-worker contiguous sequence sampling.embodied/tests/test_parallel.py, because it
exercises parallel run-loop dataflow and save/load behavior but is longer and
depends on additional runtime services.Do not run those native tests while merely using this runtime sub-skill; use the bundled checker for quick contract preflight.
results-ops.--factory module:callable to the
checker.