tairov / llama2.mojo

Inference Llama 2 in one file of pure 🔥
https://www.modular.com/blog/community-spotlight-how-i-built-llama2-by-aydyn-tairov
MIT License
2.09k stars 140 forks source link

Add boundary checks to FileBuf #29

Closed mikowals closed 11 months ago

mikowals commented 11 months ago

I added a getter to catch errors when reading and made the error messages from moving more accurate.

While doing this I thought about grouping more of the code inside the FileBuf struct. read_file could be made an __init__ and the various read_val... methods could be moved into the struct also. this would mostly make the code quicker to find. I decided if that was desirable it was best in a separate request.

tairov commented 11 months ago

thanks. Moving methods inside FileBuf struct sounds great, happy to checkout another pr 👍