Instructions to use Salesforce/codet5-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Salesforce/codet5-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Salesforce/codet5-large")# Load model directly from transformers import AutoTokenizer, AutoModelWithLMHead tokenizer = AutoTokenizer.from_pretrained("Salesforce/codet5-large") model = AutoModelWithLMHead.from_pretrained("Salesforce/codet5-large") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Salesforce/codet5-large with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Salesforce/codet5-large" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Salesforce/codet5-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Salesforce/codet5-large
- SGLang
How to use Salesforce/codet5-large 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 "Salesforce/codet5-large" \ --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": "Salesforce/codet5-large", "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 "Salesforce/codet5-large" \ --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": "Salesforce/codet5-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Salesforce/codet5-large with Docker Model Runner:
docker model run hf.co/Salesforce/codet5-large
Commit ·
7430ce1
1
Parent(s): 119c23b
Update config.json
Browse files- config.json +6 -5
config.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
-
"
|
| 4 |
],
|
|
|
|
| 5 |
"d_ff": 4096,
|
| 6 |
"d_kv": 64,
|
| 7 |
"d_model": 1024,
|
| 8 |
"decoder_start_token_id": 0,
|
| 9 |
"dropout_rate": 0.1,
|
| 10 |
-
"eos_token_id":
|
| 11 |
"feed_forward_proj": "relu",
|
| 12 |
"initializer_factor": 1.0,
|
| 13 |
"is_encoder_decoder": true,
|
|
@@ -19,6 +20,7 @@
|
|
| 19 |
"num_layers": 24,
|
| 20 |
"output_past": true,
|
| 21 |
"pad_token_id": 0,
|
|
|
|
| 22 |
"relative_attention_num_buckets": 32,
|
| 23 |
"task_specific_params": {
|
| 24 |
"summarization": {
|
|
@@ -49,8 +51,7 @@
|
|
| 49 |
"prefix": "translate English to Romanian: "
|
| 50 |
}
|
| 51 |
},
|
| 52 |
-
"
|
| 53 |
-
"transformers_version": "4.16.2",
|
| 54 |
"use_cache": true,
|
| 55 |
"vocab_size": 32100
|
| 56 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
+
"T5WithLMHeadModel"
|
| 4 |
],
|
| 5 |
+
"bos_token_id": 1,
|
| 6 |
"d_ff": 4096,
|
| 7 |
"d_kv": 64,
|
| 8 |
"d_model": 1024,
|
| 9 |
"decoder_start_token_id": 0,
|
| 10 |
"dropout_rate": 0.1,
|
| 11 |
+
"eos_token_id": 2,
|
| 12 |
"feed_forward_proj": "relu",
|
| 13 |
"initializer_factor": 1.0,
|
| 14 |
"is_encoder_decoder": true,
|
|
|
|
| 20 |
"num_layers": 24,
|
| 21 |
"output_past": true,
|
| 22 |
"pad_token_id": 0,
|
| 23 |
+
"relative_attention_max_distance": 128,
|
| 24 |
"relative_attention_num_buckets": 32,
|
| 25 |
"task_specific_params": {
|
| 26 |
"summarization": {
|
|
|
|
| 51 |
"prefix": "translate English to Romanian: "
|
| 52 |
}
|
| 53 |
},
|
| 54 |
+
"transformers_version": "4.19.2",
|
|
|
|
| 55 |
"use_cache": true,
|
| 56 |
"vocab_size": 32100
|
| 57 |
+
}
|