Instructions to use mlx-community/plamo-2-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/plamo-2-1b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlx-community/plamo-2-1b", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mlx-community/plamo-2-1b", trust_remote_code=True, device_map="auto") - MLX
How to use mlx-community/plamo-2-1b 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("mlx-community/plamo-2-1b") 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 mlx-community/plamo-2-1b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlx-community/plamo-2-1b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/plamo-2-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mlx-community/plamo-2-1b
- SGLang
How to use mlx-community/plamo-2-1b 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 "mlx-community/plamo-2-1b" \ --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": "mlx-community/plamo-2-1b", "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 "mlx-community/plamo-2-1b" \ --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": "mlx-community/plamo-2-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - MLX LM
How to use mlx-community/plamo-2-1b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "mlx-community/plamo-2-1b" --prompt "Once upon a time"
- Docker Model Runner
How to use mlx-community/plamo-2-1b with Docker Model Runner:
docker model run hf.co/mlx-community/plamo-2-1b
- Atomic Chat
| license: apache-2.0 | |
| language: | |
| - en | |
| - ja | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| base_model: pfnet/plamo-2-1b | |
| tags: | |
| - mlx | |
| # mlx-community/plamo-2-1b | |
| The Model [mlx-community/plamo-2-1b](https://huggingface.co/mlx-community/plamo-2-1b) was | |
| converted to MLX format from [pfnet/plamo-2-1b](https://huggingface.co/pfnet/plamo-2-1b) | |
| using mlx-lm version **0.21.0**. | |
| ## Use with mlx | |
| ```bash | |
| pip install mlx numba # numba is required for the new PLaMo tokenizer | |
| pip install "git+https://github.com/mitmul/mlx-examples.git@mitmul/add-plamo2-1b-support#egg=mlx-lm&subdirectory=llms" | |
| ``` | |
| ```bash | |
| python -m mlx_lm.generate \ | |
| --model mlx-community/plamo-2-1b \ | |
| --prompt '็พๅณใใใซใฌใผใฎไฝใๆน ใฎใฌใทใใ็ดนไปใใพใใ' \ | |
| --max-tokens 1024 \ | |
| --extra-eos-token '<|plamo:bos|>' \ | |
| --ignore-chat-template \ | |
| --temp 0 | |
| Fetching 7 files: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 7/7 [00:00<00:00, 116508.44it/s] | |
| ========== | |
| ## ็พๅณใใใซใฌใผใฎไฝใๆน | |
| ### ๆๆ | |
| - ็ใญใ ๏ผๅ | |
| - ใซใใใ ๏ผๆฌ | |
| - ใใใใใ ๏ผๅ | |
| - ่ฑใฒใ่ ๏ผ๏ผ๏ผ๏ฝ | |
| - ใซใใซใ ๏ผใใ | |
| - ใใใใ ๏ผใใ | |
| - ใซใฌใผ็ฒ ๅคงใใ๏ผ | |
| - ๅกฉ ๅฐใใ๏ผ | |
| - ๆฐด ๏ผ๏ผ๏ผ๏ฝ๏ฝ | |
| - ใใใ็ผถ ๏ผ็ผถ | |
| - ๆฐด ๏ผ๏ผ๏ผ๏ฝ๏ฝ | |
| - ใตใฉใๆฒน ๅคงใใ๏ผ | |
| - ๅกฉ ๅฐใ | |
| - ใใใใ ๅฐใ | |
| ### ไฝใๆน | |
| - ็ใญใใใซใใใใใใใใใใใซใใซใใใใใใใใฟใใๅใใซใใพใใ | |
| - ใใฉใคใใณใซใตใฉใๆฒนใ็ฑใใใซใใซใใใใใใใ็ใใพใใ | |
| - ้ฆใใๅบใฆใใใใ็ใญใใใซใใใใใใใใใใ่ฑใฒใ่ใๅกฉใใใใใใๆฐดใใใใ็ผถใๆฐดใใซใฌใผ็ฒใๅ ฅใใฆ็ใใพใใ | |
| - ้่ใซ็ซใ้ใฃใใใใซใฌใผ็ฒใๆบถใใใพใใ | |
| - ๆฐดใๅกฉใใใใใใงๅณใ่ชฟใใพใใ | |
| - ๆๅพใซใใใ็ผถใๅ ใใฆใ็ ฎ่พผใใงๅฎๆใงใใ | |
| ## ใพใจใ | |
| ็พๅณใใใซใฌใผใฎไฝใๆนใฎใฌใทใใ็ดนไปใใพใใใ | |
| ใใฒๅ่ใซใใฆใฟใฆใใ ใใใ | |
| ========== | |
| Prompt: 8 tokens, 114.293 tokens-per-sec | |
| Generation: 234 tokens, 67.785 tokens-per-sec | |
| Peak memory: 2.727 GB | |
| ``` | |
| You can also write your code to use this model like this: | |
| ```python | |
| from mlx_lm import load, generate | |
| model, tokenizer = load("mlx-community/plamo-2-1b") | |
| prompt = "็พๅณใใใซใฌใผใฎไฝใๆนใฎใฌใทใใ็ดนไปใใพใใ" | |
| response = generate(model, tokenizer, prompt=prompt, verbose=True) | |
| ``` |