Text Generation
Transformers
Safetensors
English
llama
small-language-model
conversational
text-generation-inference
Instructions to use sciencemj/tinyllm-113m-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sciencemj/tinyllm-113m-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sciencemj/tinyllm-113m-base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sciencemj/tinyllm-113m-base") model = AutoModelForCausalLM.from_pretrained("sciencemj/tinyllm-113m-base", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sciencemj/tinyllm-113m-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sciencemj/tinyllm-113m-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sciencemj/tinyllm-113m-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sciencemj/tinyllm-113m-base
- SGLang
How to use sciencemj/tinyllm-113m-base 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 "sciencemj/tinyllm-113m-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sciencemj/tinyllm-113m-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "sciencemj/tinyllm-113m-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sciencemj/tinyllm-113m-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sciencemj/tinyllm-113m-base with Docker Model Runner:
docker model run hf.co/sciencemj/tinyllm-113m-base
|
Download README.md from sciencemj/tinyllm-113m-base: direct link, hf CLI and curl.
- Browser
- Download file 2.02 kB
-
https://huggingface.co/sciencemj/tinyllm-113m-base/resolve/main/README.md
- Command line
-
hf download hf://sciencemj/tinyllm-113m-base/README.md
-
curl -L -o README.md https://huggingface.co/sciencemj/tinyllm-113m-base/resolve/main/README.md
2.02 kB
| license: apache-2.0 | |
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| datasets: | |
| - HuggingFaceFW/fineweb-edu | |
| tags: | |
| - llama | |
| - small-language-model | |
| # tinyllm-113m-base | |
| A 112,678,656-parameter English base language model built on the stock `LlamaForCausalLM` | |
| architecture. It was pretrained from scratch on 15B tokens of FineWeb-Edu on a single | |
| NVIDIA L4 (about 201 hours). This is a text-completion model, not a chat model. The | |
| chat version is [`sciencemj/tinyllm-113m-chat`](https://huggingface.co/sciencemj/tinyllm-113m-chat), | |
| which has the full model card. | |
| ## Usage | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| repo = "sciencemj/tinyllm-113m-base" | |
| tok = AutoTokenizer.from_pretrained(repo) | |
| model = AutoModelForCausalLM.from_pretrained(repo).eval() | |
| enc = tok("The water cycle begins when", return_tensors="pt") | |
| out = model.generate(**enc, max_new_tokens=100, do_sample=True, temperature=0.8, top_k=40) | |
| print(tok.decode(out[0], skip_special_tokens=True)) | |
| ``` | |
| ## Model and training | |
| - 14 layers, hidden 768, SwiGLU FFN 2,048, 12 query / 4 KV heads (GQA), RoPE, RMSNorm, | |
| tied embeddings, 32,000-token BPE vocab, 1,024-token context. | |
| - FineWeb-Edu `sample-100BT`: 15.0B tokens (915,528 steps × 16 × 1,024), about 0.75 of a | |
| 20.0B-token sample. | |
| - AdamW (β 0.9/0.95), LR 6e-4 → 6e-5 cosine with 2,000 warmup steps, weight decay 0.1, | |
| grad clip 1.0, bf16 mixed precision. | |
| - This is the checkpoint with the best validation loss (step 879,999): | |
| **3.1298 nats/token, 1.0021 bits/char** on 22.2M held-out FineWeb-Edu tokens. | |
| ## Limitations | |
| It continues text in the style of educational web pages. Given a story opening, it often | |
| drifts into encyclopedic prose. It repeats itself at times, and its facts are unreliable. | |
| English only, with no safety tuning. | |
| ## Data and license | |
| [`HuggingFaceFW/fineweb-edu`](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu), | |
| ODC-By 1.0, plus the Common Crawl terms of use. The weights are released under Apache-2.0. | |