镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-21 02:27:04 +00:00
fix(ci): resolve quality pre-commit failures on main
- avoid E402 in sarm subtask test via importlib-based lazy module load - update value_infer_viz wording and formatting to satisfy typos/ruff-format - add explicit strict=True for zip to satisfy ruff B905
这个提交包含在:
@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.signal import savgol_filter
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
from scipy.signal import savgol_filter
|
||||||
from tqdm.auto import tqdm
|
from tqdm.auto import tqdm
|
||||||
|
|
||||||
from lerobot.datasets.video_utils import decode_video_frames, encode_video_frames
|
|
||||||
from lerobot.datasets.lerobot_dataset import LeRobotDataset
|
from lerobot.datasets.lerobot_dataset import LeRobotDataset
|
||||||
|
from lerobot.datasets.video_utils import decode_video_frames, encode_video_frames
|
||||||
|
|
||||||
|
|
||||||
def _smooth_1d(arr: np.ndarray, window: int = 1) -> np.ndarray:
|
def _smooth_1d(arr: np.ndarray, window: int = 1) -> np.ndarray:
|
||||||
@ -31,7 +31,9 @@ def _select_video_key(camera_keys: list[str], requested_video_key: str | None) -
|
|||||||
raise ValueError("No camera key found in dataset.")
|
raise ValueError("No camera key found in dataset.")
|
||||||
if requested_video_key is not None:
|
if requested_video_key is not None:
|
||||||
if requested_video_key not in camera_keys:
|
if requested_video_key not in camera_keys:
|
||||||
raise ValueError(f"Unknown video_key '{requested_video_key}'. Available camera keys: {camera_keys}")
|
raise ValueError(
|
||||||
|
f"Unknown video_key '{requested_video_key}'. Available camera keys: {camera_keys}"
|
||||||
|
)
|
||||||
return requested_video_key
|
return requested_video_key
|
||||||
|
|
||||||
for key in camera_keys:
|
for key in camera_keys:
|
||||||
@ -53,7 +55,7 @@ def _select_video_keys(
|
|||||||
return [_select_video_key(camera_keys, requested_video_key)]
|
return [_select_video_key(camera_keys, requested_video_key)]
|
||||||
|
|
||||||
resolved: list[str] = []
|
resolved: list[str] = []
|
||||||
for raw_key in requested_video_keys.split(','):
|
for raw_key in requested_video_keys.split(","):
|
||||||
key = raw_key.strip()
|
key = raw_key.strip()
|
||||||
if not key:
|
if not key:
|
||||||
continue
|
continue
|
||||||
@ -348,7 +350,7 @@ def _encode_pil_to_video(
|
|||||||
fps: int,
|
fps: int,
|
||||||
vcodec: str,
|
vcodec: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Encode PIL frames directly to video without writing intermediate PNGs."""
|
"""Encode PIL frames directly to video without writing intermediate PNG files."""
|
||||||
import av as _av
|
import av as _av
|
||||||
|
|
||||||
video_options, pix_fmt = _get_video_encode_options(vcodec)
|
video_options, pix_fmt = _get_video_encode_options(vcodec)
|
||||||
@ -465,7 +467,7 @@ def _export_single_episode_multiview(
|
|||||||
y_min, y_max = _get_episode_value_bounds(ep_values)
|
y_min, y_max = _get_episode_value_bounds(ep_values)
|
||||||
|
|
||||||
all_cam_frames: list[list[Image.Image]] = []
|
all_cam_frames: list[list[Image.Image]] = []
|
||||||
for src_path, ts in zip(src_video_paths, episode_timestamps_per_cam):
|
for src_path, ts in zip(src_video_paths, episode_timestamps_per_cam, strict=True):
|
||||||
frames = _decode_frames_at_timestamps(
|
frames = _decode_frames_at_timestamps(
|
||||||
video_file=src_path,
|
video_file=src_path,
|
||||||
timestamps_s=ts,
|
timestamps_s=ts,
|
||||||
|
|||||||
@ -14,6 +14,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import importlib
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
transformers = pytest.importorskip("transformers")
|
transformers = pytest.importorskip("transformers")
|
||||||
@ -23,12 +25,11 @@ if not hasattr(transformers, "Qwen3VLMoeForConditionalGeneration"):
|
|||||||
allow_module_level=True,
|
allow_module_level=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
from lerobot.data_processing.sarm_annotations.subtask_annotation import (
|
subtask_annotation = importlib.import_module("lerobot.data_processing.sarm_annotations.subtask_annotation")
|
||||||
Subtask,
|
Subtask = subtask_annotation.Subtask
|
||||||
SubtaskAnnotation,
|
SubtaskAnnotation = subtask_annotation.SubtaskAnnotation
|
||||||
Timestamp,
|
Timestamp = subtask_annotation.Timestamp
|
||||||
compute_temporal_proportions,
|
compute_temporal_proportions = subtask_annotation.compute_temporal_proportions
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def make_annotation(subtasks: list[tuple[str, int, int]]) -> SubtaskAnnotation:
|
def make_annotation(subtasks: list[tuple[str, int, int]]) -> SubtaskAnnotation:
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户