Refactor SACConfig properties for improved readability
- Simplified the `image_features` property to directly iterate over `input_features`. - Removed unused imports and unnecessary code related to main execution, enhancing clarity and maintainability.
This commit is contained in:
parent
3c56ad33c3
commit
6f7024242a
|
@ -16,11 +16,10 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, Optional
|
|
||||||
|
|
||||||
from lerobot.common.optim.optimizers import MultiAdamConfig
|
from lerobot.common.optim.optimizers import MultiAdamConfig
|
||||||
from lerobot.configs.policies import PreTrainedConfig
|
from lerobot.configs.policies import PreTrainedConfig
|
||||||
from lerobot.configs.types import NormalizationMode, PolicyFeature, FeatureType
|
from lerobot.configs.types import FeatureType, NormalizationMode, PolicyFeature
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -221,7 +220,7 @@ class SACConfig(PreTrainedConfig):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def image_features(self) -> list[str]:
|
def image_features(self) -> list[str]:
|
||||||
return [key for key in self.input_features.keys() if "image" in key]
|
return [key for key in self.input_features if "image" in key]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def observation_delta_indices(self) -> list:
|
def observation_delta_indices(self) -> list:
|
||||||
|
@ -234,14 +233,3 @@ class SACConfig(PreTrainedConfig):
|
||||||
@property
|
@property
|
||||||
def reward_delta_indices(self) -> None:
|
def reward_delta_indices(self) -> None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
import draccus
|
|
||||||
|
|
||||||
config = SACConfig()
|
|
||||||
draccus.set_config_type("json")
|
|
||||||
draccus.dump(
|
|
||||||
config=config,
|
|
||||||
stream=open(file="run_config.json", mode="w"),
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue