style: ruff format & check
This commit is contained in:
parent
07ae66b8ff
commit
6ed4ad8060
7 changed files with 16 additions and 19 deletions
|
|
@ -3,7 +3,7 @@ from dataclasses import dataclass, field
|
||||||
from experiment_logger.config_logger import LoggingConfig
|
from experiment_logger.config_logger import LoggingConfig
|
||||||
from brittle_star_project.configs.config_experiment import ExperimentConfig
|
from brittle_star_project.configs.config_experiment import ExperimentConfig
|
||||||
from brittle_star_project.configs.config_ppo import PPOConfig
|
from brittle_star_project.configs.config_ppo import PPOConfig
|
||||||
from brittle_star_project.configs.config_architecture import ArchitectureConfig, CentralizedConfig
|
from brittle_star_project.configs.config_architecture import ArchitectureConfig
|
||||||
from brittle_star_project.environment.env_config import MorphologyConfig, ArenaConfig, EnvConfig
|
from brittle_star_project.environment.env_config import MorphologyConfig, ArenaConfig, EnvConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,23 +5,28 @@ a constant size regardless of how many segments are amputated. This wrapper pads
|
||||||
the observation dictionary values with zeros using spatial insertion so that the
|
the observation dictionary values with zeros using spatial insertion so that the
|
||||||
flattened observation maintains the correct physical mapping to the neural network.
|
flattened observation maintains the correct physical mapping to the neural network.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
import jax.numpy as jnp
|
import jax.numpy as jnp
|
||||||
|
|
||||||
# Observation keys whose size scales with the number of joints (2 per segment).
|
# Observation keys whose size scales with the number of joints (2 per segment).
|
||||||
_JOINT_SCALED_KEYS = frozenset({
|
_JOINT_SCALED_KEYS = frozenset(
|
||||||
"joint_position",
|
{
|
||||||
"joint_velocity",
|
"joint_position",
|
||||||
"joint_actuator_force",
|
"joint_velocity",
|
||||||
"actuator_force",
|
"joint_actuator_force",
|
||||||
})
|
"actuator_force",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# Observation keys whose size scales with the number of segments (1 per segment).
|
# Observation keys whose size scales with the number of segments (1 per segment).
|
||||||
_SEGMENT_SCALED_KEYS = frozenset({
|
_SEGMENT_SCALED_KEYS = frozenset(
|
||||||
"segment_contact",
|
{
|
||||||
})
|
"segment_contact",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def compute_padding_masks(
|
def compute_padding_masks(
|
||||||
|
|
|
||||||
|
|
@ -528,10 +528,7 @@ class PPOTrainer:
|
||||||
)
|
)
|
||||||
|
|
||||||
if getattr(self.cfg.experiment, "debug_sanity", False):
|
if getattr(self.cfg.experiment, "debug_sanity", False):
|
||||||
self.logger.info(
|
self.logger.info("\n[SANITY CHECK] Successfully completed 1 epoch")
|
||||||
"\n[SANITY CHECK] Successfully completed 1 epoch of data collection and gradient updates."
|
|
||||||
)
|
|
||||||
self.logger.info("[SANITY CHECK] Gradients flowed without NaN. Exiting gracefully.")
|
|
||||||
break
|
break
|
||||||
|
|
||||||
if self.logging_cfg.save_model:
|
if self.logging_cfg.save_model:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
"""Configuration utilities for loading YAML configs and merging with CLI args."""
|
"""Configuration utilities for loading YAML configs and merging with CLI args."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from typing import Dict, Any, Type, TypeVar
|
from typing import Dict, Any, Type, TypeVar
|
||||||
import yaml
|
import yaml
|
||||||
from dataclasses import fields, is_dataclass
|
from dataclasses import fields, is_dataclass
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@ This logger ensures all experimental data is preserved by writing to:
|
||||||
3. stdout (for real-time monitoring)
|
3. stdout (for real-time monitoring)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime
|
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
|
||||||
import yaml
|
import yaml
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import pytest
|
|
||||||
from hydra import compose, initialize
|
from hydra import compose, initialize
|
||||||
from omegaconf import OmegaConf
|
from omegaconf import OmegaConf
|
||||||
from brittle_star_project.configs.main_config import BrittleStarConfig
|
from brittle_star_project.configs.main_config import BrittleStarConfig
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import jax
|
|
||||||
import pytest
|
import pytest
|
||||||
import os
|
import os
|
||||||
import mujoco
|
import mujoco
|
||||||
|
|
|
||||||
Reference in a new issue