Inference & Serving · Problem 3 of 5
Implement nucleus (top-) sampling with correct renormalization and edge cases.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import numpy as np
def top_p_sample(probs, p=0.9, rng=None):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement nucleus (top-) sampling with correct renormalization and edge cases.
Implement the function/class skeleton in the editor. Any correct approach is accepted.