chore(format): formatting code

This commit is contained in:
CarolinePascal
2026-04-30 14:42:37 +02:00
parent 51b9038458
commit 016799dfa1
4 changed files with 17 additions and 21 deletions
+1 -1
View File
@@ -624,8 +624,8 @@ class LeRobotDataset(torch.utils.data.Dataset):
image_writer_processes: int = 0, image_writer_processes: int = 0,
image_writer_threads: int = 0, image_writer_threads: int = 0,
video_backend: str | None = None, video_backend: str | None = None,
camera_encoder_config: VideoEncoderConfig | None = None,
batch_encoding_size: int = 1, batch_encoding_size: int = 1,
camera_encoder_config: VideoEncoderConfig | None = None,
metadata_buffer_size: int = 10, metadata_buffer_size: int = 10,
streaming_encoding: bool = False, streaming_encoding: bool = False,
encoder_queue_maxsize: int = 30, encoder_queue_maxsize: int = 30,
+6 -10
View File
@@ -113,21 +113,19 @@ def _check_option_value(vcodec: str, label: str, value: Any, opt: av.option.Opti
# Check numeric range compatibility # Check numeric range compatibility
lo, hi = float(opt.min), float(opt.max) lo, hi = float(opt.min), float(opt.max)
if lo < hi and not (lo <= num_val <= hi): if lo < hi and not (lo <= num_val <= hi):
raise ValueError(f"{label}={num_val} is out of range for codec {vcodec!r}; must be in [{lo}, {hi}]") raise ValueError(
f"{label}={num_val} is out of range for codec {vcodec!r}; must be in [{lo}, {hi}]"
)
elif type_name == "STRING": elif type_name == "STRING":
if isinstance(value, bool): if isinstance(value, bool):
raise ValueError( raise ValueError(f"{label}={value!r} is not a valid string value for codec {vcodec!r}.")
f"{label}={value!r} is not a valid string value for codec {vcodec!r}."
)
if isinstance(value, str): if isinstance(value, str):
str_val = value str_val = value
elif isinstance(value, (int, float)): elif isinstance(value, (int, float)):
str_val = str(value) str_val = str(value)
else: else:
raise ValueError( raise ValueError(f"{label}={value!r} has unsupported type for STRING option on codec {vcodec!r}")
f"{label}={value!r} has unsupported type for STRING option on codec {vcodec!r}"
)
# Check string choice compatibility # Check string choice compatibility
choices = [c.name for c in (opt.choices or [])] choices = [c.name for c in (opt.choices or [])]
@@ -149,9 +147,7 @@ def _check_pixel_format(vcodec: str, pix_fmt: str) -> None:
) )
def _check_codec_options( def _check_codec_options(vcodec: str, codec_options: dict[str, Any], config: VideoEncoderConfig) -> None:
vcodec: str, codec_options: dict[str, Any], config: VideoEncoderConfig
) -> None:
"""Validate merged encoder options (typed) against the codec's published AVOptions.""" """Validate merged encoder options (typed) against the codec's published AVOptions."""
supported_options = _get_codec_options_by_name(vcodec) supported_options = _get_codec_options_by_name(vcodec)
for key, value in codec_options.items(): for key, value in codec_options.items():
+3 -1
View File
@@ -140,7 +140,9 @@ class VideoEncoderConfig:
return return
raise ValueError(f"Unsupported video codec: {self.vcodec} with video backend {self.video_backend}") raise ValueError(f"Unsupported video codec: {self.vcodec} with video backend {self.video_backend}")
def get_codec_options(self, encoder_threads: int | None = None, as_strings: bool = False) -> dict[str, str]: def get_codec_options(
self, encoder_threads: int | None = None, as_strings: bool = False
) -> dict[str, str]:
"""Translate the tuning fields to codec-specific FFmpeg options. """Translate the tuning fields to codec-specific FFmpeg options.
``VideoEncoderConfig.extra_options`` are merged last but never override a structured field. ``VideoEncoderConfig.extra_options`` are merged last but never override a structured field.
-2
View File
@@ -105,10 +105,8 @@ from lerobot.configs import parser
from lerobot.configs.dataset import DatasetRecordConfig from lerobot.configs.dataset import DatasetRecordConfig
from lerobot.datasets import ( from lerobot.datasets import (
LeRobotDataset, LeRobotDataset,
VideoEncoderConfig,
VideoEncodingManager, VideoEncodingManager,
aggregate_pipeline_dataset_features, aggregate_pipeline_dataset_features,
camera_encoder_defaults,
create_initial_features, create_initial_features,
safe_stop_image_writer, safe_stop_image_writer,
) )