Complete the code to set the top-k value for sampling.
top_k = [1]Top-k sampling uses an integer value to limit the number of tokens considered. Here, 50 means only the top 50 tokens are sampled from.
Complete the code to set the top-p value for nucleus sampling.
top_p = [1]Top-p sampling uses a probability threshold between 0 and 1. Here, 0.9 means sampling from tokens whose cumulative probability is at least 90%.
Fix the error in the code to apply top-k sampling correctly.
output = model.generate(input_ids, do_sample=True, top_k=[1])
Top-k must be an integer specifying how many top tokens to sample from. 50 is a valid integer value.
Fill both blanks to apply top-p and top-k sampling together.
output = model.generate(input_ids, do_sample=True, top_k=[1], top_p=[2])
Top-k is set to 50 tokens, and top-p is set to 0.9 probability threshold. Both control sampling diversity.
Fill all three blanks to create a dictionary of sampling parameters with top-k, top-p, and temperature.
sampling_params = {'top_k': [1], 'top_p': [2], 'temperature': [3]Top-k is 40 tokens, top-p is 0.85 probability, and temperature is 0.7 to control randomness.