Text Generation
Transformers
Safetensors
English
llama
hand-crafted
compiled
autocomplete
no-training
n-gram
code
browser
text-generation-inference
Instructions to use tmickleydoyle/tiny-autocomplete with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tmickleydoyle/tiny-autocomplete with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tmickleydoyle/tiny-autocomplete")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tmickleydoyle/tiny-autocomplete") model = AutoModelForCausalLM.from_pretrained("tmickleydoyle/tiny-autocomplete", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tmickleydoyle/tiny-autocomplete with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tmickleydoyle/tiny-autocomplete" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tmickleydoyle/tiny-autocomplete", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tmickleydoyle/tiny-autocomplete
- SGLang
How to use tmickleydoyle/tiny-autocomplete 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 "tmickleydoyle/tiny-autocomplete" \ --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": "tmickleydoyle/tiny-autocomplete", "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 "tmickleydoyle/tiny-autocomplete" \ --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": "tmickleydoyle/tiny-autocomplete", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tmickleydoyle/tiny-autocomplete with Docker Model Runner:
docker model run hf.co/tmickleydoyle/tiny-autocomplete
Confidence-gated ghost text for coding prompts: Kneser-Ney compile, 4.5 MB browser export + zero-dep runtime, held-out precision/keystrokes-saved benchmarks
4113449 verified Download web/cli.ts from tmickleydoyle/tiny-autocomplete: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/tmickleydoyle/tiny-autocomplete/resolve/main/web/cli.ts
- Command line
-
hf download hf://tmickleydoyle/tiny-autocomplete/web/cli.ts
-
curl -L -o cli.ts https://huggingface.co/tmickleydoyle/tiny-autocomplete/resolve/main/web/cli.ts
1.92 kB
| // Run the browser runtime from the command line (Bun or Node >= 23.6): | |
| // bun web/cli.ts "write a python fun" "how do i " | |
| // bun web/cli.ts --json ... full suggestion chains (used by test_model.py) | |
| // bun web/cli.ts --dist ... top-5 next-token log-probs after each text | |
| // bun web/cli.ts --model path/to/model.bin use another export (default web/model.bin) | |
| import { readFileSync } from "node:fs"; | |
| import { join } from "node:path"; | |
| import { preTokenize } from "../tokenizer.ts"; | |
| import { CompiledAutocomplete } from "./autocomplete.ts"; | |
| const dir = import.meta.dirname ?? new URL(".", import.meta.url).pathname; | |
| let args = process.argv.slice(2); | |
| let modelPath = join(dir, "model.bin"); | |
| const mi = args.indexOf("--model"); | |
| if (mi >= 0) { | |
| modelPath = args[mi + 1]; | |
| args = [...args.slice(0, mi), ...args.slice(mi + 2)]; | |
| } | |
| const mode = args[0] === "--json" || args[0] === "--dist" ? args.shift() : ""; | |
| const buf = readFileSync(modelPath); | |
| const ac = new CompiledAutocomplete(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)); | |
| if (mode === "--dist") { | |
| const out = args.map((t) => { | |
| const ids = [ac.eosId, ...preTokenize(t).map((p) => ac.vocab.indexOf(p)).map((i) => (i < 0 ? ac.unkId : i))]; | |
| const { probs } = ac.dist(ids); | |
| const top = [...probs.keys()].sort((a, b) => probs[b] - probs[a]).slice(0, 5); | |
| return { text: t, top: top.map((i) => [i, Math.log(probs[i])]) }; | |
| }); | |
| console.log(JSON.stringify(out)); | |
| } else { | |
| const results = args.map((t) => { | |
| const start = performance.now(); | |
| const s = ac.suggest(t); | |
| return { text: t, ...s, ms: performance.now() - start }; | |
| }); | |
| if (mode === "--json") console.log(JSON.stringify(results)); | |
| else for (const r of results) console.log(`${r.text}\x1b[90m${r.ghost}\x1b[0m ${r.ghost ? Math.round(r.prob * 100) + "%" : "(no confident suggestion)"} ${r.ms.toFixed(2)} ms`); | |
| } | |