Skylion007/openwebtext
Viewer • Updated • 8.01M • 66.3k • 511
How to use ragunath-ravi/Tensa-124M with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ragunath-ravi/Tensa-124M", trust_remote_code=True) # Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("ragunath-ravi/Tensa-124M", trust_remote_code=True, dtype="auto")How to use ragunath-ravi/Tensa-124M with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ragunath-ravi/Tensa-124M"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ragunath-ravi/Tensa-124M",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ragunath-ravi/Tensa-124M
How to use ragunath-ravi/Tensa-124M with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ragunath-ravi/Tensa-124M" \
--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": "ragunath-ravi/Tensa-124M",
"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 "ragunath-ravi/Tensa-124M" \
--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": "ragunath-ravi/Tensa-124M",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ragunath-ravi/Tensa-124M with Docker Model Runner:
docker model run hf.co/ragunath-ravi/Tensa-124M
Tensa-124M is a 124M parameter causal language model derived from GPT-2 architecture and modified with SwiGLU-style gated MLPs.
It was trained for 50,000 steps on OpenWebText and achieves a validation perplexity of ~23.
This model works with Hugging Face Transformers using a custom architecture.
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"ragunath-ravi/Tensa-124M",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("gpt2")
inputs = tokenizer("Once upon a time", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0]))