Instructions to use muonai/PULSE-2B-LoRa-adapters with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use muonai/PULSE-2B-LoRa-adapters 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("muonai/PULSE-2B-LoRa-adapters") 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 muonai/PULSE-2B-LoRa-adapters with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "muonai/PULSE-2B-LoRa-adapters" --prompt "Once upon a time"
- Atomic Chat
PULSE-2B-LoRA
PULSE-2B is a lightweight, high-performance fine-tuned version of Google's Gemma 2 2B Instruct model. Trained locally on Apple Silicon using Low-Rank Adaptation (LoRA) via MLX, this adapter improves instruction-following and system behaviors with minimal memory usage.
- Base Model:
mlx-community/gemma-2-2b-it-4bit - Framework: MLX / Apple Silicon Unified Memory
- Training Iterations: 600
- Final Loss: 2.53
π οΈ Requirements & Installation
Make sure you are on a Mac with Apple Silicon (M1/M2/M3/M4) running macOS.
pip install -U mlx-lm huggingface_hub
π Quickstart Tutorials
Option 1: Using MLX Command Line Interface (CLI)
1. Text Generation
You can run generation directly without fusing the model weights:
mlx_lm.generate \
--model mlx-community/gemma-2-2b-it-4bit \
--adapter-path YOUR_USERNAME/PULSE-2B-LoRA \
--prompt "Instruction:\nGive me 3 practical tips for time management.\n\nResponse:\n" \
--max-tokens 200
2. Interactive Terminal Chat
Launch an interactive session directly in your terminal:
mlx_lm.chat \
--model mlx-community/gemma-2-2b-it-4bit \
--adapter-path YOUR_USERNAME/PULSE-2B-LoRA
Option 2: Using Python API (mlx_lm)
You can easily load the base model and adapter inside Python scripts or Jupyter Notebooks:
from mlx_lm import load, generate
# 1. Load the base quantized model alongside the LoRA adapter
model, tokenizer = load(
"mlx-community/gemma-2-2b-it-4bit",
adapter_path="YOUR_USERNAME/PULSE-2B-LoRA"
)
# 2. Format the prompt
prompt = "Instruction:\nExplain quantum computing in simple terms.\n\nResponse:\n"
# 3. Generate response
response = generate(
model,
tokenizer,
prompt=prompt,
max_tokens=250,
verbose=True
)
print(response)
Option 3: Using Hugging Face peft & transformers (PyTorch)
If you converted or adapted these weights for standard PyTorch/Transformers workflows, you can load them with peft:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "google/gemma-2-2b-it"
adapter_id = "YOUR_USERNAME/PULSE-2B-LoRA"
# 1. Load Tokenizer & Base Model
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# 2. Attach LoRA Adapter
model = PeftModel.from_pretrained(base_model, adapter_id)
# 3. Generate
inputs = tokenizer("Instruction:\nWrite a 4-line poem about rain.\n\nResponse:\n", return_tensors="pt").to("cuda" if torch.cuda.is_available() else "cpu")
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
π Notice & License
PULSE-2B is a derivative work based on Google's Gemma 2 weights and is governed by the official Gemma Terms of Use.
Quantized