Text Generation
MLX
English
German
next-concept-modeling
apple-silicon
diffusion-lm
research-code
negative-results
Instructions to use Red-fuchs/ncm-modular with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Red-fuchs/ncm-modular 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("Red-fuchs/ncm-modular") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use Red-fuchs/ncm-modular with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "Red-fuchs/ncm-modular" --prompt "Once upon a time"
- Atomic Chat
Download scripts/fetch_and_convert.sh from Red-fuchs/ncm-modular: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/Red-fuchs/ncm-modular/resolve/main/scripts/fetch_and_convert.sh
- Command line
-
hf download hf://Red-fuchs/ncm-modular/scripts/fetch_and_convert.sh
-
curl -L -o fetch_and_convert.sh https://huggingface.co/Red-fuchs/ncm-modular/resolve/main/scripts/fetch_and_convert.sh
1.43 kB
| # Fetch the OFFICIAL HazyResearch checkpoints and convert the XSum / WMT14 codecs to MLX safetensors. | |
| # Download only (no upload). Sizes: xsum tokenizer.pt ~300 MB, wmt14 ~646 MB (torch) -> MLX codec 231 MB / 549 MB (fp32). | |
| # Cap bandwidth if your link is small, e.g. HF_HUB_ENABLE_HF_TRANSFER=0 and --max-workers 1. | |
| set -e | |
| export NCM_WORK=${NCM_WORK:-w}; export NCM_UPSTREAM=${NCM_UPSTREAM:-upstream} | |
| [ -d $NCM_UPSTREAM ] || git clone https://github.com/HazyResearch/ncm $NCM_UPSTREAM # MIT, needed for models.vqvae (torch reference only) | |
| for t in xsum wmt14; do | |
| hf download hazyresearch/ncm-checkpoints --include "$t/config.yaml" "$t/tokenizer.pt" --local-dir $NCM_WORK/up_raw # repo layout verified: <task>/{config.yaml,generator.pt,tokenizer.pt,README.md}; generator.pt not needed | |
| mkdir -p $NCM_WORK/up/$t; cp $NCM_WORK/up_raw/$t/{config.yaml,tokenizer.pt} $NCM_WORK/up/$t/ 2>/dev/null || echo "adjust paths: need config.yaml + tokenizer.pt in $NCM_WORK/up/$t" | |
| python src/ncm_modular/convert.py $t | |
| done | |
| # tokenizers (HF): gpt2 for xsum, Qwen/Qwen3-0.6B for wmt14 | |
| hf download openai-community/gpt2 --local-dir $NCM_WORK/tok/gpt2 --include "*.json" "*.txt" | |
| hf download Qwen/Qwen3-0.6B --local-dir $NCM_WORK/tok/Qwen3-0.6B --include "*.json" "*.txt" | |
| # reference dump + parity (torch reference vs MLX) | |
| for t in xsum wmt14; do python src/ncm_modular/ref_dump.py $t && python src/ncm_modular/parity.py $t; done | |