Move ModelConfig from config/__init__.py to config/model.py (#25252)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -60,8 +60,7 @@ class Sampler(nn.Module):
|
||||
9. Return the final `SamplerOutput`.
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
logprobs_mode: LogprobsMode = LogprobsMode.RAW_LOGPROBS):
|
||||
def __init__(self, logprobs_mode: LogprobsMode = "raw_logprobs"):
|
||||
super().__init__()
|
||||
self.topk_topp_sampler = TopKTopPSampler(logprobs_mode)
|
||||
self.pin_memory = is_pin_memory_available()
|
||||
@@ -78,9 +77,9 @@ class Sampler(nn.Module):
|
||||
# is used for sampling (after penalties and temperature scaling).
|
||||
num_logprobs = sampling_metadata.max_num_logprobs
|
||||
if num_logprobs is not None:
|
||||
if self.logprobs_mode == LogprobsMode.RAW_LOGPROBS:
|
||||
if self.logprobs_mode == "raw_logprobs":
|
||||
raw_logprobs = self.compute_logprobs(logits)
|
||||
elif self.logprobs_mode == LogprobsMode.RAW_LOGITS:
|
||||
elif self.logprobs_mode == "raw_logits":
|
||||
raw_logprobs = logits.clone()
|
||||
|
||||
# Use float32 for the logits.
|
||||
@@ -156,9 +155,9 @@ class Sampler(nn.Module):
|
||||
if sampling_metadata.all_greedy:
|
||||
processed_logprobs = None
|
||||
if sampling_metadata.max_num_logprobs is not None:
|
||||
if self.logprobs_mode == LogprobsMode.PROCESSED_LOGITS:
|
||||
if self.logprobs_mode == "processed_logits":
|
||||
processed_logprobs = logits
|
||||
elif self.logprobs_mode == LogprobsMode.PROCESSED_LOGPROBS:
|
||||
elif self.logprobs_mode == "processed_logprobs":
|
||||
processed_logprobs = self.compute_logprobs(logits)
|
||||
return greedy_sampled, processed_logprobs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user