Instructions to use parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft
- SGLang
How to use parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft 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 "parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft" \ --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": "parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft", "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 "parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft" \ --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": "parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft with Docker Model Runner:
docker model run hf.co/parallelstudios/mpt-7b-instruct-parallel-colony-memory-importance-ft
Update handler.py
Browse files- handler.py +4 -10
handler.py
CHANGED
|
@@ -4,21 +4,15 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
| 4 |
from typing import Any, Dict
|
| 5 |
|
| 6 |
class EndpointHandler:
|
| 7 |
-
def __init__(
|
| 8 |
-
|
| 9 |
-
path='',
|
| 10 |
-
torch_dtype=torch.bfloat16,
|
| 11 |
-
trust_remote_code=True,
|
| 12 |
-
) -> None:
|
| 13 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 14 |
path,
|
| 15 |
torch_dtype=torch_dtype,
|
| 16 |
trust_remote_code=trust_remote_code
|
| 17 |
)
|
| 18 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 19 |
-
|
| 20 |
-
trust_remote_code=trust_remote_code
|
| 21 |
-
)
|
| 22 |
if tokenizer.pad_token_id is None:
|
| 23 |
warnings.warn(
|
| 24 |
"pad_token_id is not set for the tokenizer. Using eos_token_id as pad_token_id."
|
|
|
|
| 4 |
from typing import Any, Dict
|
| 5 |
|
| 6 |
class EndpointHandler:
|
| 7 |
+
def __init__(self, path='', torch_dtype=torch.bfloat16, trust_remote_code=True):
|
| 8 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 10 |
path,
|
| 11 |
torch_dtype=torch_dtype,
|
| 12 |
trust_remote_code=trust_remote_code
|
| 13 |
)
|
| 14 |
+
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
|
| 15 |
+
|
|
|
|
|
|
|
| 16 |
if tokenizer.pad_token_id is None:
|
| 17 |
warnings.warn(
|
| 18 |
"pad_token_id is not set for the tokenizer. Using eos_token_id as pad_token_id."
|