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
Compiled (not trained) 91M-param Llama autocomplete model, TypeScript runtime and UI, docs
ab4f92b verified Download autocomplete.ts from tmickleydoyle/tiny-autocomplete: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/tmickleydoyle/tiny-autocomplete/resolve/main/autocomplete.ts
- Command line
-
hf download hf://tmickleydoyle/tiny-autocomplete/autocomplete.ts
-
curl -L -o autocomplete.ts https://huggingface.co/tmickleydoyle/tiny-autocomplete/resolve/main/autocomplete.ts
1.47 kB
| // Command-line autocomplete tester (zero dependencies). | |
| // | |
| // bun autocomplete.ts interactive prompt | |
| // bun autocomplete.ts "once upon a" complete one or more prompts | |
| // bun autocomplete.ts --json "how are" machine-readable output (used by tests) | |
| // | |
| // Also runs on Node >= 23.6 (`node autocomplete.ts`). For a browser UI see ui.ts. | |
| import { createInterface } from "node:readline"; | |
| import { Autocompleter } from "./model.ts"; | |
| const DIR = import.meta.dirname ?? new URL(".", import.meta.url).pathname; | |
| const ac = new Autocompleter(DIR); | |
| function show(prompt: string): void { | |
| const t0 = performance.now(); | |
| const r = ac.complete(prompt); | |
| const ms = Math.round(performance.now() - t0); | |
| console.log(`${prompt}\x1b[36m${r.completion}\x1b[0m (${ms} ms)`); | |
| console.log(" next: " + r.top.map((t) => `${JSON.stringify(t.token)} ${(Math.exp(t.logprob) * 100).toFixed(1)}%`).join(" ")); | |
| } | |
| const args = process.argv.slice(2); | |
| if (args[0] === "--json") { | |
| console.log(JSON.stringify(args.slice(1).map((p) => ac.complete(p)))); | |
| } else if (args.length) { | |
| args.forEach(show); | |
| } else { | |
| const cfg = ac.model.cfg; | |
| console.log(`Loaded ${cfg.num_hidden_layers}-layer model, vocab ${cfg.vocab_size}. Type a prefix (Ctrl+D to quit).`); | |
| const rl = createInterface({ input: process.stdin, output: process.stdout, prompt: "> " }); | |
| rl.prompt(); | |
| rl.on("line", (line) => { | |
| if (line.trim()) show(line); | |
| rl.prompt(); | |
| }); | |
| } | |