Text Generation
Transformers
PyTorch
Graphcore
gpt2
Generated from Trainer
text-generation-inference
Instructions to use graphcore-rahult/gpt2-wikitext2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use graphcore-rahult/gpt2-wikitext2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="graphcore-rahult/gpt2-wikitext2")# Load model directly from transformers import AutoTokenizer, AutoModelWithLMHead tokenizer = AutoTokenizer.from_pretrained("graphcore-rahult/gpt2-wikitext2") model = AutoModelWithLMHead.from_pretrained("graphcore-rahult/gpt2-wikitext2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use graphcore-rahult/gpt2-wikitext2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "graphcore-rahult/gpt2-wikitext2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "graphcore-rahult/gpt2-wikitext2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/graphcore-rahult/gpt2-wikitext2
- SGLang
How to use graphcore-rahult/gpt2-wikitext2 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 "graphcore-rahult/gpt2-wikitext2" \ --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": "graphcore-rahult/gpt2-wikitext2", "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 "graphcore-rahult/gpt2-wikitext2" \ --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": "graphcore-rahult/gpt2-wikitext2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use graphcore-rahult/gpt2-wikitext2 with Docker Model Runner:
docker model run hf.co/graphcore-rahult/gpt2-wikitext2
Commit ·
8403bc3
1
Parent(s): a724ae2
Training in progress, step 500
Browse files- config.json +1 -1
- ipu_config.json +3 -3
- pytorch_model.bin +1 -1
- training_args.bin +1 -1
config.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
"_name_or_path": "gpt2",
|
| 3 |
"activation_function": "gelu",
|
| 4 |
"architectures": [
|
| 5 |
-
"
|
| 6 |
],
|
| 7 |
"attn_pdrop": 0.1,
|
| 8 |
"bos_token_id": 50256,
|
|
|
|
| 2 |
"_name_or_path": "gpt2",
|
| 3 |
"activation_function": "gelu",
|
| 4 |
"architectures": [
|
| 5 |
+
"PoptorchPipelinedGPT2LMHeadModel"
|
| 6 |
],
|
| 7 |
"attn_pdrop": 0.1,
|
| 8 |
"bos_token_id": 50256,
|
ipu_config.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
"execute_encoder_on_cpu_for_generation": false,
|
| 8 |
"gradient_accumulation_steps": 64,
|
| 9 |
"inference_device_iterations": 5,
|
| 10 |
-
"inference_replication_factor":
|
| 11 |
"ipus_per_replica": 4,
|
| 12 |
"layers_per_ipu": [
|
| 13 |
0,
|
|
@@ -20,8 +20,8 @@
|
|
| 20 |
"optimum_version": "1.5.1",
|
| 21 |
"output_mode": "final",
|
| 22 |
"recompute_checkpoint_every_layer": true,
|
| 23 |
-
"replicated_tensor_sharding":
|
| 24 |
-
"replication_factor":
|
| 25 |
"seed": 42,
|
| 26 |
"sharded_execution_for_inference": false,
|
| 27 |
"transformers_version": "4.20.1"
|
|
|
|
| 7 |
"execute_encoder_on_cpu_for_generation": false,
|
| 8 |
"gradient_accumulation_steps": 64,
|
| 9 |
"inference_device_iterations": 5,
|
| 10 |
+
"inference_replication_factor": 1,
|
| 11 |
"ipus_per_replica": 4,
|
| 12 |
"layers_per_ipu": [
|
| 13 |
0,
|
|
|
|
| 20 |
"optimum_version": "1.5.1",
|
| 21 |
"output_mode": "final",
|
| 22 |
"recompute_checkpoint_every_layer": true,
|
| 23 |
+
"replicated_tensor_sharding": false,
|
| 24 |
+
"replication_factor": 1,
|
| 25 |
"seed": 42,
|
| 26 |
"sharded_execution_for_inference": false,
|
| 27 |
"transformers_version": "4.20.1"
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 261514473
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e70c1ea321b105434650988294a0d038f373574156c0036a3a1b263fac473a51
|
| 3 |
size 261514473
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2735
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4869f5fe88dbf550509285ebaef436d3fe02346852a455707d5b9ba2730fc64d
|
| 3 |
size 2735
|