原书出处
Build a Reasoning Model (From Scratch)
if temperature is None or temperature == 0.0: next_token = torch.argmax(out, dim=-1, keepdim=True) else: logits = scale_logits_by_temperature(out, temperature) #B probas = torch.softmax(logits, dim=-1) #C next_token = torch.multinomial(probas.cpu(), num_samples=1) #D next_token = next_token.to(orig_device) ######################################### if (eos_token_id is not None and next_token.item() == eos_token_id): break yield next_token out = model(next_token, cache=cache)[:, -1] #A Step 3.1: Get logits #B Step 3.2: Apply temperature scaling on logits #C Step
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-4.html
EPUB SHA-256:52d4d07986020be70f5aac21762dfcf60fcba08db0ba29d4f63957caf12aa377