Text Generation
Transformers
Safetensors
PyTorch
tiny_shakespeare
causal-lm
shakespeare
educational
custom_code
Instructions to use aaronmac/tiny-shakespeare-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aaronmac/tiny-shakespeare-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aaronmac/tiny-shakespeare-2", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("aaronmac/tiny-shakespeare-2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aaronmac/tiny-shakespeare-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aaronmac/tiny-shakespeare-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aaronmac/tiny-shakespeare-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/aaronmac/tiny-shakespeare-2
- SGLang
How to use aaronmac/tiny-shakespeare-2 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 "aaronmac/tiny-shakespeare-2" \ --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": "aaronmac/tiny-shakespeare-2", "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 "aaronmac/tiny-shakespeare-2" \ --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": "aaronmac/tiny-shakespeare-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use aaronmac/tiny-shakespeare-2 with Docker Model Runner:
docker model run hf.co/aaronmac/tiny-shakespeare-2
Download tokenizer.json from aaronmac/tiny-shakespeare-2: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/aaronmac/tiny-shakespeare-2/resolve/main/tokenizer.json
- Command line
-
hf download hf://aaronmac/tiny-shakespeare-2/tokenizer.json
-
curl -L -o tokenizer.json https://huggingface.co/aaronmac/tiny-shakespeare-2/resolve/main/tokenizer.json
2.44 kB
| { | |
| "chars": [ | |
| "\n", | |
| " ", | |
| "!", | |
| "$", | |
| "&", | |
| "'", | |
| ",", | |
| "-", | |
| ".", | |
| "3", | |
| ":", | |
| ";", | |
| "?", | |
| "A", | |
| "B", | |
| "C", | |
| "D", | |
| "E", | |
| "F", | |
| "G", | |
| "H", | |
| "I", | |
| "J", | |
| "K", | |
| "L", | |
| "M", | |
| "N", | |
| "O", | |
| "P", | |
| "Q", | |
| "R", | |
| "S", | |
| "T", | |
| "U", | |
| "V", | |
| "W", | |
| "X", | |
| "Y", | |
| "Z", | |
| "a", | |
| "b", | |
| "c", | |
| "d", | |
| "e", | |
| "f", | |
| "g", | |
| "h", | |
| "i", | |
| "j", | |
| "k", | |
| "l", | |
| "m", | |
| "n", | |
| "o", | |
| "p", | |
| "q", | |
| "r", | |
| "s", | |
| "t", | |
| "u", | |
| "v", | |
| "w", | |
| "x", | |
| "y", | |
| "z" | |
| ], | |
| "stoi": { | |
| "\n": 0, | |
| " ": 1, | |
| "!": 2, | |
| "$": 3, | |
| "&": 4, | |
| "'": 5, | |
| ",": 6, | |
| "-": 7, | |
| ".": 8, | |
| "3": 9, | |
| ":": 10, | |
| ";": 11, | |
| "?": 12, | |
| "A": 13, | |
| "B": 14, | |
| "C": 15, | |
| "D": 16, | |
| "E": 17, | |
| "F": 18, | |
| "G": 19, | |
| "H": 20, | |
| "I": 21, | |
| "J": 22, | |
| "K": 23, | |
| "L": 24, | |
| "M": 25, | |
| "N": 26, | |
| "O": 27, | |
| "P": 28, | |
| "Q": 29, | |
| "R": 30, | |
| "S": 31, | |
| "T": 32, | |
| "U": 33, | |
| "V": 34, | |
| "W": 35, | |
| "X": 36, | |
| "Y": 37, | |
| "Z": 38, | |
| "a": 39, | |
| "b": 40, | |
| "c": 41, | |
| "d": 42, | |
| "e": 43, | |
| "f": 44, | |
| "g": 45, | |
| "h": 46, | |
| "i": 47, | |
| "j": 48, | |
| "k": 49, | |
| "l": 50, | |
| "m": 51, | |
| "n": 52, | |
| "o": 53, | |
| "p": 54, | |
| "q": 55, | |
| "r": 56, | |
| "s": 57, | |
| "t": 58, | |
| "u": 59, | |
| "v": 60, | |
| "w": 61, | |
| "x": 62, | |
| "y": 63, | |
| "z": 64 | |
| }, | |
| "itos": { | |
| "0": "\n", | |
| "1": " ", | |
| "2": "!", | |
| "3": "$", | |
| "4": "&", | |
| "5": "'", | |
| "6": ",", | |
| "7": "-", | |
| "8": ".", | |
| "9": "3", | |
| "10": ":", | |
| "11": ";", | |
| "12": "?", | |
| "13": "A", | |
| "14": "B", | |
| "15": "C", | |
| "16": "D", | |
| "17": "E", | |
| "18": "F", | |
| "19": "G", | |
| "20": "H", | |
| "21": "I", | |
| "22": "J", | |
| "23": "K", | |
| "24": "L", | |
| "25": "M", | |
| "26": "N", | |
| "27": "O", | |
| "28": "P", | |
| "29": "Q", | |
| "30": "R", | |
| "31": "S", | |
| "32": "T", | |
| "33": "U", | |
| "34": "V", | |
| "35": "W", | |
| "36": "X", | |
| "37": "Y", | |
| "38": "Z", | |
| "39": "a", | |
| "40": "b", | |
| "41": "c", | |
| "42": "d", | |
| "43": "e", | |
| "44": "f", | |
| "45": "g", | |
| "46": "h", | |
| "47": "i", | |
| "48": "j", | |
| "49": "k", | |
| "50": "l", | |
| "51": "m", | |
| "52": "n", | |
| "53": "o", | |
| "54": "p", | |
| "55": "q", | |
| "56": "r", | |
| "57": "s", | |
| "58": "t", | |
| "59": "u", | |
| "60": "v", | |
| "61": "w", | |
| "62": "x", | |
| "63": "y", | |
| "64": "z" | |
| } | |
| } |