Instructions to use ahxt/LiteLlama-460M-1T with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ahxt/LiteLlama-460M-1T with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ahxt/LiteLlama-460M-1T")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ahxt/LiteLlama-460M-1T") model = AutoModelForCausalLM.from_pretrained("ahxt/LiteLlama-460M-1T") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ahxt/LiteLlama-460M-1T with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ahxt/LiteLlama-460M-1T" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahxt/LiteLlama-460M-1T", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ahxt/LiteLlama-460M-1T
- SGLang
How to use ahxt/LiteLlama-460M-1T 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 "ahxt/LiteLlama-460M-1T" \ --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": "ahxt/LiteLlama-460M-1T", "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 "ahxt/LiteLlama-460M-1T" \ --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": "ahxt/LiteLlama-460M-1T", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ahxt/LiteLlama-460M-1T with Docker Model Runner:
docker model run hf.co/ahxt/LiteLlama-460M-1T
EOS and PAD tokens
The special_tokens_map.json specifies the eos and pad tokens as # and " respectively, which seems like a weird choice.
{
"eos_token": "#",
"pad_token": "\"",
"unk_token": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
}
}
Is this correct? Has the model been trained on these token maps? Has the model seen the <|endoftext|> token during training?
I'm also seeing that, I don't know how that would affect the future, also I don't see a template
IME after finetuning it leads to model preferring single quotes instead of double quotes as it really confuses DataCollatorForLanguageModeling.
collator = DataCollatorForLanguageModeling(tokenizer, mlm=False)
features = tokenizer('I said "Hi"', return_tensors="pt")
collator([features])
produces
"{'input_ids': tensor([[[ 40, 531, 220, 1, 17250, 1]]]), 'attention_mask': tensor([[[1, 1, 1, 1, 1, 1]]]), 'labels': tensor([[[ 40, 531, 220, -100, 17250, -100]]])}"
the model never learns to output a single double quote.
also I don't see a template
It's not a chat model.
The
special_tokens_map.jsonspecifies theeosandpadtokens as#and"respectively, which seems like a weird choice.{ "eos_token": "#", "pad_token": "\"", "unk_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false } }Is this correct? Has the model been trained on these token maps? Has the model seen the
<|endoftext|>token during training?
I have the same question. It's very strange.