Text Generation
Transformers
PyTorch
TensorFlow
JAX
LiteRT
Rust
Safetensors
English
gpt2
exbert
text-generation-inference
Instructions to use Narsil/gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Narsil/gpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Narsil/gpt2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Narsil/gpt2") model = AutoModelForCausalLM.from_pretrained("Narsil/gpt2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Narsil/gpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Narsil/gpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Narsil/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Narsil/gpt2
- SGLang
How to use Narsil/gpt2 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 "Narsil/gpt2" \ --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": "Narsil/gpt2", "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 "Narsil/gpt2" \ --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": "Narsil/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Narsil/gpt2 with Docker Model Runner:
docker model run hf.co/Narsil/gpt2
Commit History
-
Adding `safetensors` variant of this model
This is an automated PR created with https://huggingface.co/spaces/safetensors/convert This new file is equivalent to `pytorch_model.bin` but safe in the sense that no arbitrary code can be put into it. These files also happen to load much faster than their pytorch counterpart: https://colab.research.google.com/github/huggingface/notebooks/blob/main/safetensors_doc/en/speed.ipynb The widgets on your model page will run using this model even if this is not merged making sure the file actually works. If you find any issues: please report here: https://huggingface.co/spaces/safetensors/convert/discussions Feel free to ignore this PR.51a8a24 -
Delete model.safetensors (#2)
- Delete model.safetensors (3736bca76234811ae002188a39eb446394742bbb) Co-authored-by: Safetensors convertbot <SFconvertbot@users.noreply.huggingface.co>e7425f6
-
Fixing format in metadata.
8fde3b8
-
New version of aligned.
5e48ea6
-
Upload model.safetensors
a76fa14
-
Adding `safetensors` variant of this model (#1)
- Adding `safetensors` variant of this model (79dac26c22203b167b49316b023326e619d66820)a7b2e12
-
Update README.md
dad46de
-
add gpt2
2746258
-
Migrate model card from transformers-repo
Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755 Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/gpt2-README.md3c76ef4
-
For clarity, delete deprecated modelcard.json
We now use the README.md model card instead Approved-by: Julien Chaumond <julien@huggingface.co>e7663de
-
Update tokenizer.json
2fade3d
-
Update config.json
9315fd0
-
Update rust_model.ot
4ef5eae -
Update config.json
a688a35
-
Update config.json
71d14e3
-
Update modelcard.json
9838ca0
-
Update 64-8bits.tflite
17c5f1a -
Update 64-fp16.tflite
a5adeda
-
Update 64.tflite
aaf3740
-
Update tf_model.h5
ec47380
-
Update config.json
a10f83b -
Update vocab.json
ff17349 -
Update merges.txt
19a2b59 -
Update pytorch_model.bin
dc79ed5
-
initial commit
b6ccfb8