Sampling with a temperature schedule

I’d like to sample from my model using a temperature schedule. For example, I’d like to start sampling with T=10, and gradually reduce it down to T=1 in first 10 tokens, and then keep sampling using T=1.

What’s the way to do that?