Instructions to use JerryQu/v2-distilgpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JerryQu/v2-distilgpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JerryQu/v2-distilgpt2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("JerryQu/v2-distilgpt2") model = AutoModelForCausalLM.from_pretrained("JerryQu/v2-distilgpt2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JerryQu/v2-distilgpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JerryQu/v2-distilgpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JerryQu/v2-distilgpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/JerryQu/v2-distilgpt2
- SGLang
How to use JerryQu/v2-distilgpt2 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 "JerryQu/v2-distilgpt2" \ --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": "JerryQu/v2-distilgpt2", "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 "JerryQu/v2-distilgpt2" \ --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": "JerryQu/v2-distilgpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use JerryQu/v2-distilgpt2 with Docker Model Runner:
docker model run hf.co/JerryQu/v2-distilgpt2
Update config.json
Browse files- config.json +58 -0
config.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_num_labels": 1,
|
| 3 |
+
"activation_function": "gelu_new",
|
| 4 |
+
"architectures": [
|
| 5 |
+
"GPT2LMHeadModel"
|
| 6 |
+
],
|
| 7 |
+
"attn_pdrop": 0.1,
|
| 8 |
+
"bad_words_ids": null,
|
| 9 |
+
"bos_token_id": 50256,
|
| 10 |
+
"decoder_start_token_id": null,
|
| 11 |
+
"do_sample": false,
|
| 12 |
+
"early_stopping": false,
|
| 13 |
+
"embd_pdrop": 0.1,
|
| 14 |
+
"eos_token_id": 50256,
|
| 15 |
+
"finetuning_task": null,
|
| 16 |
+
"id2label": {
|
| 17 |
+
"0": "LABEL_0"
|
| 18 |
+
},
|
| 19 |
+
"initializer_range": 0.02,
|
| 20 |
+
"is_decoder": false,
|
| 21 |
+
"is_encoder_decoder": false,
|
| 22 |
+
"label2id": {
|
| 23 |
+
"LABEL_0": 0
|
| 24 |
+
},
|
| 25 |
+
"layer_norm_epsilon": 1e-05,
|
| 26 |
+
"length_penalty": 1.0,
|
| 27 |
+
"max_length": 20,
|
| 28 |
+
"min_length": 0,
|
| 29 |
+
"model_type": "gpt2",
|
| 30 |
+
"n_ctx": 1024,
|
| 31 |
+
"n_embd": 768,
|
| 32 |
+
"n_head": 12,
|
| 33 |
+
"n_layer": 6,
|
| 34 |
+
"n_positions": 1024,
|
| 35 |
+
"no_repeat_ngram_size": 0,
|
| 36 |
+
"num_beams": 1,
|
| 37 |
+
"num_return_sequences": 1,
|
| 38 |
+
"output_attentions": false,
|
| 39 |
+
"output_hidden_states": false,
|
| 40 |
+
"output_past": true,
|
| 41 |
+
"pad_token_id": null,
|
| 42 |
+
"prefix": null,
|
| 43 |
+
"pruned_heads": {},
|
| 44 |
+
"repetition_penalty": 1.0,
|
| 45 |
+
"resid_pdrop": 0.1,
|
| 46 |
+
"summary_activation": null,
|
| 47 |
+
"summary_first_dropout": 0.1,
|
| 48 |
+
"summary_proj_to_labels": true,
|
| 49 |
+
"summary_type": "cls_index",
|
| 50 |
+
"summary_use_proj": true,
|
| 51 |
+
"task_specific_params": null,
|
| 52 |
+
"temperature": 1.0,
|
| 53 |
+
"top_k": 50,
|
| 54 |
+
"top_p": 1.0,
|
| 55 |
+
"torchscript": false,
|
| 56 |
+
"use_bfloat16": false,
|
| 57 |
+
"vocab_size": 50259
|
| 58 |
+
}
|