Instructions to use miguelvictor/python-fromzero-gpt2-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use miguelvictor/python-fromzero-gpt2-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="miguelvictor/python-fromzero-gpt2-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("miguelvictor/python-fromzero-gpt2-base") model = AutoModelForCausalLM.from_pretrained("miguelvictor/python-fromzero-gpt2-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use miguelvictor/python-fromzero-gpt2-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "miguelvictor/python-fromzero-gpt2-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "miguelvictor/python-fromzero-gpt2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/miguelvictor/python-fromzero-gpt2-base
- SGLang
How to use miguelvictor/python-fromzero-gpt2-base 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 "miguelvictor/python-fromzero-gpt2-base" \ --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": "miguelvictor/python-fromzero-gpt2-base", "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 "miguelvictor/python-fromzero-gpt2-base" \ --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": "miguelvictor/python-fromzero-gpt2-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use miguelvictor/python-fromzero-gpt2-base with Docker Model Runner:
docker model run hf.co/miguelvictor/python-fromzero-gpt2-base
Commit ·
bdaa9c8
1
Parent(s): c8abba5
update confgi
Browse files- config.json +2 -7
config.json
CHANGED
|
@@ -1,20 +1,16 @@
|
|
| 1 |
{
|
| 2 |
"activation_function": "gelu_new",
|
| 3 |
-
"architectures": [
|
| 4 |
-
"GPT2LMHeadModel"
|
| 5 |
-
],
|
| 6 |
"attn_pdrop": 0.1,
|
| 7 |
"bos_token_id": 2,
|
| 8 |
"embd_pdrop": 0.1,
|
| 9 |
"eos_token_id": 3,
|
| 10 |
-
"gradient_checkpointing": true,
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
-
"layer_norm_epsilon": 1e-
|
| 13 |
"model_type": "gpt2",
|
| 14 |
"n_ctx": 1024,
|
| 15 |
"n_embd": 768,
|
| 16 |
"n_head": 12,
|
| 17 |
-
"n_inner": null,
|
| 18 |
"n_layer": 12,
|
| 19 |
"n_positions": 512,
|
| 20 |
"pad_token_id": 0,
|
|
@@ -26,6 +22,5 @@
|
|
| 26 |
"summary_use_proj": true,
|
| 27 |
"tokenizer": "default",
|
| 28 |
"transformers_version": "4.5.1",
|
| 29 |
-
"use_cache": false,
|
| 30 |
"vocab_size": 16000
|
| 31 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"activation_function": "gelu_new",
|
| 3 |
+
"architectures": ["GPT2LMHeadModel"],
|
|
|
|
|
|
|
| 4 |
"attn_pdrop": 0.1,
|
| 5 |
"bos_token_id": 2,
|
| 6 |
"embd_pdrop": 0.1,
|
| 7 |
"eos_token_id": 3,
|
|
|
|
| 8 |
"initializer_range": 0.02,
|
| 9 |
+
"layer_norm_epsilon": 1e-5,
|
| 10 |
"model_type": "gpt2",
|
| 11 |
"n_ctx": 1024,
|
| 12 |
"n_embd": 768,
|
| 13 |
"n_head": 12,
|
|
|
|
| 14 |
"n_layer": 12,
|
| 15 |
"n_positions": 512,
|
| 16 |
"pad_token_id": 0,
|
|
|
|
| 22 |
"summary_use_proj": true,
|
| 23 |
"tokenizer": "default",
|
| 24 |
"transformers_version": "4.5.1",
|
|
|
|
| 25 |
"vocab_size": 16000
|
| 26 |
}
|