Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
extra_gated_heading: Access Gemma on Hugging Face
|
| 6 |
+
extra_gated_prompt: To access Gemma on Hugging Face, you’re required to review and
|
| 7 |
+
agree to Google’s usage license. To do this, please ensure you’re logged in to Hugging
|
| 8 |
+
Face and click below. Requests are processed immediately.
|
| 9 |
+
extra_gated_button_content: Acknowledge license
|
| 10 |
+
base_model: google/gemma-3-1b-it
|
| 11 |
+
tags:
|
| 12 |
+
- mlx
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# mlx-community/gemma-3-1b-it-qat-4bit
|
| 16 |
+
|
| 17 |
+
The Model [mlx-community/gemma-3-1b-it-qat-4bit](https://huggingface.co/mlx-community/gemma-3-1b-it-qat-4bit) was
|
| 18 |
+
converted to MLX format from [google/gemma-3-1b-it-qat-q4_0](https://huggingface.co/google/gemma-3-1b-it-qat-q4_0)
|
| 19 |
+
using mlx-lm version **0.22.5**.
|
| 20 |
+
|
| 21 |
+
## Use with mlx
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
pip install mlx-lm
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
from mlx_lm import load, generate
|
| 29 |
+
|
| 30 |
+
model, tokenizer = load("mlx-community/gemma-3-1b-it-qat-4bit")
|
| 31 |
+
|
| 32 |
+
prompt = "hello"
|
| 33 |
+
|
| 34 |
+
if tokenizer.chat_template is not None:
|
| 35 |
+
messages = [{"role": "user", "content": prompt}]
|
| 36 |
+
prompt = tokenizer.apply_chat_template(
|
| 37 |
+
messages, add_generation_prompt=True
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
response = generate(model, tokenizer, prompt=prompt, verbose=True)
|
| 41 |
+
```
|