Instructions to use Multi-Domain-Expert-Learning/given-mpt-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Multi-Domain-Expert-Learning/given-mpt-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Multi-Domain-Expert-Learning/given-mpt-7b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Multi-Domain-Expert-Learning/given-mpt-7b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Multi-Domain-Expert-Learning/given-mpt-7b", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Multi-Domain-Expert-Learning/given-mpt-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Multi-Domain-Expert-Learning/given-mpt-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Multi-Domain-Expert-Learning/given-mpt-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Multi-Domain-Expert-Learning/given-mpt-7b
- SGLang
How to use Multi-Domain-Expert-Learning/given-mpt-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 "Multi-Domain-Expert-Learning/given-mpt-7b" \ --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": "Multi-Domain-Expert-Learning/given-mpt-7b", "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 "Multi-Domain-Expert-Learning/given-mpt-7b" \ --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": "Multi-Domain-Expert-Learning/given-mpt-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Multi-Domain-Expert-Learning/given-mpt-7b with Docker Model Runner:
docker model run hf.co/Multi-Domain-Expert-Learning/given-mpt-7b
Ontocord.AI commited on
Commit ·
3a6a19a
1
Parent(s): c5e4b95
Upload modeling_mpt.py with huggingface_hub
Browse files- modeling_mpt.py +2 -0
modeling_mpt.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
"""A simple, flexible implementation of a GPT model.
|
|
|
|
| 2 |
Inspired by https://github.com/karpathy/minGPT/blob/master/mingpt/model.py
|
| 3 |
"""
|
| 4 |
import math
|
|
@@ -307,6 +308,7 @@ class MPTForCausalLM(MPTPreTrainedModel):
|
|
| 307 |
@staticmethod
|
| 308 |
def _reorder_cache(past_key_values, beam_idx):
|
| 309 |
"""Used by HuggingFace generate when using beam search with kv-caching.
|
|
|
|
| 310 |
See https://github.com/huggingface/transformers/blob/3ec7a47664ebe40c40f4b722f6bb1cd30c3821ec/src/transformers/models/gpt2/modeling_gpt2.py#L1122-L1133
|
| 311 |
for an example in transformers.
|
| 312 |
"""
|
|
|
|
| 1 |
"""A simple, flexible implementation of a GPT model.
|
| 2 |
+
|
| 3 |
Inspired by https://github.com/karpathy/minGPT/blob/master/mingpt/model.py
|
| 4 |
"""
|
| 5 |
import math
|
|
|
|
| 308 |
@staticmethod
|
| 309 |
def _reorder_cache(past_key_values, beam_idx):
|
| 310 |
"""Used by HuggingFace generate when using beam search with kv-caching.
|
| 311 |
+
|
| 312 |
See https://github.com/huggingface/transformers/blob/3ec7a47664ebe40c40f4b722f6bb1cd30c3821ec/src/transformers/models/gpt2/modeling_gpt2.py#L1122-L1133
|
| 313 |
for an example in transformers.
|
| 314 |
"""
|