This is MetaMath-Mistral-2x7B Mixture of Experts (MOE) model created using mergekit for experimental and learning purpose of MOE.
Merge Details
Merge Method
This model was merged using the SLERP merge method using meta-math/MetaMath-Mistral-7B as the base model.
Models Merged
The following models were included in the merge:
Configuration
The following YAML configuration was used to produce this model:
slices:
- sources:
- model: meta-math/MetaMath-Mistral-7B
layer_range: [0, 32]
- model: meta-math/MetaMath-Mistral-7B
layer_range: [0, 32]
merge_method: slerp
base_model: meta-math/MetaMath-Mistral-7B
parameters:
t:
- filter: self_attn
value: [0, 0.5, 0.3, 0.7, 1]
- filter: mlp
value: [1, 0.5, 0.7, 0.3, 0]
- value: 0.5
dtype: bfloat16
Inference Code
## install dependencies
## !pip install -q -U git+https://github.com/huggingface/transformers.git
## !pip install -q -U git+https://github.com/huggingface/accelerate.git
## !pip install -q -U sentencepiece
## load model
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model_name = "harshitv804/MetaMath-Mistral-2x7B"
# load the model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(
model_name,
trust_remote_code=True
)
tokenizer.pad_token = tokenizer.eos_token
## inference
query = "Maximoff's monthly bill is $60 per month. His monthly bill increased by thirty percent when he started working at home. How much is his total monthly bill working from home?"
prompt =f"""
Below is an instruction that describes a task. Write a response that appropriately completes the request.\n
### Instruction:\n
{query}\n
### Response: Let's think step by step.
"""
# tokenize the input string
inputs = tokenizer(
prompt,
return_tensors="pt",
return_attention_mask=False
)
# generate text using the model
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
outputs = model.generate(**inputs, max_length=2048, streamer=streamer)
# decode and print the output
text = tokenizer.batch_decode(outputs)[0]
Citation
@article{yu2023metamath,
title={MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Models},
author={Yu, Longhui and Jiang, Weisen and Shi, Han and Yu, Jincheng and Liu, Zhengying and Zhang, Yu and Kwok, James T and Li, Zhenguo and Weller, Adrian and Liu, Weiyang},
journal={arXiv preprint arXiv:2309.12284},
year={2023}
}
@article{jiang2023mistral,
title={Mistral 7B},
author={Jiang, Albert Q and Sablayrolles, Alexandre and Mensch, Arthur and Bamford, Chris and Chaplot, Devendra Singh and Casas, Diego de las and Bressand, Florian and Lengyel, Gianna and Lample, Guillaume and Saulnier, Lucile and others},
journal={arXiv preprint arXiv:2310.06825},
year={2023}
}
- Downloads last month
- 71
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for harshitv804/MetaMath-Mistral-2x7B
Base model
meta-math/MetaMath-Mistral-7B