bigcode/the-stack
Viewer β’ Updated β’ 546M β’ 19.8k β’ 996
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")How to use rustformers/mpt-7b-ggml with vLLM:
# 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
}'docker model run hf.co/rustformers/mpt-7b-ggml
How to use rustformers/mpt-7b-ggml with SGLang:
# 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
}'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
}'How to use rustformers/mpt-7b-ggml with Docker Model Runner:
docker model run hf.co/rustformers/mpt-7b-ggml
MPT-7B is a decoder-style transformer pretrained from scratch on 1T tokens of English text and code. This model was trained by MosaicML.
MPT-7B is part of the family of MosaicPretrainedTransformer (MPT) models, which use a modified transformer architecture optimized for efficient training and inference.
β οΈCautionβ οΈ: mpt-7b-storywriter is still under development!
Via pip: pip install llm-rs
from llm_rs import AutoModel
#Load the model, define any model you like from the list above as the `model_file`
model = AutoModel.from_pretrained("rustformers/mpt-7b-ggml",model_file="mpt-7b-q4_0-ggjt.bin")
#Generate
print(model.generate("The meaning of life is"))
git clone --recurse-submodules https://github.com/rustformers/llm.git
cd llm
cargo build --release
cargo run --release -- mpt infer -m path/to/model.bin -p "Tell me how cool the Rust programming language is:"
The GGML example only supports the ggml container type!
git clone https://github.com/ggerganov/ggml
cd ggml
mkdir build && cd build
cmake ..
make -j4 mpt
./bin/mpt -m path/to/model.bin -p "The meaning of life is"