chore(format): formatting code

This commit is contained in:
CarolinePascal
2026-05-15 23:01:59 +02:00
parent e8503f5fe6
commit 197fcdb807
4 changed files with 8 additions and 11 deletions
+3 -7
View File
@@ -26,7 +26,7 @@ This module provides utilities for:
import logging
import shutil
from collections.abc import Callable
from concurrent.futures import ThreadPoolExecutor, as_completed, ProcessPoolExecutor
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, as_completed
from pathlib import Path
import datasets
@@ -1933,9 +1933,7 @@ def reencode_dataset(
return dataset
logging.info(f"Re-encoding {len(video_paths_list)} video file(s) with {camera_encoder}")
worker_args = [
(vp, camera_encoder, encoder_threads) for vp in video_paths_list
]
worker_args = [(vp, camera_encoder, encoder_threads) for vp in video_paths_list]
if num_workers and num_workers >= 1:
with ProcessPoolExecutor(max_workers=num_workers) as pool:
futures = [pool.submit(_reencode_video_worker, args) for args in worker_args]
@@ -1952,9 +1950,7 @@ def reencode_dataset(
# Refresh video info in metadata for every video key.
for vid_key in meta.video_keys:
video_path = meta.root / meta.get_video_file_path(0, vid_key)
meta.info.features[vid_key]["info"] = get_video_info(
video_path, camera_encoder=camera_encoder
)
meta.info.features[vid_key]["info"] = get_video_info(video_path, camera_encoder=camera_encoder)
write_info(meta.info, meta.root)
logging.info("Dataset metadata updated.")
+3 -1
View File
@@ -456,7 +456,9 @@ def reencode_video(
with av.open(
tmp_output_video_path,
mode="w",
options={"movflags": "faststart"}, # faststart is to move the metadata to the beginning of the file to speed up loading
options={
"movflags": "faststart"
}, # faststart is to move the metadata to the beginning of the file to speed up loading
) as dst:
out_stream = dst.add_stream(vcodec, fps, options=video_options)
out_stream.pix_fmt = pix_fmt
+1 -2
View File
@@ -673,8 +673,7 @@ def handle_reencode_videos(cfg: EditDatasetConfig) -> None:
current_encoder = VideoEncoderConfig.from_video_info(current_info)
if current_encoder == cfg.operation.camera_encoder:
logging.info(
f"Videos in {cfg.repo_id} are already encoded with {current_encoder}. "
"Nothing to do."
f"Videos in {cfg.repo_id} are already encoded with {current_encoder}. Nothing to do."
)
return
else:
+1 -1
View File
@@ -17,7 +17,6 @@
"""Unit tests for ``lerobot.datasets.video_utils`` encoding functions and ``lerobot.configs.video.VideoEncoderConfig`` config class."""
import json
import shutil
from pathlib import Path
import numpy as np
@@ -499,6 +498,7 @@ class TestReencodeVideo:
assert info["video.g"] == 6
assert info["video.crf"] == 23
class TestConcatenateVideoFiles:
def test_two_clips_frame_count(self, tmp_path):
"""Output frame count equals the sum of the two input frame counts."""