-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Summary
The documentation (PR #201) describes Policy.from_config(config) as the primary/recommended way to instantiate policies, but this method doesn't exist yet in the codebase. Currently only Model.from_config() exists.
Current State
# What users must do today (2 steps)
config = ACTConfig(hidden_dim=512, chunk_size=100, ...)
model = ACTModel.from_config(config)
policy = ACT(model=model)Desired State
# What users should be able to do (1 step)
config = ACTConfig(hidden_dim=512, chunk_size=100, ...)
policy = ACT.from_config(config)Implementation
The implementation is trivial - add FromConfig mixin to Policy classes:
class FromConfig:
"""Mixin that enables Policy.from_config(config) instantiation."""
model_type: type
@classmethod
def from_config(cls, config: Config, **kwargs):
model = cls.model_type.from_config(config)
return cls(model=model, **kwargs)Then update each policy:
class ACT(FromConfig, FromCheckpoint, Export, Policy):
model_type = ACTModel
# ... rest unchangedor alternatively, base Policy class could also inherit FromConfig mixin, so it would be supported by all of the policies by default.
Affected Policies
- ACT
- Diffusion
- GROOT
- Pi0
- SmolVLA
Related
- PR docs: comprehensive documentation overhaul and application README improvements #201 - Documentation that describes this API pattern
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels