mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-20 08:21:50 +00:00
style
This commit is contained in:
@@ -56,7 +56,7 @@ def make_env_pre_post_processors(
|
|||||||
# For LIBERO environments, add the LiberoProcessorStep
|
# For LIBERO environments, add the LiberoProcessorStep
|
||||||
if isinstance(env_cfg, LiberoEnv) or "libero" in env_cfg.type:
|
if isinstance(env_cfg, LiberoEnv) or "libero" in env_cfg.type:
|
||||||
return PolicyProcessorPipeline(steps=[LiberoProcessorStep()])
|
return PolicyProcessorPipeline(steps=[LiberoProcessorStep()])
|
||||||
|
|
||||||
# For all other environments, return an identity processor (does nothing)
|
# For all other environments, return an identity processor (does nothing)
|
||||||
return PolicyProcessorPipeline(steps=[])
|
return PolicyProcessorPipeline(steps=[])
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ def rollout(
|
|||||||
# Infer "task" from attributes of environments.
|
# Infer "task" from attributes of environments.
|
||||||
# TODO: works with SyncVectorEnv but not AsyncVectorEnv
|
# TODO: works with SyncVectorEnv but not AsyncVectorEnv
|
||||||
observation = add_envs_task(env, observation)
|
observation = add_envs_task(env, observation)
|
||||||
|
|
||||||
# Apply environment-specific preprocessing (e.g., LiberoProcessorStep for LIBERO)
|
# Apply environment-specific preprocessing (e.g., LiberoProcessorStep for LIBERO)
|
||||||
observation = env_preprocessor(observation)
|
observation = env_preprocessor(observation)
|
||||||
|
|
||||||
@@ -524,10 +524,10 @@ def eval_main(cfg: EvalPipelineConfig):
|
|||||||
pretrained_path=cfg.policy.pretrained_path,
|
pretrained_path=cfg.policy.pretrained_path,
|
||||||
preprocessor_overrides=preprocessor_overrides,
|
preprocessor_overrides=preprocessor_overrides,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create environment-specific preprocessor (e.g., for LIBERO environments)
|
# Create environment-specific preprocessor (e.g., for LIBERO environments)
|
||||||
env_preprocessor = make_env_pre_post_processors(env_cfg=cfg.env)
|
env_preprocessor = make_env_pre_post_processors(env_cfg=cfg.env)
|
||||||
|
|
||||||
with torch.no_grad(), torch.autocast(device_type=device.type) if cfg.policy.use_amp else nullcontext():
|
with torch.no_grad(), torch.autocast(device_type=device.type) if cfg.policy.use_amp else nullcontext():
|
||||||
info = eval_policy_all(
|
info = eval_policy_all(
|
||||||
envs=envs,
|
envs=envs,
|
||||||
|
|||||||
Reference in New Issue
Block a user