Trelis/tiny-shakespeare
Viewer • Updated • 521 • 3.21k • 10
How to use ahmadisakina/decoder-language-model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ahmadisakina/decoder-language-model") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("ahmadisakina/decoder-language-model", dtype="auto")How to use ahmadisakina/decoder-language-model with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ahmadisakina/decoder-language-model"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ahmadisakina/decoder-language-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ahmadisakina/decoder-language-model
How to use ahmadisakina/decoder-language-model with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ahmadisakina/decoder-language-model" \
--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": "ahmadisakina/decoder-language-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "ahmadisakina/decoder-language-model" \
--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": "ahmadisakina/decoder-language-model",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ahmadisakina/decoder-language-model with Docker Model Runner:
docker model run hf.co/ahmadisakina/decoder-language-model
Ein kleiner autoregressiver Decoder-only Transformer, trainiert auf Tiny Shakespeare.
from transformers import GPT2Tokenizer
import torch
from model import DecoderLanguageModel
tokenizer = GPT2Tokenizer.from_pretrained("ahmadisakina/decoder-language-model")
model = DecoderLanguageModel(vocab_size=tokenizer.vocab_size, d_model=128, nhead=4, num_layers=2)
model.load_state_dict(torch.load("pytorch_model.bin"))
model.eval()