Instructions to use mlx-community/CodeLlama-70b-Instruct-hf-4bit-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/CodeLlama-70b-Instruct-hf-4bit-MLX 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("mlx-community/CodeLlama-70b-Instruct-hf-4bit-MLX") 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) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use mlx-community/CodeLlama-70b-Instruct-hf-4bit-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/CodeLlama-70b-Instruct-hf-4bit-MLX"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/CodeLlama-70b-Instruct-hf-4bit-MLX" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/CodeLlama-70b-Instruct-hf-4bit-MLX", "messages": [ {"role": "user", "content": "Hello"} ] }'
Conversion request to Q5_K_M for MLX
Could someone convert CodeLlama-70B-Instruct to Q5_K_M for MLX? It’s not listed yet and would be great for my use case (science research). Thank you!!
Sure
Wait posted too fast - the KM format is a GGUF format not MLX? Do you just want a Q5?
Thanks for the reply! Glad you held off. I'm waiting to see the models that are coming in for llama 4. Waiting to see if I can get a Maverick model that'll fit (and make the most of) my brand new maxed out M3 Ultra Mac Studio.
Actually, let me be specific... if Llama-4-Maverick-17B-16E-Instruct-6bit 256K with vision enabled ("vision_config"), that's probably my sweet spot.
I see you've made a 4bit, 6bit and 8bit Scout. I believe a 2bit Scout would fit on a M4 Pro Mac mini with 64GB, and still outperform CodeLlama Instruct 70B at 6bit. Any chance there's a 2bit Scout in the works??
I will push some models with mixed quant to so they fit better on macs with MoE