DEV Community

Prashant Lakhera
Prashant Lakhera

Posted on

๐Ÿš€ Yes, you can build your own Small or Large Language Model(Meta Llama) in just 2 commands.๐Ÿš€

For the last few days, Iโ€™ve been experimenting with TorchTitan, and Iโ€™m honestly blown away by how accessible it has made LLM training. What once felt impossible or reserved for big research labs is now something you can do on your own laptop or a Colab GPU.

Hereโ€™s literally all you need:

1๏ธโƒฃ Download the tokenizer

python scripts/download_hf_assets.py \

--repo_id meta-llama/Llama-4-Scout-17B-16E \

--hf_token $HF_TOKEN \

--local_dir ./assets/hf/Llama-4-Scout-17B-16E \

--assets tokenizer

2๏ธโƒฃ Run the training command

torchrun --nproc_per_node=1 --rdzv_backend=c10d --rdzv_endpoint=localhost:0 \

torchtitan/train.py --job.config-file \

torchtitan/models/llama4/train_configs/colab_a100.toml

๐Ÿ”ฅ And thatโ€™s it.

Using just these steps, I trained my first Meta Llama model and Iโ€™m incredibly excited to share that itโ€™s now live on Hugging Face:

๐Ÿ”— Model: https://huggingface.co/lakhera2023/llama4-debugmodel-10k

This is just the beginning. The tools are here, the ecosystem is ready, and all you need is curiosity and the willingness to start.

If I can build it, you can too. Letโ€™s push the boundaries together.

๐Ÿ“˜ Full blog with step-by-step breakdown: https://prashantlakhera.substack.com/p/building-your-own-language-models

๐Ÿ’กNote: I know I oversimplified a lot here because the truth is, thereโ€™s a lot you need to understand before confidently running these commands. Concepts like tokenization, model configs, architectures, distributed training, optimizers, data pipelines... they all play a crucial role.

If you want to go deeper and really understand whatโ€™s happening under the hood, Iโ€™ve written a book that explains every concept step by step, from fundamentals to fully training a Small Language Model.

๐Ÿ“— Building A Small Language Model from Scratch: A Practical Guide

โœ… Gumroad: https://plakhera.gumroad.com/l/BuildingASmallLanguageModelfromScratch

โœ… Amazon: https://www.amazon.com/dp/B0G64SQ4F8/

โœ… Leanpub: https://leanpub.com/buildingasmalllanguagemodelfromscratch/

If you're serious about understanding LLM, not just running commands, but mastering the craft, this book will guide you through it.

Top comments (0)