fix(claude): claude reviews

This commit is contained in:
CarolinePascal
2026-06-10 20:25:12 +02:00
parent ee6eb745b8
commit fcd8ab5800
2 changed files with 10 additions and 4 deletions
+7 -3
View File
@@ -80,14 +80,16 @@ from lerobot.utils.utils import init_logging
def get_feature_names(dataset: LeRobotDataset, key: str) -> list[str]: def get_feature_names(dataset: LeRobotDataset, key: str) -> list[str]:
"""Return per-dimension names for a feature from the dataset metadata. """Return per-dimension names for a feature from the dataset metadata.
Falls back to ``{key}_{i}`` indices when the metadata has no names. Only flat-list ``names`` metadata is used. Dict-style ``names`` and missing names fall back to ``{key}_{i}`` indices.
""" """
feature = dataset.features[key] feature = dataset.features[key]
dim = feature["shape"][-1]
names = feature.get("names") names = feature.get("names")
if names is not None: if isinstance(names, list) and len(names) == dim:
return [str(name) for name in names] return [str(name) for name in names]
return [f"{key}_{d}" for d in range(feature["shape"][-1])] return [f"{key}_{d}" for d in range(dim)]
def to_hwc_uint8_numpy(chw_float32_torch: torch.Tensor) -> np.ndarray: def to_hwc_uint8_numpy(chw_float32_torch: torch.Tensor) -> np.ndarray:
@@ -329,6 +331,8 @@ def main():
) )
logging.warning("Setting grpc_port to ws_port value.") logging.warning("Setting grpc_port to ws_port value.")
kwargs["grpc_port"] = kwargs.pop("ws_port") kwargs["grpc_port"] = kwargs.pop("ws_port")
else:
kwargs.pop("ws_port") # Always remove ws_port from kwargs
init_logging() init_logging()
logging.info("Loading dataset") logging.info("Loading dataset")
+3 -1
View File
@@ -38,6 +38,8 @@ def init_rerun(
require_package("rerun-sdk", extra="viz", import_name="rerun") require_package("rerun-sdk", extra="viz", import_name="rerun")
import rerun as rr import rerun as rr
log_rerun_data.blueprint = None # Reset blueprint cache for new session
batch_size = os.getenv("RERUN_FLUSH_NUM_BYTES", "8000") batch_size = os.getenv("RERUN_FLUSH_NUM_BYTES", "8000")
os.environ["RERUN_FLUSH_NUM_BYTES"] = batch_size os.environ["RERUN_FLUSH_NUM_BYTES"] = batch_size
rr.init(session_name) rr.init(session_name)
@@ -110,7 +112,7 @@ def log_rerun_data(
from CHW to HWC format, (optionally) compressed to JPEG and logged as `rr.Image` or `rr.EncodedImage`. from CHW to HWC format, (optionally) compressed to JPEG and logged as `rr.Image` or `rr.EncodedImage`.
- 1D NumPy arrays are logged as a single `rr.Scalars` batch under one entity path, so that every - 1D NumPy arrays are logged as a single `rr.Scalars` batch under one entity path, so that every
dimension shares the same view instead of being split across one view per element. dimension shares the same view instead of being split across one view per element.
- Other multi-dimensional arrays are flattened and logged as a single `rr.Scalars` batch. - Multi-dimensional **action** arrays are flattened and logged as a single `rr.Scalars` batch.
Keys are automatically namespaced with "observation." or "action." if not already present. Keys are automatically namespaced with "observation." or "action." if not already present.