Instructions to use avneeshjadhav04/llm-from-scratch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use avneeshjadhav04/llm-from-scratch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="avneeshjadhav04/llm-from-scratch")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("avneeshjadhav04/llm-from-scratch", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use avneeshjadhav04/llm-from-scratch with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "avneeshjadhav04/llm-from-scratch" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "avneeshjadhav04/llm-from-scratch", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/avneeshjadhav04/llm-from-scratch
- SGLang
How to use avneeshjadhav04/llm-from-scratch with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "avneeshjadhav04/llm-from-scratch" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "avneeshjadhav04/llm-from-scratch", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "avneeshjadhav04/llm-from-scratch" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "avneeshjadhav04/llm-from-scratch", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use avneeshjadhav04/llm-from-scratch with Docker Model Runner:
docker model run hf.co/avneeshjadhav04/llm-from-scratch
Update README.md
Browse files
README.md
CHANGED
|
@@ -16,8 +16,11 @@ datasets:
|
|
| 16 |
---
|
| 17 |
# LLM from Scratch (124M)
|
| 18 |
A clean, **from-scratch implementation** of a 124M-parameter decoder-only Transformer in PyTorch. No `nn.Transformer`, no shortcuts โ every layer (attention, FFN, LayerNorm, embeddings) is built manually. Trained on **FineWeb-Edu** with mixed precision, gradient accumulation, and automatic checkpoint resume.
|
|
|
|
| 19 |
๐ **Live Demo**: [https://avneeshjadhav04--llm-api.modal.run](https://avneeshjadhav04--llm-api.modal.run)
|
|
|
|
| 20 |
๐ **Training Code**: [github.com/avneeshjadhav04/llm-from-scratch](https://github.com/avneeshjadhav04/llm-from-scratch)
|
|
|
|
| 21 |
## Model Description
|
| 22 |
This is a **GPT-2-style causal language model** trained entirely from random initialization on the FineWeb-Edu dataset. It was built as an educational and portfolio project to demonstrate deep understanding of Transformer internals and large-scale training loops.
|
| 23 |
| Property | Value |
|
|
@@ -78,10 +81,11 @@ If you use this model or code, please cite:
|
|
| 78 |
journal = {GitHub repository},
|
| 79 |
howpublished = {\url{https://github.com/avneeshjadhav04/llm-from-scratch}}
|
| 80 |
}
|
| 81 |
-
|
|
|
|
| 82 |
- Inspired by Andrej Karpathy's nanoGPT (https://github.com/karpathy/nanoGPT)
|
| 83 |
- Transformer architecture from Attention Is All You Need (https://arxiv.org/abs/1706.03762)
|
| 84 |
- FineWeb-Edu dataset by HuggingFace (https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu)
|
| 85 |
-
License
|
| 86 |
- Code: MIT License
|
| 87 |
- Dataset: FineWeb-Edu is released under ODC-By v1.0 (https://opendatacommons.org/licenses/by/1-0/)
|
|
|
|
| 16 |
---
|
| 17 |
# LLM from Scratch (124M)
|
| 18 |
A clean, **from-scratch implementation** of a 124M-parameter decoder-only Transformer in PyTorch. No `nn.Transformer`, no shortcuts โ every layer (attention, FFN, LayerNorm, embeddings) is built manually. Trained on **FineWeb-Edu** with mixed precision, gradient accumulation, and automatic checkpoint resume.
|
| 19 |
+
|
| 20 |
๐ **Live Demo**: [https://avneeshjadhav04--llm-api.modal.run](https://avneeshjadhav04--llm-api.modal.run)
|
| 21 |
+
|
| 22 |
๐ **Training Code**: [github.com/avneeshjadhav04/llm-from-scratch](https://github.com/avneeshjadhav04/llm-from-scratch)
|
| 23 |
+
|
| 24 |
## Model Description
|
| 25 |
This is a **GPT-2-style causal language model** trained entirely from random initialization on the FineWeb-Edu dataset. It was built as an educational and portfolio project to demonstrate deep understanding of Transformer internals and large-scale training loops.
|
| 26 |
| Property | Value |
|
|
|
|
| 81 |
journal = {GitHub repository},
|
| 82 |
howpublished = {\url{https://github.com/avneeshjadhav04/llm-from-scratch}}
|
| 83 |
}
|
| 84 |
+
```
|
| 85 |
+
# Acknowledgments
|
| 86 |
- Inspired by Andrej Karpathy's nanoGPT (https://github.com/karpathy/nanoGPT)
|
| 87 |
- Transformer architecture from Attention Is All You Need (https://arxiv.org/abs/1706.03762)
|
| 88 |
- FineWeb-Edu dataset by HuggingFace (https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu)
|
| 89 |
+
# License
|
| 90 |
- Code: MIT License
|
| 91 |
- Dataset: FineWeb-Edu is released under ODC-By v1.0 (https://opendatacommons.org/licenses/by/1-0/)
|