Text Generation
Transformers
Safetensors
MLX
English
code
code-review
programming
qwen2.5
bug-detection
Instructions to use xunker/CodeLens-7B-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xunker/CodeLens-7B-MLX with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xunker/CodeLens-7B-MLX")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("xunker/CodeLens-7B-MLX", dtype="auto") - MLX
How to use xunker/CodeLens-7B-MLX with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("xunker/CodeLens-7B-MLX") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use xunker/CodeLens-7B-MLX with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xunker/CodeLens-7B-MLX" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xunker/CodeLens-7B-MLX", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/xunker/CodeLens-7B-MLX
- SGLang
How to use xunker/CodeLens-7B-MLX 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 "xunker/CodeLens-7B-MLX" \ --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": "xunker/CodeLens-7B-MLX", "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 "xunker/CodeLens-7B-MLX" \ --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": "xunker/CodeLens-7B-MLX", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - MLX LM
How to use xunker/CodeLens-7B-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "xunker/CodeLens-7B-MLX" --prompt "Once upon a time"
- Docker Model Runner
How to use xunker/CodeLens-7B-MLX with Docker Model Runner:
docker model run hf.co/xunker/CodeLens-7B-MLX
Upload README
Browse files
README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen2.5-7B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- code
|
| 6 |
+
- code-review
|
| 7 |
+
- programming
|
| 8 |
+
- qwen2.5
|
| 9 |
+
- bug-detection
|
| 10 |
+
- mlx
|
| 11 |
+
datasets:
|
| 12 |
+
- sahil2801/CodeAlpaca-20k
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
library_name: transformers
|
| 17 |
+
model-index:
|
| 18 |
+
- name: CodeLens-7B
|
| 19 |
+
results: []
|
| 20 |
---
|
| 21 |
+
|
| 22 |
+
# [CodeLens-7B-MLX](https://huggingface.co/xunker/CodeLens-7B-MLX)
|
| 23 |
+
|
| 24 |
+
MLX version of [sriksven/CodeLens-7B](https://huggingface.co/sriksven/CodeLens-7B) in various oQ levels and dtypes.
|
| 25 |
+
|
| 26 |
+
Directory | oQ Level | dtype | size
|
| 27 |
+
----------------------------------------------|----------|----------|------
|
| 28 |
+
[CodeLens-7B-oQ4-bf16](CodeLens-7B-oQ4-bf16/) | 4-bit | bfloat16 | 4.2GB
|
| 29 |
+
[CodeLens-7B-oQ4-fp16](CodeLens-7B-oQ4-fp16/) | 4-bit | fp16 | 4.2GB
|
| 30 |
+
[CodeLens-7B-oQ6-bf16](CodeLens-7B-oQ6-bf16/) | 6-bit | bfloat16 | 5.9GB
|
| 31 |
+
[CodeLens-7B-oQ6-fp16](CodeLens-7B-oQ6-fp16/) | 6-bit | fp16 | 5.9GB
|
| 32 |
+
[CodeLens-7B-oQ8-bf16](CodeLens-7B-oQ8-bf16/) | 8-bit | bfloat16 | 7.5GB
|
| 33 |
+
[CodeLens-7B-oQ8-fp16](CodeLens-7B-oQ8-fp16/) | 8-bit | fp16 | 7.5GB
|
| 34 |
+
|
| 35 |
+
## Why choose FP16 over BFLOAT16/BF16?
|
| 36 |
+
|
| 37 |
+
On older Apple Silicon (M1 and M2), fp16 can be faster. Here are the details from [Muhammad Raza](https://muhammadraza.me/2026/gguf-vs-mlx-decision-guide/#two-traps-that-will-flip-your-results):
|
| 38 |
+
|
| 39 |
+
> A lot of MLX builds ship as bf16, and **on the M1 and M2 that data type does not get the accelerated path that fp16 does**. During prefill those weights run un-accelerated and the penalty multiplies across every input token, which is part of why some “MLX is slow” reports come from older hardware. [...]
|
| 40 |
+
>
|
| 41 |
+
> If you are on an M1 or M2 and MLX feels sluggish, check this before you blame the format.
|
| 42 |
+
|
| 43 |
+
## Hardware and Software
|
| 44 |
+
|
| 45 |
+
These were converted to MLX using [oMLX](https://github.com/jundot/omlx) [0.4.4](https://github.com/jundot/omlx/releases/tag/v0.4.4) on a 32GB Macbook Pro 2021 (M1 Pro). I cleared all my RAM so you don't have to.
|
| 46 |
+
|
| 47 |
+
## License
|
| 48 |
+
|
| 49 |
+
Apache 2.0, as per [original model](https://huggingface.co/sriksven/CodeLens-7B).
|