Spaces:
Runtime error
Runtime error
Jonathan Fly commited on
Use greedy sampling path when temp is 0.0 to avoid division by zero (#53)
Browse files362 unmodified lines363364365366366367368369370362 unmodified lines logits = logits.permute(0, 1, 3, 2) # [B, K, card, T] logits = logits[..., -1] # [B x K x card]
# Apply softmax for sampling if temp > 0. Else, do greedy sampling to avoid zero division error. if use_sampling: if use_sampling and temp > 0.0: probs = torch.softmax(logits / temp, dim=-1) if top_p > 0.0: next_token = utils.sample_top_p(probs, p=top_p)audiocraft/models/lm.py+2-1