MCPcopy
hub / github.com/Jiayi-Pan/TinyZero / to

Method to

verl/protocol.py:316–328  ·  view source on GitHub ↗

move the batch to device Args: device (torch.device, str): torch device Returns: DataProto: the current DataProto

(self, device)

Source from the content-addressed store, hash-verified

314 return cls(batch=tensor_dict, non_tensor_batch=non_tensors, meta_info=meta_info)
315
316 def to(self, device) -> 'DataProto':
317 """move the batch to device
318
319 Args:
320 device (torch.device, str): torch device
321
322 Returns:
323 DataProto: the current DataProto
324
325 """
326 if self.batch is not None:
327 self.batch = self.batch.to(device)
328 return self
329
330 def select(self, batch_keys=None, non_tensor_batch_keys=None, meta_info_keys=None, deepcopy=False) -> 'DataProto':
331 """Select a subset of the DataProto via batch_keys and meta_info_keys

Callers 15

update_actorMethod · 0.95
update_criticMethod · 0.95
update_actorMethod · 0.95
update_criticMethod · 0.95
add_oneFunction · 0.80
test_hf_casual_modelsFunction · 0.80
test_hf_value_modelsFunction · 0.80
test_hf_casual_fwdFunction · 0.80
test_hf_casual_fwd_bwdFunction · 0.80
test_vllm_with_hfFunction · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by 6

add_oneFunction · 0.64
test_hf_casual_modelsFunction · 0.64
test_hf_value_modelsFunction · 0.64
test_hf_casual_fwdFunction · 0.64
test_hf_casual_fwd_bwdFunction · 0.64
test_vllm_with_hfFunction · 0.64