Instructions to use shpotes/codegen-350M-mono with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shpotes/codegen-350M-mono with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shpotes/codegen-350M-mono")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shpotes/codegen-350M-mono") model = AutoModelForCausalLM.from_pretrained("shpotes/codegen-350M-mono") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shpotes/codegen-350M-mono with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shpotes/codegen-350M-mono" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shpotes/codegen-350M-mono", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/shpotes/codegen-350M-mono
- SGLang
How to use shpotes/codegen-350M-mono 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 "shpotes/codegen-350M-mono" \ --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": "shpotes/codegen-350M-mono", "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 "shpotes/codegen-350M-mono" \ --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": "shpotes/codegen-350M-mono", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use shpotes/codegen-350M-mono with Docker Model Runner:
docker model run hf.co/shpotes/codegen-350M-mono
Santiago Hincapie-Potes commited on
Commit ·
de0afa3
1
Parent(s): 249d3f7
fix: model weights
Browse files- config.json +6 -16
- pytorch_model.bin +2 -2
config.json
CHANGED
|
@@ -1,15 +1,9 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "codegen-350M-mono/pytorch_model.bin",
|
| 3 |
"activation_function": "gelu_new",
|
| 4 |
"architectures": [
|
| 5 |
"CodeGenForCausalLM"
|
| 6 |
],
|
| 7 |
"attn_pdrop": 0.0,
|
| 8 |
-
"auto_map": {
|
| 9 |
-
"AutoConfig": "configuration_codegen.CodeGenConfig",
|
| 10 |
-
"AutoModel": "modelling_codegen.CodeGenModel",
|
| 11 |
-
"AutoModelForCausalLM": "modelling_codegen.CodeGenForCausalLM"
|
| 12 |
-
},
|
| 13 |
"bos_token_id": 1,
|
| 14 |
"embd_pdrop": 0.0,
|
| 15 |
"eos_token_id": 2,
|
|
@@ -17,30 +11,26 @@
|
|
| 17 |
"initializer_range": 0.02,
|
| 18 |
"layer_norm_epsilon": 1e-05,
|
| 19 |
"model_type": "codegen",
|
| 20 |
-
"n_ctx": 2048,
|
| 21 |
"n_embd": 1024,
|
| 22 |
"n_head": 16,
|
| 23 |
-
"n_inner": null,
|
| 24 |
"n_layer": 20,
|
| 25 |
"n_positions": 2048,
|
| 26 |
-
"resid_pdrop": 0.0,
|
| 27 |
"rotary_dim": 32,
|
| 28 |
-
"scale_attn_weights": true,
|
| 29 |
"summary_activation": null,
|
| 30 |
"summary_first_dropout": 0.1,
|
| 31 |
"summary_proj_to_labels": true,
|
| 32 |
"summary_type": "cls_index",
|
| 33 |
"summary_use_proj": true,
|
|
|
|
|
|
|
| 34 |
"task_specific_params": {
|
| 35 |
"text-generation": {
|
| 36 |
"do_sample": true,
|
| 37 |
-
"
|
| 38 |
-
"
|
| 39 |
}
|
| 40 |
},
|
| 41 |
-
"
|
| 42 |
-
"torch_dtype": "float32",
|
| 43 |
-
"transformers_version": "4.17.0",
|
| 44 |
"use_cache": true,
|
| 45 |
"vocab_size": 51200
|
| 46 |
-
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"activation_function": "gelu_new",
|
| 3 |
"architectures": [
|
| 4 |
"CodeGenForCausalLM"
|
| 5 |
],
|
| 6 |
"attn_pdrop": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
"bos_token_id": 1,
|
| 8 |
"embd_pdrop": 0.0,
|
| 9 |
"eos_token_id": 2,
|
|
|
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
"layer_norm_epsilon": 1e-05,
|
| 13 |
"model_type": "codegen",
|
|
|
|
| 14 |
"n_embd": 1024,
|
| 15 |
"n_head": 16,
|
|
|
|
| 16 |
"n_layer": 20,
|
| 17 |
"n_positions": 2048,
|
|
|
|
| 18 |
"rotary_dim": 32,
|
|
|
|
| 19 |
"summary_activation": null,
|
| 20 |
"summary_first_dropout": 0.1,
|
| 21 |
"summary_proj_to_labels": true,
|
| 22 |
"summary_type": "cls_index",
|
| 23 |
"summary_use_proj": true,
|
| 24 |
+
"transformers_version": "4.10.0.dev0",
|
| 25 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 26 |
"task_specific_params": {
|
| 27 |
"text-generation": {
|
| 28 |
"do_sample": true,
|
| 29 |
+
"temperature": 1.0,
|
| 30 |
+
"max_length": 50
|
| 31 |
}
|
| 32 |
},
|
| 33 |
+
"torch_dtype": "float16",
|
|
|
|
|
|
|
| 34 |
"use_cache": true,
|
| 35 |
"vocab_size": 51200
|
| 36 |
+
}
|
pytorch_model.bin
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:aad20747ff241024eea055015da9c891432fc841e7472de5b95420e6448c3daf
|
| 3 |
+
size 717671475
|