mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-23 09:46:00 +00:00
Merge branch 'main' into feature/add-multitask-dit
This commit is contained in:
@@ -378,16 +378,16 @@ class SmolVLAPolicy(PreTrainedPolicy):
|
|||||||
actions_is_pad = batch.get("actions_id_pad")
|
actions_is_pad = batch.get("actions_id_pad")
|
||||||
loss_dict = {}
|
loss_dict = {}
|
||||||
losses = self.model.forward(images, img_masks, lang_tokens, lang_masks, state, actions, noise, time)
|
losses = self.model.forward(images, img_masks, lang_tokens, lang_masks, state, actions, noise, time)
|
||||||
loss_dict["losses_after_forward"] = losses.clone()
|
loss_dict["losses_after_forward"] = losses.clone().mean().item()
|
||||||
|
|
||||||
if actions_is_pad is not None:
|
if actions_is_pad is not None:
|
||||||
in_episode_bound = ~actions_is_pad
|
in_episode_bound = ~actions_is_pad
|
||||||
losses = losses * in_episode_bound.unsqueeze(-1)
|
losses = losses * in_episode_bound.unsqueeze(-1)
|
||||||
loss_dict["losses_after_in_ep_bound"] = losses.clone()
|
loss_dict["losses_after_in_ep_bound"] = losses.clone().mean().item()
|
||||||
|
|
||||||
# Remove padding
|
# Remove padding
|
||||||
losses = losses[:, :, : self.config.max_action_dim]
|
losses = losses[:, :, : self.config.max_action_dim]
|
||||||
loss_dict["losses_after_rm_padding"] = losses.clone()
|
loss_dict["losses_after_rm_padding"] = losses.clone().mean().item()
|
||||||
|
|
||||||
if reduction == "none":
|
if reduction == "none":
|
||||||
# Return per-sample losses (B,) by averaging over time and action dims
|
# Return per-sample losses (B,) by averaging over time and action dims
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ from dataclasses import dataclass, field
|
|||||||
|
|
||||||
import draccus
|
import draccus
|
||||||
|
|
||||||
from lerobot.utils.import_utils import is_package_available
|
from lerobot.utils.import_utils import _can_available
|
||||||
|
|
||||||
MOTOR_NAMES = {
|
MOTOR_NAMES = {
|
||||||
0x01: "joint_1",
|
0x01: "joint_1",
|
||||||
@@ -336,7 +336,7 @@ def run_speed(cfg: CANSetupConfig):
|
|||||||
|
|
||||||
@draccus.wrap()
|
@draccus.wrap()
|
||||||
def setup_can(cfg: CANSetupConfig):
|
def setup_can(cfg: CANSetupConfig):
|
||||||
if not is_package_available("can"):
|
if not _can_available:
|
||||||
print("Error: python-can not installed. Install with: pip install python-can")
|
print("Error: python-can not installed. Install with: pip install python-can")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user