meta-llama/Meta-Llama-3.1-8B-Instruct that is packaged as a Hugging Face Inference Endpoint with a custom handler. The weights are not stored in this repo — the handler downloads them from the gated base repo at startup using an HF_TOKEN secret.handler.py — defines EndpointHandler. On __init__ it loads the tokenizer and model from meta-llama/Meta-Llama-3.1-8B-Instruct in bfloat16 with device_map="auto". On every request, __call__ applies the Llama 3.1 chat template and runs model.generate.requirements.txt — pins transformers==4.51.3 (the Hugging Face Inference Toolkit breaks against transformers 5.x because it imports helpers from transformers.file_utils) and adds accelerate + huggingface_hub.read permission on gated repos.| Setting | Recommended value |
|---|---|
| Instance type | GPU, at least 24 GB VRAM (e.g. NVIDIA L4, A10G, or A100) — Llama 3.1 8B in bfloat16 is ~16 GB plus KV cache |
| Container | Default (huggingface-inference-toolkit) |
| Task | Custom (the handler is auto-detected via handler.py) |
| Secret | HF_TOKEN = your user access token |
1curl https://<your-endpoint>.endpoints.huggingface.cloud \
2 -H "Authorization: Bearer $HF_TOKEN" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "inputs": {
6 "messages": [
7 {"role": "system", "content": "You are a helpful assistant."},
8 {"role": "user", "content": "In one sentence, what is Hugging Face?"}
9 ]
10 },
11 "parameters": {
12 "max_new_tokens": 128,
13 "do_sample": true,
14 "temperature": 0.7,
15 "top_p": 0.9
16 }
17 }'{ "generated_text": "Hugging Face is ..." }{"messages": [...]} and {"inputs": {"messages": [...]}} at the top level.| Field | Type | Default | Notes |
|---|---|---|---|
messages | list[{role, content}] | required | Standard chat format; role ∈ system / user / assistant / tool |
parameters.max_new_tokens | int | 256 | |
parameters.do_sample | bool | false | When false, temperature/top_p are ignored |
parameters.temperature | float | 0.7 | Only used when do_sample=true |
parameters.top_p | float | 0.9 | Only used when do_sample=true |
generated_text; it does not stream tokens and does not implement the OpenAI chat-completion schema.