Instructions to use etanlightstone/simple-lm-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use etanlightstone/simple-lm-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="etanlightstone/simple-lm-v2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("etanlightstone/simple-lm-v2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use etanlightstone/simple-lm-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "etanlightstone/simple-lm-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "etanlightstone/simple-lm-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/etanlightstone/simple-lm-v2
- SGLang
How to use etanlightstone/simple-lm-v2 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 "etanlightstone/simple-lm-v2" \ --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": "etanlightstone/simple-lm-v2", "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 "etanlightstone/simple-lm-v2" \ --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": "etanlightstone/simple-lm-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use etanlightstone/simple-lm-v2 with Docker Model Runner:
docker model run hf.co/etanlightstone/simple-lm-v2
SimpleLM
Custom decoder-only Transformer language model (pretraining checkpoint).
Architecture is defined in modeling_simple_lm.py (bundled in this repo)
and loaded via trust_remote_code=True.
Source checkpoint: checkpoints/lm_checkpoint_008_shutdown.pt
This model is a pre-trained only LLM that was trained from scratch on a very small dataset of conversations (found on Kaggle and mixed with OpenAssistant/oasst2). As well as as subset of Finweb_Edu data. This particular save is checkpoint after 1 full epoch. Alltogether about 410M tokens (1B+ would have been more ideal for a model this size).
Architecture
| field | value |
|---|---|
| vocab_size | 32000 |
| context_length | 512 |
| d_model | 768 |
| n_layers | 12 |
| n_heads | 8 |
| d_ff | 2048 |
| activation | gelu |
| bias | True |
| tie_word_embeddings | True |
Tokenizer source: TinyLlama/TinyLlama-1.1B-Chat-v1.0
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "etanlightstone/simple-lm-v2"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True)
prompt = "Once upon a time"
ids = tok(prompt, return_tensors="pt").input_ids
out = model.generate(ids, max_new_tokens=80, do_sample=True, top_k=50, temperature=0.9)
print(tok.decode(out[0], skip_special_tokens=True))
Training settings
{
"batch_size": 10,
"batch_size_note": "per GPU when using torchrun",
"world_size": 1,
"learning_rate": 0.0003,
"weight_decay": 0.01,
"num_epochs": 3,
"max_steps": null,
"grad_clip": 1.0,
"seed": 42,
"docs_dir": "/home/etan/simple_llm/docs",
"block_size": 512,
"stride": 448,
"stride_overlap_tokens": 64
}
- Downloads last month
- 43