Fraser/short-jokes
Updated • 216 • 11
How to use AlekseyKorshuk/gpt2-jokes with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="AlekseyKorshuk/gpt2-jokes") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("AlekseyKorshuk/gpt2-jokes")
model = AutoModelForCausalLM.from_pretrained("AlekseyKorshuk/gpt2-jokes")How to use AlekseyKorshuk/gpt2-jokes with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "AlekseyKorshuk/gpt2-jokes"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "AlekseyKorshuk/gpt2-jokes",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/AlekseyKorshuk/gpt2-jokes
How to use AlekseyKorshuk/gpt2-jokes with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "AlekseyKorshuk/gpt2-jokes" \
--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": "AlekseyKorshuk/gpt2-jokes",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "AlekseyKorshuk/gpt2-jokes" \
--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": "AlekseyKorshuk/gpt2-jokes",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use AlekseyKorshuk/gpt2-jokes with Docker Model Runner:
docker model run hf.co/AlekseyKorshuk/gpt2-jokes
This model is a fine-tuned version of gpt2 on the Fraser/short-jokes dataset. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| No log | 0.06 | 100 | 0.7285 | 0.8732 |
| No log | 0.12 | 200 | 0.7141 | 0.8747 |
| No log | 0.17 | 300 | 0.7056 | 0.8757 |
| No log | 0.23 | 400 | 0.6992 | 0.8764 |
| 0.7907 | 0.29 | 500 | 0.6942 | 0.8771 |
| 0.7907 | 0.35 | 600 | 0.6906 | 0.8777 |
| 0.7907 | 0.41 | 700 | 0.6873 | 0.8779 |
| 0.7907 | 0.47 | 800 | 0.6848 | 0.8782 |
| 0.7907 | 0.52 | 900 | 0.6830 | 0.8786 |
| 0.7105 | 0.58 | 1000 | 0.6809 | 0.8788 |
| 0.7105 | 0.64 | 1100 | 0.6794 | 0.8790 |
| 0.7105 | 0.7 | 1200 | 0.6780 | 0.8792 |
| 0.7105 | 0.76 | 1300 | 0.6770 | 0.8793 |
| 0.7105 | 0.81 | 1400 | 0.6760 | 0.8794 |
| 0.7034 | 0.87 | 1500 | 0.6755 | 0.8794 |
| 0.7034 | 0.93 | 1600 | 0.6750 | 0.8795 |
| 0.7034 | 0.99 | 1700 | 0.6748 | 0.8795 |