tienda02's picture
Create README.md
f3adba3
---
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
# Doc / guide: https://huggingface.co/docs/hub/model-cards
{}
---
# MetaMath Mistral7B Lora fine tuning
<!-- Provide a quick summary of what the model is/does. -->
This is the LoRa weight fine-tuning version of Meta-Math-Mistral-7B on Vietnamese Elementary Maths Solving
## Model Details
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Model type:** LoRa(rank = 128, alpha = 256)
- **Languages (NLP):** English, Vietnamese
- **Finetuned from model [optional]:** meta-math/MetaMath-Mistral-7B
### Model Sources [optional]
<!-- Provide the basic links for the model. -->
- **Repository:** [tien02/llm-math](https://github.com/tien02/llm-math)
## Uses
* Instruction with explanation
```
INS_EXP_PROMPT = '''
You are a helpful assistant in evaluating the quality of the outputs for a given instruction. \
Please propose at most a precise answer about whether a potential output is a good output for a given instruction. \
Another assistant will evaluate different aspects of the output by answering all the questions.
### Instruction:
{question}
### Input:
{choices}
### Rationale:
{explanation}
### Response: {answer}
'''
```
* Instruction with no explanation
```
INS_EXP_PROMPT = '''
You are a helpful assistant in evaluating the quality of the outputs for a given instruction. \
Please propose at most a precise answer about whether a potential output is a good output for a given instruction. \
Another assistant will evaluate different aspects of the output by answering all the questions.
### Instruction:
{question}
### Input:
{choices}
### Response: {answer}
'''
```
* Evaluation prompt
```
INS_PROMPT = '''
You are a helpful assistant in evaluating the quality of the outputs for a given instruction. Please propose at most a precise answer about whether a potential output is a good output for a given instruction. Another assistant will evaluate different aspects of the output by answering all the questions.
### Instruction:
{question}
### Input:
{choices}
### Rationale:
'''
```
## How to Get Started with the Model
Use the code below to get started with the model.
```
import torch
from peft import PeftModel
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name_or_path = "meta-math/MetaMath-Mistral-7B"
lora_path = "tienda02/metamath-mistral7B-lora"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=False)
model = AutoModelForCausalLM.from_pretrained(model_name_or_path, device_map='auto')
model = PeftModel.from_pretrained(model, lora_path)
model = model.merge_and_unload()
```