(logits, temperature=0.0)
| 92 | |
| 93 | |
| 94 | def 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 | |
| 101 | def generate_text(input_ids, pixel_values, model, processor, max_tokens, temperature): |