Instructions to use mlx-community/plamo-2-1b-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/plamo-2-1b-bf16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlx-community/plamo-2-1b-bf16", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mlx-community/plamo-2-1b-bf16", trust_remote_code=True, device_map="auto") - MLX
How to use mlx-community/plamo-2-1b-bf16 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-bf16") 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-bf16 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-bf16" # 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-bf16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mlx-community/plamo-2-1b-bf16
- SGLang
How to use mlx-community/plamo-2-1b-bf16 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-bf16" \ --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-bf16", "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-bf16" \ --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-bf16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - MLX LM
How to use mlx-community/plamo-2-1b-bf16 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-bf16" --prompt "Once upon a time"
- Docker Model Runner
How to use mlx-community/plamo-2-1b-bf16 with Docker Model Runner:
docker model run hf.co/mlx-community/plamo-2-1b-bf16
| { | |
| "architectures": [ | |
| "PlamoForCausalLM" | |
| ], | |
| "attention_window_size": 2048, | |
| "auto_map": { | |
| "AutoConfig": "modeling_plamo.PlamoConfig", | |
| "AutoModelForCausalLM": "modeling_plamo.PlamoForCausalLM" | |
| }, | |
| "bos_token_id": 1, | |
| "capacity_factor": 1.0, | |
| "eos_token_id": 2, | |
| "eval_attention_n_bit": null, | |
| "eval_mlp_n_bit": null, | |
| "expert_dropout": 0.0, | |
| "fp8_accum_dtype": "bfloat16", | |
| "group_size": 1024, | |
| "hidden_size": 2048, | |
| "hidden_size_per_head": 128, | |
| "image_feature_size": null, | |
| "image_proj_type": "linear", | |
| "image_token_id": null, | |
| "intermediate_size": 8192, | |
| "k_expert": null, | |
| "linear_type": "fp8", | |
| "mamba_chunk_size": 256, | |
| "mamba_d_conv": 4, | |
| "mamba_d_state": 64, | |
| "mamba_enabled": true, | |
| "mamba_num_heads": 32, | |
| "mamba_step": 2, | |
| "max_position_embeddings": 10485760, | |
| "model_type": "plamo2", | |
| "n_expert": null, | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 16, | |
| "num_key_value_heads": 1, | |
| "rms_norm_eps": 1e-06, | |
| "shared_intermediate_size": null, | |
| "sliding_window": 2048, | |
| "sparse_intermediate_size": null, | |
| "sparse_step": null, | |
| "tokenizer_class": "PlamoTokenizer", | |
| "torch_dtype": "float32", | |
| "transformers_version": "4.44.2", | |
| "use_cache": true, | |
| "use_predefined_initial_state": false, | |
| "vocab_size": 100000 | |
| } |