MCPcopy
hub / github.com/hkust-nlp/simpleRL-reason / to

Method to

verl/protocol.py:324–336  ·  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

322 return cls(batch=tensor_dict, non_tensor_batch=non_tensors, meta_info=meta_info)
323
324 def to(self, device) -> 'DataProto':
325 """move the batch to device
326
327 Args:
328 device (torch.device, str): torch device
329
330 Returns:
331 DataProto: the current DataProto
332
333 """
334 if self.batch is not None:
335 self.batch = self.batch.to(device)
336 return self
337
338 def select(self, batch_keys=None, non_tensor_batch_keys=None, meta_info_keys=None, deepcopy=False) -> 'DataProto':
339 """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_fsdp_ckptFunction · 0.80
test_vllm_with_hfFunction · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by 7

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_fsdp_ckptFunction · 0.64
test_vllm_with_hfFunction · 0.64