Instructions to use chirag2706/gpt2_code_generation_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chirag2706/gpt2_code_generation_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chirag2706/gpt2_code_generation_model")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("chirag2706/gpt2_code_generation_model") model = AutoModelForCausalLM.from_pretrained("chirag2706/gpt2_code_generation_model") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use chirag2706/gpt2_code_generation_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chirag2706/gpt2_code_generation_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chirag2706/gpt2_code_generation_model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/chirag2706/gpt2_code_generation_model
- SGLang
How to use chirag2706/gpt2_code_generation_model 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 "chirag2706/gpt2_code_generation_model" \ --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": "chirag2706/gpt2_code_generation_model", "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 "chirag2706/gpt2_code_generation_model" \ --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": "chirag2706/gpt2_code_generation_model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use chirag2706/gpt2_code_generation_model with Docker Model Runner:
docker model run hf.co/chirag2706/gpt2_code_generation_model
chirag2706 commited on
Commit ·
b4567c3
1
Parent(s): 5d5006f
gpt2 codegeneration model added
Browse files- added_tokens.json +1 -0
- config.json +33 -0
- gpt_sh_config.json +4 -0
- log.out +0 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
added_tokens.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"<pad>": 50257, "<python>": 50258, "<java>": 50259}
|
config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_new",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GPT2LMHeadModel"
|
| 5 |
+
],
|
| 6 |
+
"attn_pdrop": 0.1,
|
| 7 |
+
"bos_token_id": 50256,
|
| 8 |
+
"embd_pdrop": 0.1,
|
| 9 |
+
"eos_token_id": 50256,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"layer_norm_epsilon": 1e-05,
|
| 12 |
+
"model_type": "gpt2",
|
| 13 |
+
"n_ctx": 1024,
|
| 14 |
+
"n_embd": 1024,
|
| 15 |
+
"n_head": 16,
|
| 16 |
+
"n_layer": 24,
|
| 17 |
+
"n_positions": 1024,
|
| 18 |
+
"n_special": 0,
|
| 19 |
+
"predict_special_tokens": true,
|
| 20 |
+
"resid_pdrop": 0.1,
|
| 21 |
+
"summary_activation": null,
|
| 22 |
+
"summary_first_dropout": 0.1,
|
| 23 |
+
"summary_proj_to_labels": true,
|
| 24 |
+
"summary_type": "cls_index",
|
| 25 |
+
"summary_use_proj": true,
|
| 26 |
+
"task_specific_params": {
|
| 27 |
+
"text-generation": {
|
| 28 |
+
"do_sample": true,
|
| 29 |
+
"max_length": 50
|
| 30 |
+
}
|
| 31 |
+
},
|
| 32 |
+
"vocab_size": 50260
|
| 33 |
+
}
|
gpt_sh_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_seq_length": 256,
|
| 3 |
+
"do_lower_case": false
|
| 4 |
+
}
|
log.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:925fcaebc178dd6df1a0fc7bbf92a6a51a58fc36969bf1c0f5157eefed1e7eae
|
| 3 |
+
size 1444543733
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "unk_token": "<|endoftext|>", "pad_token": "<pad>", "additional_special_tokens": ["<python>", "<java>"]}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"do_lower_case": false, "model_max_length": 1024}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|