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: 1,385 Bytes
5f441c7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | eval_loss,eval_runtime,eval_samples_per_second,eval_steps_per_second,epoch,step
6.657517910003662,4.293,368.271,11.647,0.2493150684931507,91
5.836120128631592,4.324,365.637,11.563,0.4986301369863014,182
5.53217077255249,4.3991,359.395,11.366,0.7479452054794521,273
5.285526752471924,4.5174,349.982,11.068,0.9972602739726028,364
5.1188273429870605,4.6368,340.965,10.783,1.2465753424657535,455
4.978555202484131,4.4968,351.581,11.119,1.4958904109589042,546
4.8664937019348145,4.5081,350.699,11.091,1.7452054794520548,637
4.780983924865723,4.5682,346.086,10.945,1.9945205479452055,728
4.709726333618164,4.5645,346.366,10.954,2.243835616438356,819
4.65047025680542,4.5319,348.859,11.033,2.493150684931507,910
4.5955963134765625,4.5233,349.527,11.054,2.7424657534246575,1001
4.541450023651123,4.5287,349.107,11.041,2.9917808219178084,1092
4.515059471130371,4.5251,349.388,11.05,3.241095890410959,1183
4.489952564239502,4.5573,346.918,10.971,3.4904109589041097,1274
4.460988521575928,4.551,347.394,10.987,3.73972602739726,1365
4.443852424621582,4.5121,350.393,11.081,3.989041095890411,1456
4.434432506561279,4.5377,348.412,11.019,4.238356164383561,1547
4.428253650665283,4.5335,348.739,11.029,4.487671232876712,1638
4.424798965454102,4.5364,348.515,11.022,4.736986301369863,1729
4.424537181854248,4.5484,347.598,10.993,4.986301369863014,1820
4.424535274505615,4.5386,348.345,11.017,5.0,1825
|