Skip to content

Instantly share code, notes, and snippets.

@awni
Last active November 14, 2025 15:39
Show Gist options
  • Select an option

  • Save awni/95112d214b7ff6b3fae30a7bb1ec33a9 to your computer and use it in GitHub Desktop.

Select an option

Save awni/95112d214b7ff6b3fae30a7bb1ec33a9 to your computer and use it in GitHub Desktop.
MLX and MLX LM on DGX Spark

Install CUDA deps:

sudo apt-get update
sudo apt-get install libcudnn9-dev-cuda-13
sudo apt-get install libblas-dev liblapack-dev liblapacke-dev
sudo apt-get install libnccl2 libnccl-dev

Install MLX:

CMAKE_ARGS="-DMLX_BUILD_CUDA=ON" pip install git+https://github.com/ml-explore/mlx

Install mlx-lm:

pip install mlx-lm

Run generation:

mlx_lm.generate --model Qwen/Qwen3-4B-Instruct-2507 --prompt "Tell me a story about Einstein"

LoRA fine-tune:

mlx_lm.lora --model Qwen/Qwen3-4B-Instruct-2507 --data mlx-community/WikiSQL --train
@GamalZilo
Copy link

Awesome, thanks! Struggled with this until I found your solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment