fix(typos): fixing typos and missing imports

This commit is contained in:
CarolinePascal
2025-08-09 01:13:30 +02:00
parent 6d73f5bfe6
commit 0caba222ef
5 changed files with 17 additions and 7 deletions
@@ -47,6 +47,7 @@ import torch
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig # noqa: F401
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig # noqa: F401
from lerobot.microphones.portaudio.configuration_portaudio import PortAudioMicrophoneConfig # noqa: F401
from lerobot.processor import RobotAction
from lerobot.robots import ( # noqa: F401
Robot,
+6 -4
View File
@@ -685,12 +685,12 @@ def hw_to_dataset_features(
"names": ["height", "width", "channels"],
}
for key, features in mic_fts.items():
for key, parameters in mic_fts.items():
features[f"{prefix}.audio.{key}"] = {
"dtype": "audio",
"shape": (features[1],),
"shape": (len(parameters[1]),),
"names": ["channels"],
"info": {"sample_rate": features[0]},
"info": {"sample_rate": parameters[0]},
}
_validate_feature_names(features)
@@ -1168,7 +1168,9 @@ def validate_feature_audio(name: str, expected_shape: list[str], value: np.ndarr
if isinstance(value, np.ndarray):
actual_shape = value.shape
c = expected_shape
if len(actual_shape) != 2 or actual_shape[-1] != c[-1]: # The number of frames might be different
if (len(actual_shape) != 2 and len(actual_shape) != 1) or actual_shape[-1] != c[
-1
]: # The number of frames might be different
error_message += (
f"The feature '{name}' of shape '{actual_shape}' does not have the expected shape '{c}'.\n"
)
+1
View File
@@ -33,6 +33,7 @@ import draccus
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig # noqa: F401
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig # noqa: F401
from lerobot.microphones.portaudio.configuration_portaudio import PortAudioMicrophoneConfig # noqa: F401
from lerobot.robots import ( # noqa: F401
Robot,
RobotConfig,
+8 -3
View File
@@ -91,6 +91,10 @@ from lerobot.datasets.utils import (
combine_feature_dicts,
)
from lerobot.datasets.video_utils import VideoEncodingManager
from lerobot.microphones import (
MicrophoneConfig, # noqa: F401
)
from lerobot.microphones.portaudio.configuration_portaudio import PortAudioMicrophoneConfig # noqa: F401
from lerobot.microphones.utils import (
async_microphones_start_recording,
async_microphones_stop_recording,
@@ -344,14 +348,15 @@ def record_loop(
if (
dataset is not None and robot.name != "lekiwi"
): # For now, LeKiwi only supports frame audio recording (which may lead to audio chunks loss, extended post-processing, increased memory usage)
for microphone_key, microphone in robot.microphones.items():
dataset.add_microphone_recording(microphone, microphone_key)
dataset.add_microphones_recordings(robot.microphones)
else:
async_microphones_start_recording(robot.microphones)
# Fill audio buffers if needed
if robot.microphones and (policy is not None or dataset is not None):
# This initial wait might be longer than the audio chunk duration to (1) ensure that the audio buffers are filled with enough data and (2) add additional initial samples to the dataset in case of variable audio chubk duration during training.
# This initial wait might be longer than the audio chunk duration to
# (1) ensure that the audio buffers are filled with enough data
# (2) add additional initial samples to the dataset in case of variable audio chunk duration during training
busy_wait(DEFAULT_INITIAL_AUDIO_BUFFER_DURATION)
for microphone_name, microphone in robot.microphones.items():
@@ -61,6 +61,7 @@ import rerun as rr
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig # noqa: F401
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig # noqa: F401
from lerobot.configs import parser
from lerobot.microphones.portaudio.configuration_portaudio import PortAudioMicrophoneConfig # noqa: F401
from lerobot.processor import (
RobotAction,
RobotObservation,