Instructions to use MSGEncrypted/minicpm5-1b-math-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use MSGEncrypted/minicpm5-1b-math-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("openbmb/MiniCPM5-1B") model = PeftModel.from_pretrained(base_model, "MSGEncrypted/minicpm5-1b-math-lora") - Notebooks
- Google Colab
- Kaggle
Publish math-lora (gate passed: gsm8k)
Browse files
README.md
CHANGED
|
@@ -10,13 +10,26 @@ tags:
|
|
| 10 |
- math
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
QLoRA
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
| task | metric | baseline | candidate | delta |
|
| 22 |
| --- | --- | ---: | ---: | ---: |
|
|
@@ -27,9 +40,11 @@ Evaluated with research/evals/configs/lm_eval_math.yaml on Modal using slm-lm-ev
|
|
| 27 |
|
| 28 |
## Training
|
| 29 |
|
| 30 |
-
-
|
|
|
|
|
|
|
|
|
|
| 31 |
- eval loss: 0.494981
|
| 32 |
-
- result score: -
|
| 33 |
|
| 34 |
## Load with PEFT
|
| 35 |
|
|
@@ -39,7 +54,11 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
| 39 |
|
| 40 |
base = "openbmb/MiniCPM5-1B"
|
| 41 |
adapter = "MSGEncrypted/minicpm5-1b-math-lora"
|
|
|
|
| 42 |
tokenizer = AutoTokenizer.from_pretrained(base, trust_remote_code=True)
|
| 43 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
| 44 |
model = PeftModel.from_pretrained(model, adapter)
|
| 45 |
```
|
|
|
|
|
|
| 10 |
- math
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# math-lora
|
| 14 |
|
| 15 |
+
QLoRA adapter for **math**, fine-tuned from `openbmb/MiniCPM5-1B` on `meta-math/MetaMathQA` + `tatsu-lab/alpaca` (format: `mix`).
|
| 16 |
|
| 17 |
+
Trained, evaluated, and gated on [Modal](https://modal.com/docs/guide) via `research/modal/` (app `slm-finetune-benchmark`).
|
| 18 |
|
| 19 |
+
## Benchmark gate
|
| 20 |
+
|
| 21 |
+
- eval profile: `math`
|
| 22 |
+
- gate: **PASSED**
|
| 23 |
+
|
| 24 |
+
| check | value | result |
|
| 25 |
+
| --- | ---: | --- |
|
| 26 |
+
| gsm8k >= 0.05 | 0.4000 | pass |
|
| 27 |
+
| gsm8k improve >= 0.02 | 0.0700 | pass |
|
| 28 |
+
| arc_challenge regress <= 0.03 | -0.0500 | pass |
|
| 29 |
+
| hellaswag regress <= 0.03 | 0.0000 | pass |
|
| 30 |
+
| piqa regress <= 0.03 | 0.0200 | pass |
|
| 31 |
+
|
| 32 |
+
## lm-eval results
|
| 33 |
|
| 34 |
| task | metric | baseline | candidate | delta |
|
| 35 |
| --- | --- | ---: | ---: | ---: |
|
|
|
|
| 40 |
|
| 41 |
## Training
|
| 42 |
|
| 43 |
+
- dataset: `/repo/research/data/education-lesson-chat.jsonl`
|
| 44 |
+
- mode: `qlora`
|
| 45 |
+
- samples: {'train': 3528, 'eval': 72}
|
| 46 |
+
- final train loss: 0.340698
|
| 47 |
- eval loss: 0.494981
|
|
|
|
| 48 |
|
| 49 |
## Load with PEFT
|
| 50 |
|
|
|
|
| 54 |
|
| 55 |
base = "openbmb/MiniCPM5-1B"
|
| 56 |
adapter = "MSGEncrypted/minicpm5-1b-math-lora"
|
| 57 |
+
|
| 58 |
tokenizer = AutoTokenizer.from_pretrained(base, trust_remote_code=True)
|
| 59 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 60 |
+
base, torch_dtype="auto", device_map="auto", trust_remote_code=True
|
| 61 |
+
)
|
| 62 |
model = PeftModel.from_pretrained(model, adapter)
|
| 63 |
```
|
| 64 |
+
|