OpenMed/laneformer-2b-it-q4-mlx
240
Laneformer 2B Instruct q4 MLX for OpenMed
This private repository contains an OpenMed MLX-LM conversion of `kogai/laneformer-2b-it`. It is packaged for local Apple Silicon text generation through OpenMed's Python MLX interface and mlx-lm.
At a Glance
OpenMed MLX Status
- Python MLX: supported through
openmed.generate_text(...)andopenmed.mlx.OpenMedMLXLanguageModel. - Swift MLX: not supported for this causal language model artifact. Swift OpenMedKit MLX currently targets OpenMed token-classification artifacts.
- Privacy posture: this artifact is intended for local inference. Do not send protected health information to hosted demos or external services.
- Safety posture: OpenMed does not treat this model as a medical device and does not auto-trigger clinical decisions.
Use This MLX Snapshot
hf download OpenMed/laneformer-2b-it-q4-mlx \
--local-dir ./laneformer-2b-it-q4-mlxPython Quick Start
pip install "openmed[mlx]"from openmed import generate_text
response = generate_text(
messages=[
{
"role": "user",
"content": "Explain why local clinical language models matter.",
}
],
model_name="OpenMed/laneformer-2b-it-q4-mlx",
max_tokens=128,
)
print(response)Use OpenMed/laneformer-2b-it-q4-mlx when you want this preconverted MLX artifact explicitly. OpenMed also accepts kogai/laneformer-2b-it and laneformer-2b-it as compatibility aliases that resolve to this private OpenMed artifact.
Use This Preconverted MLX Repo Directly
from openmed.mlx import OpenMedMLXLanguageModel
runner = OpenMedMLXLanguageModel("./laneformer-2b-it-q4-mlx")
print(runner.generate("Define delayed tensor parallelism.", max_tokens=128))You can also load this directory directly with mlx_lm.load(...).
Artifact Notes
- Format: MLX-LM model directory.
- Weights:
model.safetensors. - Custom model implementation:
laneformer.py, referenced byconfig.jsonthroughmodel_file. - Tokenizer assets:
tokenizer.json,tokenizer_config.json,special_tokens_map.json, andchat_template.jinja. - Quantization metadata is stored in
config.jsonas 4-bit affine with group size 64.
CPU vs MLX Smoke Test
The private export verification used a 13-token prompt on Apple Silicon:
Measured speedup: 2.59x for prefill on the smoke prompt. The CPU and MLX top-5 next-token sets overlapped on 4 of 5 token ids.
Links
- Source model: https://huggingface.co/kogai/laneformer-2b-it
- OpenMed: https://github.com/maziyarpanahi/openmed
- OpenMed MLX backend guide: https://github.com/maziyarpanahi/openmed/blob/master/docs/mlx-backend.md
