Implement Temperature Sampling in PyTorch
Easyllm-decodingauto-graded
Divide logits by a temperature scalar before softmax to sharpen or flatten the token probability distribution.
Solve it
Check your answer
The grader verifies properties of your implementation, so a correct solution written differently from ours still passes.
pip install torchleet
from torchleet import check
check("temperature-sampling", temperature_sample)