Instructions to use AlgorithmicResearchGroup/gpt2-xs with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AlgorithmicResearchGroup/gpt2-xs with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AlgorithmicResearchGroup/gpt2-xs")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AlgorithmicResearchGroup/gpt2-xs") model = AutoModelForCausalLM.from_pretrained("AlgorithmicResearchGroup/gpt2-xs") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use AlgorithmicResearchGroup/gpt2-xs with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AlgorithmicResearchGroup/gpt2-xs" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AlgorithmicResearchGroup/gpt2-xs", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AlgorithmicResearchGroup/gpt2-xs
- SGLang
How to use AlgorithmicResearchGroup/gpt2-xs 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 "AlgorithmicResearchGroup/gpt2-xs" \ --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": "AlgorithmicResearchGroup/gpt2-xs", "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 "AlgorithmicResearchGroup/gpt2-xs" \ --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": "AlgorithmicResearchGroup/gpt2-xs", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AlgorithmicResearchGroup/gpt2-xs with Docker Model Runner:
docker model run hf.co/AlgorithmicResearchGroup/gpt2-xs
Matthew Kenney commited on
Commit ·
4ef5385
1
Parent(s): 372598e
commit files to HF hub
Browse files- config.json +2 -2
- model.safetensors +2 -2
- tokenizer.json +2 -2
- tokenizer_config.json +1 -1
config.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "/content/
|
| 3 |
"activation_function": "gelu_new",
|
| 4 |
"architectures": [
|
| 5 |
"GPT2LMHeadModel"
|
|
@@ -16,7 +16,7 @@
|
|
| 16 |
"n_head": 6,
|
| 17 |
"n_inner": null,
|
| 18 |
"n_layer": 6,
|
| 19 |
-
"n_positions":
|
| 20 |
"reorder_and_upcast_attn": false,
|
| 21 |
"resid_pdrop": 0.1,
|
| 22 |
"scale_attn_by_inverse_layer_idx": false,
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "/content/vsmall_256_epoch_1e_3/checkpoint-420",
|
| 3 |
"activation_function": "gelu_new",
|
| 4 |
"architectures": [
|
| 5 |
"GPT2LMHeadModel"
|
|
|
|
| 16 |
"n_head": 6,
|
| 17 |
"n_inner": null,
|
| 18 |
"n_layer": 6,
|
| 19 |
+
"n_positions": 256,
|
| 20 |
"reorder_and_upcast_attn": false,
|
| 21 |
"resid_pdrop": 0.1,
|
| 22 |
"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
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d6f4326b673ed0ad7d96c5c40879e2af28d8a514650c14bf8d35280c46aa029
|
| 3 |
+
size 120185720
|
tokenizer.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
| 2 |
"version": "1.0",
|
| 3 |
"truncation": {
|
| 4 |
"direction": "Right",
|
| 5 |
-
"max_length":
|
| 6 |
"strategy": "LongestFirst",
|
| 7 |
"stride": 0
|
| 8 |
},
|
| 9 |
"padding": {
|
| 10 |
"strategy": {
|
| 11 |
-
"Fixed":
|
| 12 |
},
|
| 13 |
"direction": "Right",
|
| 14 |
"pad_to_multiple_of": null,
|
|
|
|
| 2 |
"version": "1.0",
|
| 3 |
"truncation": {
|
| 4 |
"direction": "Right",
|
| 5 |
+
"max_length": 256,
|
| 6 |
"strategy": "LongestFirst",
|
| 7 |
"stride": 0
|
| 8 |
},
|
| 9 |
"padding": {
|
| 10 |
"strategy": {
|
| 11 |
+
"Fixed": 256
|
| 12 |
},
|
| 13 |
"direction": "Right",
|
| 14 |
"pad_to_multiple_of": null,
|
tokenizer_config.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
"bos_token": "<|endoftext|>",
|
| 14 |
"clean_up_tokenization_spaces": true,
|
| 15 |
"eos_token": "<|endoftext|>",
|
| 16 |
-
"max_length":
|
| 17 |
"model_max_length": 1024,
|
| 18 |
"pad_to_multiple_of": null,
|
| 19 |
"pad_token": "<|endoftext|>",
|
|
|
|
| 13 |
"bos_token": "<|endoftext|>",
|
| 14 |
"clean_up_tokenization_spaces": true,
|
| 15 |
"eos_token": "<|endoftext|>",
|
| 16 |
+
"max_length": 256,
|
| 17 |
"model_max_length": 1024,
|
| 18 |
"pad_to_multiple_of": null,
|
| 19 |
"pad_token": "<|endoftext|>",
|