原书出处
Designing Large Language Model Applications
Top-k Sampling In top-k sampling, the model samples from a distribution of just the k tokens of the output distribution that have the highest probability. The probability mass is redistributed over the k tokens, and the model samples from this distribution to generate the next token. Hugging Face provides the top_k parameter in its generate function: output = model.generate(**inputs, max_new_tokens=50, do_sample=True, top_k=40) print(tokenizer.decode(output[0], skip_special_tokens=True)) Figure
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Designing Large Language Model Applications/_epub-src/OEBPS/ch05.html
EPUB SHA-256:1b4d2347fec2f949fcddfbaf4fad597a1ae20887a096cfae64c59a619b4781bf