Skip to content

Commit

Permalink
Refactor temp
Browse files Browse the repository at this point in the history
  • Loading branch information
armbues committed Jun 28, 2024
1 parent 5ccfe17 commit 89549ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sillm/core/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,10 @@ def generate(model,
buffer, output = [], ""

def sample(logits):
if temperature > 0:
return mx.random.categorical(logits * (1 / temperature))
else:
if temperature == 0:
return mx.argmax(logits, axis=-1)
else:
return mx.random.categorical(logits * (1 / temperature))
# TODO add top-p sampling

def apply_repetition_penalty(logits):
Expand Down

0 comments on commit 89549ac

Please sign in to comment.