Text Generation
Transformers
Safetensors
English
Deci AI
DeciLM
Instruction
custom_code
Eval Results (legacy)
Instructions to use Deci/DeciLM-6b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Deci/DeciLM-6b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Deci/DeciLM-6b-instruct", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Deci/DeciLM-6b-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Deci/DeciLM-6b-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Deci/DeciLM-6b-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Deci/DeciLM-6b-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Deci/DeciLM-6b-instruct
- SGLang
How to use Deci/DeciLM-6b-instruct 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 "Deci/DeciLM-6b-instruct" \ --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": "Deci/DeciLM-6b-instruct", "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 "Deci/DeciLM-6b-instruct" \ --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": "Deci/DeciLM-6b-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Deci/DeciLM-6b-instruct with Docker Model Runner:
docker model run hf.co/Deci/DeciLM-6b-instruct
| from packaging import version | |
| import transformers | |
| if version.parse(transformers.__version__) < version.parse("4.31.0"): | |
| raise ImportError( | |
| f"You are using transformers=={transformers.__version__}, but transformers>=4.31.0 is required to use DeciLM. Please upgrade transformers." | |
| ) | |
| from transformers.models.llama.configuration_llama import LlamaConfig | |
| from transformers.utils import logging | |
| logger = logging.get_logger(__name__) | |
| LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP = {} | |
| class DeciLMConfig(LlamaConfig): | |
| r""" | |
| Args: | |
| num_key_value_heads_per_layer (`List[int]`): | |
| The number of key-value heads per layer. | |
| naive_attention_prefill (`bool`, *optional*, defaults to False): | |
| Whether to use naive matmul or scaled dot product attention during prefill. | |
| naive_attention_decode_batched (`bool`, *optional*, defaults to True): | |
| Whether to use naive matmul or scaled dot product attention during decode for batch_size > 1. | |
| naive_attention_decode_single (`bool`, *optional*, defaults to False): | |
| Whether to use naive matmul or scaled dot product attention during decode for batch_size == 1. | |
| ```""" | |
| keys_to_ignore_at_inference = ["past_key_values"] | |
| def __init__( | |
| self, | |
| num_key_value_heads_per_layer: list = None, | |
| naive_attention_prefill: bool = False, | |
| naive_attention_decode_batched: bool = False, | |
| naive_attention_decode_single: bool = False, | |
| **kwargs, | |
| ): | |
| self.num_key_value_heads_per_layer = num_key_value_heads_per_layer | |
| self.naive_attention_prefill = naive_attention_prefill | |
| self.naive_attention_decode_batched = naive_attention_decode_batched | |
| self.naive_attention_decode_single = naive_attention_decode_single | |
| super().__init__(**kwargs, ) | |