Apply suggestions from code review
small fixes Co-authored-by: Remi <remi.cadene@huggingface.co>
This commit is contained in:
@@ -133,9 +133,7 @@ class SmolVLMWithExpertModel(nn.Module):
|
|||||||
self.expert_hidden_size = lm_expert_config.hidden_size
|
self.expert_hidden_size = lm_expert_config.hidden_size
|
||||||
self.set_requires_grad()
|
self.set_requires_grad()
|
||||||
|
|
||||||
def get_vlm_model(
|
def get_vlm_model(self):
|
||||||
self,
|
|
||||||
):
|
|
||||||
return self.vlm.model
|
return self.vlm.model
|
||||||
|
|
||||||
def set_requires_grad(self):
|
def set_requires_grad(self):
|
||||||
|
|||||||
@@ -109,8 +109,9 @@ def predict_action(observation, policy, device, use_amp):
|
|||||||
):
|
):
|
||||||
# Convert to pytorch format: channel first and float32 in [0,1] with batch dimension
|
# Convert to pytorch format: channel first and float32 in [0,1] with batch dimension
|
||||||
for name in observation:
|
for name in observation:
|
||||||
|
# Skip all observations that are not tensors (e.g. text)
|
||||||
if not isinstance(observation[name], torch.Tensor):
|
if not isinstance(observation[name], torch.Tensor):
|
||||||
continue # VLA-like and multirobot policies include textual inputs in the observation
|
continue
|
||||||
|
|
||||||
if "image" in name:
|
if "image" in name:
|
||||||
observation[name] = observation[name].type(torch.float32) / 255
|
observation[name] = observation[name].type(torch.float32) / 255
|
||||||
|
|||||||
Reference in New Issue
Block a user