unalignment/toxic-dpo-v0.2
Viewer • Updated • 541 • 326 • 141
How to use enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit 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("enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit")
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 enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit",
"messages": [
{"role": "user", "content": "Hello"}
]
}'The Model enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit was converted to MLX format from Orion-zhen/Qwen2.5-7B-Instruct-Uncensored using mlx-lm version 0.31.2.
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("enet45/Qwen2.5-7B-Instruct-Uncensored-mlx-8Bit")
prompt="hello"
if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
response = generate(model, tokenizer, prompt=prompt, verbose=True)
8-bit
Base model
Qwen/Qwen2.5-7B