Instructions to use Nbeau/GPT2-arithmetic-3digits with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nbeau/GPT2-arithmetic-3digits with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nbeau/GPT2-arithmetic-3digits")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nbeau/GPT2-arithmetic-3digits") model = AutoModelForCausalLM.from_pretrained("Nbeau/GPT2-arithmetic-3digits") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Nbeau/GPT2-arithmetic-3digits with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nbeau/GPT2-arithmetic-3digits" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nbeau/GPT2-arithmetic-3digits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Nbeau/GPT2-arithmetic-3digits
- SGLang
How to use Nbeau/GPT2-arithmetic-3digits 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 "Nbeau/GPT2-arithmetic-3digits" \ --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": "Nbeau/GPT2-arithmetic-3digits", "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 "Nbeau/GPT2-arithmetic-3digits" \ --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": "Nbeau/GPT2-arithmetic-3digits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Nbeau/GPT2-arithmetic-3digits with Docker Model Runner:
docker model run hf.co/Nbeau/GPT2-arithmetic-3digits
Training in progress, step 500
Browse files- README.md +1 -9
- config.json +1 -1
- model.safetensors +1 -1
- training_args.bin +1 -1
README.md
CHANGED
|
@@ -6,14 +6,6 @@ tags:
|
|
| 6 |
model-index:
|
| 7 |
- name: GPT2-arithmetic-3digits
|
| 8 |
results: []
|
| 9 |
-
datasets:
|
| 10 |
-
- Nbeau/additiondataset_3digits_10000examples
|
| 11 |
-
widget:
|
| 12 |
-
- text: "Input:\n561+372\nTarget:"
|
| 13 |
-
inference:
|
| 14 |
-
parameters:
|
| 15 |
-
add_special_tokens: True
|
| 16 |
-
do_sample: False
|
| 17 |
---
|
| 18 |
|
| 19 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
|
@@ -69,4 +61,4 @@ The following hyperparameters were used during training:
|
|
| 69 |
- Transformers 4.40.2
|
| 70 |
- Pytorch 2.3.0
|
| 71 |
- Datasets 2.19.1
|
| 72 |
-
- Tokenizers 0.19.1
|
|
|
|
| 6 |
model-index:
|
| 7 |
- name: GPT2-arithmetic-3digits
|
| 8 |
results: []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
|
|
|
| 61 |
- Transformers 4.40.2
|
| 62 |
- Pytorch 2.3.0
|
| 63 |
- Datasets 2.19.1
|
| 64 |
+
- Tokenizers 0.19.1
|
config.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
| 17 |
"n_inner": null,
|
| 18 |
"n_layer": 12,
|
| 19 |
"n_positions": 1024,
|
| 20 |
-
"pad_token_id":
|
| 21 |
"reorder_and_upcast_attn": false,
|
| 22 |
"resid_pdrop": 0.1,
|
| 23 |
"scale_attn_by_inverse_layer_idx": false,
|
|
|
|
| 17 |
"n_inner": null,
|
| 18 |
"n_layer": 12,
|
| 19 |
"n_positions": 1024,
|
| 20 |
+
"pad_token_id": 32000,
|
| 21 |
"reorder_and_upcast_attn": false,
|
| 22 |
"resid_pdrop": 0.1,
|
| 23 |
"scale_attn_by_inverse_layer_idx": false,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 441691776
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:559704e9da8d819c84387e547a1e42ee323924e58074bb0600c77ae442cec227
|
| 3 |
size 441691776
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5048
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1267483ff059ea879b3a0ea0f4a5afb8cff43a998d3030d4f8be0527a68d0f01
|
| 3 |
size 5048
|