Instructions to use neulab/gpt2-large-finetuned-wikitext103 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use neulab/gpt2-large-finetuned-wikitext103 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="neulab/gpt2-large-finetuned-wikitext103")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("neulab/gpt2-large-finetuned-wikitext103") model = AutoModelForCausalLM.from_pretrained("neulab/gpt2-large-finetuned-wikitext103") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use neulab/gpt2-large-finetuned-wikitext103 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "neulab/gpt2-large-finetuned-wikitext103" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "neulab/gpt2-large-finetuned-wikitext103", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/neulab/gpt2-large-finetuned-wikitext103
- SGLang
How to use neulab/gpt2-large-finetuned-wikitext103 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 "neulab/gpt2-large-finetuned-wikitext103" \ --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": "neulab/gpt2-large-finetuned-wikitext103", "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 "neulab/gpt2-large-finetuned-wikitext103" \ --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": "neulab/gpt2-large-finetuned-wikitext103", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use neulab/gpt2-large-finetuned-wikitext103 with Docker Model Runner:
docker model run hf.co/neulab/gpt2-large-finetuned-wikitext103
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
This is a gpt2-large model, finetuned on the Wikitext-103 dataset.
It achieves a perplexity of 10.56 using a "sliding window" context, using the run_clm.py script at https://github.com/neulab/knn-transformers.
| Base LM: | distilgpt2 |
gpt2 |
|---|---|---|
| base perplexity | 18.25 | 14.84 |
| + kNN-LM | 15.03 | 12.57 |
| + RetoMaton | 14.70 | 12.46 |
This model was released as part of the paper "Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval" (ICML'2022).
For more information, see: https://github.com/neulab/knn-transformers
If you use this model, please cite:
@inproceedings{alon2022neuro,
title={Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval},
author={Alon, Uri and Xu, Frank and He, Junxian and Sengupta, Sudipta and Roth, Dan and Neubig, Graham},
booktitle={International Conference on Machine Learning},
pages={468--485},
year={2022},
organization={PMLR}
}
- Downloads last month
- 6