jed351/cantonese-wikipedia
Viewer • Updated • 125k • 37 • 7
How to use jed351/gpt2_tiny_zh-hk-wiki with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="jed351/gpt2_tiny_zh-hk-wiki") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jed351/gpt2_tiny_zh-hk-wiki")
model = AutoModelForCausalLM.from_pretrained("jed351/gpt2_tiny_zh-hk-wiki")How to use jed351/gpt2_tiny_zh-hk-wiki with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "jed351/gpt2_tiny_zh-hk-wiki"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "jed351/gpt2_tiny_zh-hk-wiki",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/jed351/gpt2_tiny_zh-hk-wiki
How to use jed351/gpt2_tiny_zh-hk-wiki with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "jed351/gpt2_tiny_zh-hk-wiki" \
--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": "jed351/gpt2_tiny_zh-hk-wiki",
"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 "jed351/gpt2_tiny_zh-hk-wiki" \
--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": "jed351/gpt2_tiny_zh-hk-wiki",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use jed351/gpt2_tiny_zh-hk-wiki with Docker Model Runner:
docker model run hf.co/jed351/gpt2_tiny_zh-hk-wiki
This model was trained on a dataset with a 50MB size for 10 epochs only.
Purely intended for research and testing purposes.
This model is a fine-tuned version of jed351/gpt2-tiny-zh-hk on the cantonese-wikipedia 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 |
|---|---|---|---|
| No log | 1.0 | 412 | 3.6481 |
| 4.0728 | 2.0 | 824 | 3.5399 |
| 3.757 | 3.0 | 1236 | 3.4889 |
| 3.6669 | 4.0 | 1648 | 3.4557 |
| 3.6189 | 5.0 | 2060 | 3.4295 |
| 3.6189 | 6.0 | 2472 | 3.4129 |
| 3.5835 | 7.0 | 2884 | 3.3992 |
| 3.5604 | 8.0 | 3296 | 3.3905 |
| 3.5434 | 9.0 | 3708 | 3.3849 |
| 3.537 | 10.0 | 4120 | 3.3834 |