Instructions to use Masdfasdg/GPT2-Prompt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Masdfasdg/GPT2-Prompt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Masdfasdg/GPT2-Prompt")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Masdfasdg/GPT2-Prompt") model = AutoModelForCausalLM.from_pretrained("Masdfasdg/GPT2-Prompt", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Masdfasdg/GPT2-Prompt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Masdfasdg/GPT2-Prompt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Masdfasdg/GPT2-Prompt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Masdfasdg/GPT2-Prompt
- SGLang
How to use Masdfasdg/GPT2-Prompt 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 "Masdfasdg/GPT2-Prompt" \ --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": "Masdfasdg/GPT2-Prompt", "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 "Masdfasdg/GPT2-Prompt" \ --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": "Masdfasdg/GPT2-Prompt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Masdfasdg/GPT2-Prompt with Docker Model Runner:
docker model run hf.co/Masdfasdg/GPT2-Prompt
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
tags:
|
| 5 |
-
-
|
| 6 |
- text-generation
|
| 7 |
pipeline_tag: text-generation
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# GPT-2 Story Generator
|
|
@@ -16,7 +18,7 @@ Generate a short story from an input prompt.
|
|
| 16 |
Put the vocab ` [endprompt]` after your input.
|
| 17 |
|
| 18 |
Example of an input:
|
| 19 |
-
```
|
| 20 |
A person with a high school education gets sent back into the 1600s and tries to explain science and technology to the people. [endprompt]
|
| 21 |
```
|
| 22 |
|
|
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
tags:
|
| 5 |
+
- gpt2
|
| 6 |
- text-generation
|
| 7 |
pipeline_tag: text-generation
|
| 8 |
+
widget:
|
| 9 |
+
- text: "A person with a high school education gets sent back into the 1600s and tries to explain science and technology to the people. [endprompt]"
|
| 10 |
---
|
| 11 |
|
| 12 |
# GPT-2 Story Generator
|
|
|
|
| 18 |
Put the vocab ` [endprompt]` after your input.
|
| 19 |
|
| 20 |
Example of an input:
|
| 21 |
+
```
|
| 22 |
A person with a high school education gets sent back into the 1600s and tries to explain science and technology to the people. [endprompt]
|
| 23 |
```
|
| 24 |
|