Instructions to use rustformers/mpt-7b-ggml with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rustformers/mpt-7b-ggml with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rustformers/mpt-7b-ggml")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("rustformers/mpt-7b-ggml", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use rustformers/mpt-7b-ggml with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rustformers/mpt-7b-ggml" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rustformers/mpt-7b-ggml", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/rustformers/mpt-7b-ggml
- SGLang
How to use rustformers/mpt-7b-ggml 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 "rustformers/mpt-7b-ggml" \ --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": "rustformers/mpt-7b-ggml", "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 "rustformers/mpt-7b-ggml" \ --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": "rustformers/mpt-7b-ggml", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use rustformers/mpt-7b-ggml with Docker Model Runner:
docker model run hf.co/rustformers/mpt-7b-ggml
Panic when try to load the model bin files
#2
by chenhunghan - opened
There seems to be rust exceptions when loading the model.
(Using llm-rs==0.1.1)
I tried to load the model like model = Llama("./mpt-7b-q4_0-ggjt.bin"), but got
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidFormatVersion { container_type: Ggjt, version: 2 }', src/models.rs:5:1
also tried
from llm_rs import Llama
#load the model
model = Llama("cache/mpt-7b-q4_0.bin")
#generate
print(model.generate("The meaning of life is"))
but got
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Error { kind: UnexpectedEof, message: "failed to fill whole buffer" })', src/models.rs:5:1
any additional instructions to load the models?
There were breaking changes in the ggml format, you need to use llm-rs==0.2.0 or greater (see here)
Also MPT isn't a LLama model, sou you need to load it via the Mpt model, you can also see this in the model-card of this repo.
from llm_rs import Mpt
model = Mpt("cache/mpt-7b-q4_0.bin")
Thank you, works well!
LLukas22 changed discussion status to closed