Text Generation
Transformers
Safetensors
gpt2
causal-lm
from-scratch
reuters
text-generation-inference
Instructions to use MeshMax/gpt2-reuters with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MeshMax/gpt2-reuters with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MeshMax/gpt2-reuters")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MeshMax/gpt2-reuters") model = AutoModelForCausalLM.from_pretrained("MeshMax/gpt2-reuters", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MeshMax/gpt2-reuters with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MeshMax/gpt2-reuters" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MeshMax/gpt2-reuters", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MeshMax/gpt2-reuters
- SGLang
How to use MeshMax/gpt2-reuters 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 "MeshMax/gpt2-reuters" \ --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": "MeshMax/gpt2-reuters", "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 "MeshMax/gpt2-reuters" \ --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": "MeshMax/gpt2-reuters", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MeshMax/gpt2-reuters with Docker Model Runner:
docker model run hf.co/MeshMax/gpt2-reuters
File size: 629 Bytes
e78df90 | 1 2 3 4 5 6 7 8 9 10 11 | eval_loss,eval_runtime,eval_samples_per_second,eval_steps_per_second,epoch,step
6.383346080780029,4.5791,345.268,10.919,0.2493150684931507,91
5.781818389892578,4.6373,340.93,10.782,0.4986301369863014,182
5.520852565765381,4.4987,351.434,11.114,0.7479452054794521,273
5.308560371398926,4.5251,349.384,11.049,0.9972602739726028,364
5.186249256134033,4.5899,344.45,10.893,1.2465753424657535,455
5.112856388092041,4.5503,347.448,10.988,1.4958904109589042,546
5.076841831207275,4.5325,348.816,11.031,1.7452054794520548,637
5.069819450378418,4.5509,347.401,10.987,1.9945205479452055,728
5.069815158843994,4.5542,347.153,10.979,2.0,730
|