Gemma-4-MLX
Collection
1 item โข Updated
How to use harishkumar12k/gemma-4-E2B-it-mlx-2Bit with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM
processor = AutoProcessor.from_pretrained("harishkumar12k/gemma-4-E2B-it-mlx-2Bit")
model = AutoModelForMultimodalLM.from_pretrained("harishkumar12k/gemma-4-E2B-it-mlx-2Bit", device_map="auto")How to use harishkumar12k/gemma-4-E2B-it-mlx-2Bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download harishkumar12k/gemma-4-E2B-it-mlx-2Bit --local-dir gemma-4-E2B-it-mlx-2Bit
The Model harishkumar12k/gemma-4-E2B-it-mlx-2Bit was converted to MLX format from google/gemma-4-E2B-it using mlx-lm version 0.31.2.
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("harishkumar12k/gemma-4-E2B-it-mlx-2Bit")
prompt="hello"
if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
response = generate(model, tokenizer, prompt=prompt, verbose=True)
2-bit