MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / pin_memory

Method pin_memory

data/dataset_base.py:682–712  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

680 self.ce_loss_weights = data["ce_loss_weights"]
681
682 def pin_memory(self):
683 self.packed_text_ids = self.packed_text_ids.pin_memory()
684 self.packed_text_indexes = self.packed_text_indexes.pin_memory()
685 self.packed_position_ids = self.packed_position_ids.pin_memory()
686
687 if not self.use_flex:
688 self.nested_attention_masks = [item.pin_memory() for item in self.nested_attention_masks]
689
690 if hasattr(self, 'packed_dino_image_tensor_list'):
691 self.packed_dino_token_indexes = self.packed_dino_token_indexes.pin_memory()
692 self.dino_token_seqlens = self.dino_token_seqlens.pin_memory()
693
694 self.packed_depths = self.packed_depths.pin_memory()
695 self.packed_extrinsics = self.packed_extrinsics.pin_memory()
696 self.packed_intrinsics = self.packed_intrinsics.pin_memory()
697 self.packed_world_points = self.packed_world_points.pin_memory()
698 self.packed_point_masks = self.packed_point_masks.pin_memory()
699 self.packed_dino_image_tensor_list = self.packed_dino_image_tensor_list.pin_memory()
700
701 if hasattr(self, 'packed_vit_images'):
702 self.packed_vit_images = self.packed_vit_images.pin_memory()
703 self.packed_image_grid_thw = self.packed_image_grid_thw.pin_memory()
704 self.packed_vit_token_indexes = self.packed_vit_token_indexes.pin_memory()
705 self.vit_token_seqlens = self.vit_token_seqlens.pin_memory()
706
707 if hasattr(self, 'packed_label_ids'):
708 self.packed_label_ids = self.packed_label_ids.pin_memory()
709 self.ce_loss_indexes = self.ce_loss_indexes.pin_memory()
710 self.ce_loss_weights = self.ce_loss_weights.pin_memory()
711
712 return self
713
714 def cuda(self, device=None, non_blocking=False):
715 self.packed_text_ids = self.packed_text_ids.to(device, non_blocking=non_blocking)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected