Auto-sync: 2026-06-28 07:42:57
Browse files
dovla_cil/eval/maniskill_policy_rollout.py
CHANGED
|
@@ -63,6 +63,7 @@ def evaluate_maniskill_policy_rollout(
|
|
| 63 |
retrieval_metric: str = "raw",
|
| 64 |
retrieval_type_min_success: float = 0.0,
|
| 65 |
retrieval_residual_scale: float = 1.0,
|
|
|
|
| 66 |
lattice_exclude_types: tuple[str, ...] = (),
|
| 67 |
) -> dict[str, Any]:
|
| 68 |
"""Execute a checkpoint policy from restored ManiSkill CIL states.
|
|
@@ -141,6 +142,8 @@ def evaluate_maniskill_policy_rollout(
|
|
| 141 |
raise ValueError("retrieval_neighbors must be positive")
|
| 142 |
if retrieval_metric not in {"raw", "zscore"}:
|
| 143 |
raise ValueError("retrieval_metric must be 'raw' or 'zscore'")
|
|
|
|
|
|
|
| 144 |
if not 0.0 <= retrieval_type_min_success <= 1.0:
|
| 145 |
raise ValueError("retrieval_type_min_success must be in [0, 1]")
|
| 146 |
if retrieval_residual_scale < 0:
|
|
@@ -204,6 +207,8 @@ def evaluate_maniskill_policy_rollout(
|
|
| 204 |
observation_mode=model_config.observation_mode,
|
| 205 |
retrieval_neighbors=retrieval_neighbors,
|
| 206 |
retrieval_metric=retrieval_metric,
|
|
|
|
|
|
|
| 207 |
)
|
| 208 |
by_task: dict[str, list[_RolloutCase]] = defaultdict(list)
|
| 209 |
for case in cases:
|
|
@@ -285,6 +290,9 @@ def evaluate_maniskill_policy_rollout(
|
|
| 285 |
"retrieval_residual_scale": retrieval_residual_scale
|
| 286 |
if selection_mode == "retrieval_residual"
|
| 287 |
else 0.0,
|
|
|
|
|
|
|
|
|
|
| 288 |
"lattice_exclude_types": list(lattice_exclude_types),
|
| 289 |
"policy_rollout_success_rate": _mean([row["success"] for row in rows]),
|
| 290 |
"policy_rollout_progress": _mean([row["progress"] for row in rows]),
|
|
@@ -446,6 +454,7 @@ def _attach_retrieved_residual_candidates(
|
|
| 446 |
retrieval_neighbors: int,
|
| 447 |
retrieval_metric: str = "raw",
|
| 448 |
retrieval_type_min_success: float = 0.0,
|
|
|
|
| 449 |
) -> list[_RolloutCase]:
|
| 450 |
if observation_mode != "state":
|
| 451 |
raise ValueError("retrieval_residual currently supports state observations only")
|
|
@@ -463,7 +472,12 @@ def _attach_retrieved_residual_candidates(
|
|
| 463 |
task_ids = {record.task_id for record in records}
|
| 464 |
if len(task_ids) != 1:
|
| 465 |
continue
|
| 466 |
-
anchor = next(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
anchor_action = np.asarray(_numeric_action_values(anchor), dtype=np.float32)
|
| 468 |
residuals: list[list[list[float]]] = [np.zeros_like(anchor_action).tolist()]
|
| 469 |
candidate_types = ["policy_residual"]
|
|
|
|
| 63 |
retrieval_metric: str = "raw",
|
| 64 |
retrieval_type_min_success: float = 0.0,
|
| 65 |
retrieval_residual_scale: float = 1.0,
|
| 66 |
+
retrieval_residual_anchor: str = "expert",
|
| 67 |
lattice_exclude_types: tuple[str, ...] = (),
|
| 68 |
) -> dict[str, Any]:
|
| 69 |
"""Execute a checkpoint policy from restored ManiSkill CIL states.
|
|
|
|
| 142 |
raise ValueError("retrieval_neighbors must be positive")
|
| 143 |
if retrieval_metric not in {"raw", "zscore"}:
|
| 144 |
raise ValueError("retrieval_metric must be 'raw' or 'zscore'")
|
| 145 |
+
if retrieval_residual_anchor not in {"expert", "policy"}:
|
| 146 |
+
raise ValueError("retrieval_residual_anchor must be 'expert' or 'policy'")
|
| 147 |
if not 0.0 <= retrieval_type_min_success <= 1.0:
|
| 148 |
raise ValueError("retrieval_type_min_success must be in [0, 1]")
|
| 149 |
if retrieval_residual_scale < 0:
|
|
|
|
| 207 |
observation_mode=model_config.observation_mode,
|
| 208 |
retrieval_neighbors=retrieval_neighbors,
|
| 209 |
retrieval_metric=retrieval_metric,
|
| 210 |
+
retrieval_type_min_success=retrieval_type_min_success,
|
| 211 |
+
retrieval_residual_anchor=retrieval_residual_anchor,
|
| 212 |
)
|
| 213 |
by_task: dict[str, list[_RolloutCase]] = defaultdict(list)
|
| 214 |
for case in cases:
|
|
|
|
| 290 |
"retrieval_residual_scale": retrieval_residual_scale
|
| 291 |
if selection_mode == "retrieval_residual"
|
| 292 |
else 0.0,
|
| 293 |
+
"retrieval_residual_anchor": retrieval_residual_anchor
|
| 294 |
+
if selection_mode == "retrieval_residual"
|
| 295 |
+
else "none",
|
| 296 |
"lattice_exclude_types": list(lattice_exclude_types),
|
| 297 |
"policy_rollout_success_rate": _mean([row["success"] for row in rows]),
|
| 298 |
"policy_rollout_progress": _mean([row["progress"] for row in rows]),
|
|
|
|
| 454 |
retrieval_neighbors: int,
|
| 455 |
retrieval_metric: str = "raw",
|
| 456 |
retrieval_type_min_success: float = 0.0,
|
| 457 |
+
retrieval_residual_anchor: str = "expert",
|
| 458 |
) -> list[_RolloutCase]:
|
| 459 |
if observation_mode != "state":
|
| 460 |
raise ValueError("retrieval_residual currently supports state observations only")
|
|
|
|
| 472 |
task_ids = {record.task_id for record in records}
|
| 473 |
if len(task_ids) != 1:
|
| 474 |
continue
|
| 475 |
+
anchor = next(
|
| 476 |
+
(record for record in records if record.candidate_type == retrieval_residual_anchor),
|
| 477 |
+
None,
|
| 478 |
+
)
|
| 479 |
+
if anchor is None:
|
| 480 |
+
anchor = next((record for record in records if record.candidate_type == "expert"), records[0])
|
| 481 |
anchor_action = np.asarray(_numeric_action_values(anchor), dtype=np.float32)
|
| 482 |
residuals: list[list[list[float]]] = [np.zeros_like(anchor_action).tolist()]
|
| 483 |
candidate_types = ["policy_residual"]
|
logs/auto_sync_hf.log
CHANGED
|
@@ -184,3 +184,4 @@ No files have been modified since last commit. Skipping to prevent empty commit.
|
|
| 184 |
No files have been modified since last commit. Skipping to prevent empty commit.
|
| 185 |
No files have been modified since last commit. Skipping to prevent empty commit.
|
| 186 |
No files have been modified since last commit. Skipping to prevent empty commit.
|
|
|
|
|
|
| 184 |
No files have been modified since last commit. Skipping to prevent empty commit.
|
| 185 |
No files have been modified since last commit. Skipping to prevent empty commit.
|
| 186 |
No files have been modified since last commit. Skipping to prevent empty commit.
|
| 187 |
+
No files have been modified since last commit. Skipping to prevent empty commit.
|