← Lesson
Decoding Knobs
Joeven
Run
Reset
Python loads on first run
def pick(weights, greedy): if greedy: return weights.index(max(weights)) total = sum(weights) acc = 0.0 cut = 0.35 * total for i, w in enumerate(weights): acc += w if acc >= cut: return i return len(weights) - 1 logits = [0.1, 0.8, 0.1] print("greedy (JSON tools)", pick(logits, True)) print("sample (prose)", pick(logits, False)) print("store knobs per step type, not one global temperature")
Run to execute this in your browser. Nothing is sent to a server.