[Minor] Add some utility functions (#1671)

This commit is contained in:
Lianmin Zheng
2024-10-14 20:08:03 -07:00
committed by GitHub
parent cd0be7489f
commit 4a292f670d
4 changed files with 42 additions and 2 deletions

View File

@@ -202,3 +202,14 @@ class SamplingBatchInfo:
self.logit_bias = SamplingBatchInfo.merge_bias_tensor(
self.logit_bias, other.logit_bias, len(self), len(other), self.device
)
def copy(self):
return SamplingBatchInfo(
temperatures=self.temperatures,
top_ps=self.top_ps,
top_ks=self.top_ks,
min_ps=self.min_ps,
need_min_p_sampling=self.need_min_p_sampling,
vocab_size=self.vocab_size,
device=self.device,
)