mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-21 03:30:10 +00:00
docs: remove duplicate code blocks in env_processor.mdx
Made-with: Cursor
This commit is contained in:
@@ -96,20 +96,7 @@ smolvla_preprocessor, smolvla_postprocessor = make_pre_post_processors(smolvla_c
|
|||||||
# Or use ACT policy with the same LIBERO environment
|
# Or use ACT policy with the same LIBERO environment
|
||||||
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(libero_cfg)
|
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(libero_cfg)
|
||||||
act_preprocessor, act_postprocessor = make_pre_post_processors(act_cfg)
|
act_preprocessor, act_postprocessor = make_pre_post_processors(act_cfg)
|
||||||
```python
|
````
|
||||||
# Use SmolVLA policy with LIBERO environment
|
|
||||||
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(
|
|
||||||
env_cfg=libero_cfg,
|
|
||||||
policy_cfg=smolvla_cfg,
|
|
||||||
)
|
|
||||||
smolvla_preprocessor, smolvla_postprocessor = make_pre_post_processors(smolvla_cfg)
|
|
||||||
|
|
||||||
# Or use ACT policy with the same LIBERO environment
|
|
||||||
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(
|
|
||||||
env_cfg=libero_cfg,
|
|
||||||
policy_cfg=act_cfg,
|
|
||||||
)
|
|
||||||
act_preprocessor, act_postprocessor = make_pre_post_processors(act_cfg)
|
|
||||||
|
|
||||||
### 3. **Easier Experimentation**
|
### 3. **Easier Experimentation**
|
||||||
|
|
||||||
@@ -326,21 +313,6 @@ class MyEnvProcessorStep(ObservationProcessorStep):
|
|||||||
### 2. Update the Factory
|
### 2. Update the Factory
|
||||||
|
|
||||||
````python
|
````python
|
||||||
# In src/lerobot/envs/factory.py
|
|
||||||
|
|
||||||
def make_env_pre_post_processors(env_cfg: EnvConfig):
|
|
||||||
if isinstance(env_cfg, LiberoEnv) or "libero" in env_cfg.type:
|
|
||||||
preprocessor = PolicyProcessorPipeline(steps=[LiberoProcessorStep()])
|
|
||||||
elif isinstance(env_cfg, MyEnvConfig) or "myenv" in env_cfg.type:
|
|
||||||
preprocessor = PolicyProcessorPipeline(steps=[MyEnvProcessorStep()])
|
|
||||||
else:
|
|
||||||
preprocessor = PolicyProcessorPipeline(steps=[])
|
|
||||||
|
|
||||||
postprocessor = PolicyProcessorPipeline(steps=[])
|
|
||||||
return preprocessor, postprocessor
|
|
||||||
### 2. Update Your `EnvConfig` Subclass
|
|
||||||
|
|
||||||
```python
|
|
||||||
# In src/lerobot/envs/configs.py
|
# In src/lerobot/envs/configs.py
|
||||||
@EnvConfig.register_subclass("myenv")
|
@EnvConfig.register_subclass("myenv")
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -354,6 +326,7 @@ class MyEnvConfig(EnvConfig):
|
|||||||
PolicyProcessorPipeline(steps=[MyEnvProcessorStep()]),
|
PolicyProcessorPipeline(steps=[MyEnvProcessorStep()]),
|
||||||
PolicyProcessorPipeline(steps=[]),
|
PolicyProcessorPipeline(steps=[]),
|
||||||
)
|
)
|
||||||
|
````
|
||||||
|
|
||||||
### 3. Use in Evaluation
|
### 3. Use in Evaluation
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user