原书出处
Build a Reasoning Model (From Scratch)
if temperature and temperature != 1.0: #B logits = logits / temperature probas = torch.softmax(logits, dim=-1) probas = top_p_filter(probas, top_p) #C next_token = torch.multinomial( probas.cpu(), num_samples=1 ).to(device) if ( tokenizer.eos_token_id is not None and next_token.item() == tokenizer.eos_token_id ): break generated.append(next_token.item()) logits = model(next_token, cache=cache)[:, -1] full_token_ids = torch.cat( [input_ids,
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-6.html
EPUB SHA-256:52d4d07986020be70f5aac21762dfcf60fcba08db0ba29d4f63957caf12aa377