rasbt / LLMs-from-scratch

Implement a ChatGPT-like LLM in PyTorch from scratch, step by step
https://www.amazon.com/Build-Large-Language-Model-Scratch/dp/1633437167
Other
34.43k stars 4.21k forks source link

eos_id argument missing from book listing 5.4 ("generate") #255

Closed bjpcjp closed 5 months ago

bjpcjp commented 5 months ago

Bug description

Listing 5.4 breaks if copied directly from the book (I'm using release v7) due to eos_id not being defined in the arg list for function "generate". I noticed that the argument is defined in github.

What operating system are you using?

Linux

Where do you run your code?

Local (laptop, desktop)

Environment

d-kleine commented 5 months ago

There was already a discussion about that in the live forum: https://livebook.manning.com/forum?product=raschka&comment=570746&page=1

You need to add eos_id=None to the function: def generate(model, idx, max_new_tokens, context_size, temperature=0.0, top_k=None, eos_id=None):

rasbt commented 5 months ago

Thanks for raising this issue @bjpcjp , it's super appreciated and helpful in terms of finding inconsistencies and bugs. Like @d-kleine mentioned, I updated the manuscript recently, but it seems like this has not been synced yet (the book is currently being layouted, and I think Manning probably wanted to wait a few more days until that's complete before syncing it). Thanks for noting it though!

bjpcjp commented 5 months ago

Welcome! This is the first book that I’ve completed (thru chap 5) without a single error. Given my lackluster PyTorch skills, that’s saying something. 😎

On Mon, Jul 1, 2024 at 6:36 PM Sebastian Raschka @.***> wrote:

Thanks for raising this issue @bjpcjp https://github.com/bjpcjp , it's super appreciated and helpful in terms of finding inconsistencies and bugs. Like @d-kleine https://github.com/d-kleine mentioned, I updated the manuscript recently, but it seems like this has not been synced yet (the book is currently being layouted, and I think Manning probably wanted to wait a few more days until that's complete before syncing it). Thanks for noting it though!

— Reply to this email directly, view it on GitHub https://github.com/rasbt/LLMs-from-scratch/issues/255#issuecomment-2201229367, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATL3KK5N4S54LD7AQBPB3ZKHKV7AVCNFSM6AAAAABKGKNJ5WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGIZDSMZWG4 . You are receiving this because you were mentioned.Message ID: @.***>

rasbt commented 5 months ago

haha, I take this as a compliment 😊