MCPcopy Create free account
hub / github.com/ml-explore/mlx-examples / sample

Function sample

llava/generate.py:94–98  ·  view source on GitHub ↗
(logits, temperature=0.0)

Source from the content-addressed store, hash-verified

92
93
94def sample(logits, temperature=0.0):
95 if temperature == 0:
96 return mx.argmax(logits, axis=-1)
97 else:
98 return mx.random.categorical(logits * (1 / temperature))
99
100
101def generate_text(input_ids, pixel_values, model, processor, max_tokens, temperature):

Callers 1

generate_textFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected