Instructions to use Deci/DeciLM-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Deci/DeciLM-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Deci/DeciLM-7B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Deci/DeciLM-7B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Deci/DeciLM-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Deci/DeciLM-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Deci/DeciLM-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Deci/DeciLM-7B
- SGLang
How to use Deci/DeciLM-7B 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-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Deci/DeciLM-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Deci/DeciLM-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Deci/DeciLM-7B with Docker Model Runner:
docker model run hf.co/Deci/DeciLM-7B
Commit ·
cdd1aef
1
Parent(s): 8d9cdb8
Update README.md
Browse filesAdded text-generation pipeline documentation
README.md
CHANGED
|
@@ -52,11 +52,17 @@ model_name = "Deci/DeciLM-7B"
|
|
| 52 |
device = "cuda" # for GPU usage or "cpu" for CPU usage
|
| 53 |
|
| 54 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 55 |
-
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=
|
| 56 |
|
| 57 |
inputs = tokenizer.encode("In a shocking finding, scientists discovered a herd of unicorns living in", return_tensors="pt").to(device)
|
| 58 |
outputs = model.generate(inputs, max_new_tokens=100, do_sample=True, top_p=0.95)
|
| 59 |
print(tokenizer.decode(outputs[0]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
```
|
| 61 |
|
| 62 |
## Evaluation
|
|
|
|
| 52 |
device = "cuda" # for GPU usage or "cpu" for CPU usage
|
| 53 |
|
| 54 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 55 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", trust_remote_code=True).to(device)
|
| 56 |
|
| 57 |
inputs = tokenizer.encode("In a shocking finding, scientists discovered a herd of unicorns living in", return_tensors="pt").to(device)
|
| 58 |
outputs = model.generate(inputs, max_new_tokens=100, do_sample=True, top_p=0.95)
|
| 59 |
print(tokenizer.decode(outputs[0]))
|
| 60 |
+
|
| 61 |
+
# The model can also be used via the text-generation pipeline interface
|
| 62 |
+
from transformers import pipeline
|
| 63 |
+
generator = pipeline("text-generation", "Deci/DeciLM-7B", torch_dtype="auto", trust_remote_code=True, device=device)
|
| 64 |
+
outputs = generator("In a shocking finding, scientists discovered a herd of unicorns living in", max_new_tokens=100, do_sample=True, top_p=0.95)
|
| 65 |
+
print(outputs[0]["generated_text"])
|
| 66 |
```
|
| 67 |
|
| 68 |
## Evaluation
|