Instructions to use PDG/distilgpt2_finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PDG/distilgpt2_finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PDG/distilgpt2_finetuned")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PDG/distilgpt2_finetuned") model = AutoModelForCausalLM.from_pretrained("PDG/distilgpt2_finetuned") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PDG/distilgpt2_finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PDG/distilgpt2_finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PDG/distilgpt2_finetuned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/PDG/distilgpt2_finetuned
- SGLang
How to use PDG/distilgpt2_finetuned 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 "PDG/distilgpt2_finetuned" \ --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": "PDG/distilgpt2_finetuned", "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 "PDG/distilgpt2_finetuned" \ --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": "PDG/distilgpt2_finetuned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use PDG/distilgpt2_finetuned with Docker Model Runner:
docker model run hf.co/PDG/distilgpt2_finetuned
Upload tokenizer
Browse files- tokenizer_config.json +1 -2
tokenizer_config.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
| 9 |
"rstrip": false,
|
| 10 |
"single_word": false
|
| 11 |
},
|
|
|
|
| 12 |
"eos_token": {
|
| 13 |
"__type": "AddedToken",
|
| 14 |
"content": "<|endoftext|>",
|
|
@@ -19,9 +20,7 @@
|
|
| 19 |
},
|
| 20 |
"errors": "replace",
|
| 21 |
"model_max_length": 1024,
|
| 22 |
-
"name_or_path": "distilgpt2",
|
| 23 |
"pad_token": null,
|
| 24 |
-
"special_tokens_map_file": null,
|
| 25 |
"tokenizer_class": "GPT2Tokenizer",
|
| 26 |
"unk_token": {
|
| 27 |
"__type": "AddedToken",
|
|
|
|
| 9 |
"rstrip": false,
|
| 10 |
"single_word": false
|
| 11 |
},
|
| 12 |
+
"clean_up_tokenization_spaces": true,
|
| 13 |
"eos_token": {
|
| 14 |
"__type": "AddedToken",
|
| 15 |
"content": "<|endoftext|>",
|
|
|
|
| 20 |
},
|
| 21 |
"errors": "replace",
|
| 22 |
"model_max_length": 1024,
|
|
|
|
| 23 |
"pad_token": null,
|
|
|
|
| 24 |
"tokenizer_class": "GPT2Tokenizer",
|
| 25 |
"unk_token": {
|
| 26 |
"__type": "AddedToken",
|