mlx-Janus-Pro
Collection
8 items • Updated • 3
How to use wnma3mz/Janus-Pro-7B-LM-4bit with MLX:
# Make sure mlx-lm is installed
# pip install --upgrade mlx-lm
# Generate text with mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("wnma3mz/Janus-Pro-7B-LM-4bit")
prompt = "Write a story about Einstein"
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, add_generation_prompt=True
)
text = generate(model, tokenizer, prompt=prompt, verbose=True)How to use wnma3mz/Janus-Pro-7B-LM-4bit with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "wnma3mz/Janus-Pro-7B-LM-4bit"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "wnma3mz/Janus-Pro-7B-LM-4bit"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "wnma3mz/Janus-Pro-7B-LM-4bit",
"messages": [
{"role": "user", "content": "Hello"}
]
}'This model is derived from https://huggingface.co/deepseek-ai/Janus-Pro-7B and the main modifications are as follows
4bit refers to quantifying the LLM part to 4 bits.
LM means that it contains only the language model part.
In Macos (Apple silicon), use mlx framework https://github.com/wnma3mz/tLLM
tllm.server --model_path $MODEL_PATH --hostname localhost --is_local --client_size 1
$MODEL_PATH like wnma3mz/Janus-Pro-1B-4bit
4-bit
Base model
deepseek-ai/Janus-Pro-7B