mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-01-23 09:44:27 +08:00
Use FP32 for log probabilities (#19)
This commit is contained in:
parent
e3f00d191e
commit
a90c97d727
@ -36,10 +36,11 @@ class Sampler(nn.Module):
|
||||
# Use in-place division to avoid creating a new tensor.
|
||||
logits.div_(t.unsqueeze(dim=1))
|
||||
|
||||
# We use float32 for probabilities and log probabilities.
|
||||
# Compute the probabilities.
|
||||
probs = torch.softmax(logits, dim=-1, dtype=torch.float)
|
||||
# Compute the log probabilities (before applying top-p).
|
||||
logprobs = torch.log(probs, out=logits)
|
||||
logprobs = torch.log(probs)
|
||||
|
||||
# Apply top-p truncation.
|
||||
top_ps = _get_top_ps(input_metadata)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user