原书出处
Build a Reasoning Model (From Scratch)
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, torch.tensor(generated, device=device, dtype=input_ids.dtype),] ) return full_token_ids, input_ids.numel(), tokenizer.decode(generated)
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-6.html
EPUB SHA-256:52d4d07986020be70f5aac21762dfcf60fcba08db0ba29d4f63957caf12aa377