본문으로 건너뛰기
Skillpedia
일반 코딩5.7k · #14749

convert-quantize

하는 일

이 스킬은 Hugging Face의 AI 모델을 MLX 형식으로 변환하고, 필요하면 더 작게 만드는 방법을 에이전트에게 가르칩니다. Apple 기기에서 모델을 실행하려는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓Hugging Face 모델을 Mac용 MLX 버전으로 바꾸고 싶을 때.
  • ✓모델의 4비트 또는 8비트 더 작은 버전이 필요할 때.
  • ✓변환 또는 양자화 명령이 실패해서 고쳐야 할 때.

스킬 링크

https://github.com/Blaizzy/mlx-vlm/blob/main/skills/skills/convert-quantize/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/Blaizzy/mlx-vlm/blob/main/skills/skills/convert-quantize/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 Hugging Face 모델을 MLX로 변환하고, 제 Mac에 맞는 4비트 버전을 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 원본과 모델 계열을 확인한 뒤, 선택한 비트 크기, 그룹 크기, 모드로 변환 명령을 실행합니다. 옵션은 바뀔 수 있으므로 먼저 도움말 출력을 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Convert & Quantize

Use this workflow for mlx_vlm.convert — turning a Hugging Face checkpoint into MLX format, optionally quantizing it.

First Checks

  1. Confirm the source: a Hugging Face repo id or a local path (--hf-path, alias --model).
  2. Confirm the model family is supported in mlx_vlm/models/ (a folder named after the config.json model_type). If not, this is a porting task — switch to Skill("mlx-vlm-skills:add-new-model").
  3. Verify current flags before finalizing: uv run mlx_vlm.convert --help.
  4. Entry point is mlx_vlm.convert. python -m mlx_vlm.convert is deprecated; use uv run mlx_vlm.convert ... or python -m mlx_vlm convert ....

Command Patterns

Plain convert (no quantization), saves to ./mlx_model by default:

uv run mlx_vlm.convert --hf-path <repo-or-path> --mlx-path ./out-mlx

4-bit affine quantization (RTN, the default method):

uv run mlx_vlm.convert --hf-path <repo-or-path> --mlx-path ./out-4bit -q --q-bits 4 --q-group-size 64

Other quant modes (--q-mode sets its own bit/group defaults):

# mxfp4 (group 32, 4 bit), nvfp4 (group 16, 4 bit), mxfp8 (group 32, 8 bit)
uv run mlx_vlm.convert --hf-path <repo-or-path> --mlx-path ./out-mxfp4 -q --q-mode mxfp4

Mixed-bit recipe (per-layer bit allocation, llama.cpp-style):

# recipes: mixed_2_6 mixed_3_4 mixed_3_5 mixed_3_6 mixed_3_8 mixed_4_6 mixed_4_8
uv run mlx_vlm.convert --hf-path <repo-or-path> --mlx-path ./out-mixed -q --quant-predicate mixed_3_6

AWQ (activation-aware, needs a calibration pass):

uv run mlx_vlm.convert --hf-path <repo-or-path> --mlx-path ./out-awq -q --quant-method awq \
  --calibration multimodal --calibration-data /path/to/media   # or --calibration text (default)

dtype cast only / dequantize:

uv run mlx_vlm.convert --hf-path <repo-or-path> --mlx-path ./out-bf16 --dtype bfloat16
uv run mlx_vlm.convert --hf-path <quantized-repo> --mlx-path ./out-fp -d   # dequantize

Upload the result to the Hub:

uv run mlx_vlm.convert --hf-path <repo> --mlx-path ./out -q --upload-repo <user>/<name>-mlx

Key Facts

  • Multimodal modules are skipped from quantization by default (skip_multimodal_module) — vision/audio towers stay full precision; only the language model is quantized. This is expected, not a bug.
  • --q-mode choices: affine (default, group 64 / 4 bit), mxfp4 (32/4), nvfp4 (16/4), mxfp8 (32/8). --q-bits/--q-group-size override the mode defaults.
  • --quant-method: rtn (default, round-to-nearest) or awq (needs calibration; --calibration text|multimodal, optional --calibration-data).
  • -q/--quantize and -d/--dequantize are mutually exclusive.
  • --dtype (from config.json torch_dtype if unset) casts float weights; useful for shrinking fp32 → bf16 without quantizing.
  • The converted folder gets the weights, copied *.py/*.json, the processor, a regenerated config.json, and a model card — it is ready for mlx_vlm.generate and the server.

Validation

  • After converting, load and run a tiny generation to prove the checkpoint works — see Skill("mlx-vlm-skills:cli-inference"). Run on Apple Silicon with enough RAM for the model; do not attempt a large model on an 8 GB machine.
  • For quality, compare a few greedy outputs between the source and the quantized model; large drops usually mean too-low bits or a wrong --q-mode for the model.
  • For code changes touching conversion, run uv run --with pytest python -m pytest mlx_vlm/tests/test_utils.py -q and any model-specific test.
  • If the outcome is a bug report, switch to Skill("mlx-vlm-skills:reproducible-github-issues").
자주 묻는 질문

모든 모델을 변환할 수 있나요?

아니요. 모델 계열이 이미 지원되어야 하며, 그렇지 않으면 이식 작업이라고 스킬이 설명합니다.

양자화 단계는 무엇을 하나요?

선택한 비트 크기에 따라 변환된 모델을 더 작게 만듭니다.

결과를 Hugging Face에 업로드할 수 있나요?

네. Hub에 업로드하는 것을 선택 사항으로 다룹니다.

상세 정보

작성자의 원본 설명

Use this skill when the user wants to convert a Hugging Face model to MLX or quantize/dequantize one with mlx_vlm.convert, including bits and group size, quant modes (affine, mxfp4, nvfp4, mxfp8), RTN vs AWQ, mixed-bit recipes, dtype casts, calibration (text or multimodal), local vs Hub paths, revisions, uploading to the Hub, and convert/quant errors.

repo: Blaizzy/mlx-vlm

인기도

GitHub 스타
5.7k
순위
#14749
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬