nypswift commited on
Commit
27cf342
·
verified ·
1 Parent(s): 6efa48b

adding readme

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md CHANGED
@@ -13,3 +13,66 @@ tags:
13
  - transformers
14
  - mlx
15
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  - transformers
14
  - mlx
15
  ---
16
+ # Update
17
+
18
+ Added a Jinja chat template so the model can format conversations correctly and work smoothly with `mlx-lm` chat-style inference.
19
+
20
+ # MLX 4-Bit Quantized: Gemma-4-12B-Coder
21
+
22
+ This repository contains an 4-bit MLX-converted version of
23
+ [yuxinlu1/gemma-4-12B-coder-fable5-composer2.5-v1](https://huggingface.co/yuxinlu1/gemma-4-12B-coder-fable5-composer2.5-v1).
24
+
25
+ The model has been quantized to 4-bit to dramatically reduce memory requirements while retaining near-lossless reasoning and coding capabilities. It is optimized for local inference on Apple Silicon Macs using the `mlx-lm` library.
26
+
27
+ ## How to Use with MLX
28
+
29
+ Install the required dependency:
30
+
31
+ ```bash
32
+ pip install --upgrade mlx-lm
33
+ ```
34
+
35
+ Run inference from Python:
36
+
37
+ ```python
38
+ from mlx_lm import load, generate
39
+
40
+ # Load the 8-bit quantized MLX model.
41
+ model, tokenizer = load("mlx-community/gemma-4-12b-coder-fable5-composer2.5-4bit")
42
+
43
+ prompt = "Write a Python script to sort a dictionary by its values."
44
+ messages = [{"role": "user", "content": prompt}]
45
+
46
+ formatted_prompt = tokenizer.apply_chat_template(
47
+ messages,
48
+ tokenize=False,
49
+ add_generation_prompt=True,
50
+ )
51
+
52
+ response = generate(
53
+ model,
54
+ tokenizer,
55
+ prompt=formatted_prompt,
56
+ verbose=True,
57
+ max_tokens=1024,
58
+ )
59
+ ```
60
+
61
+ ```python
62
+ response = generate(
63
+ model,
64
+ tokenizer,
65
+ prompt=formatted_prompt,
66
+ verbose=True,
67
+ max_tokens=1024,
68
+ temp=0.0,
69
+ )
70
+ ```
71
+
72
+ ## Base and License
73
+
74
+ - **Base model:** `google/gemma-4-12B-it`
75
+ - **Original fine-tune:** [`yuxinlu1/gemma-4-12B-coder-fable5-composer2.5-v1`](https://huggingface.co/yuxinlu1/gemma-4-12B-coder-fable5-composer2.5-v1)
76
+ - **License:** Apache 2.0
77
+
78
+ Free to use, modify, and redistribute under the Apache 2.0 license.