Model Details
This model is an int4 model with group_size 64 and symmetric quantization of MiniMaxAI/MiniMax-M1-40k generated by intel/auto-round algorithm.
Please follow the license of the original model.
This model experiences a significant accuracy degradation compared to the original(mmlu 0.7516 vs 0.7915). Caution is advised when deploying it.
How To Use
INT4 Inference(CPU/CUDA/INTEL GPU)
for intel gpu, requires auto-round>0.5.1
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
MODEL_PATH = "Intel/MiniMax-M1-40k-int4-AutoRound-gptq-inc-v0"
model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, torch_dtype="auto", device_map="auto", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH, trust_remote_code=True)
prompts = [
"What is your favourite condiment?",
"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!",
"Do you have mayonnaise recipes?"
]
texts = []
for prompt in prompts:
messages = [
{"role": "user", "content": [{"type": "text", "text": prompt}]}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
texts.append(text)
tokenizer.pad_token = tokenizer.eos_token
inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True).to(model.device)
generation_config = GenerationConfig(
max_new_tokens=512,
eos_token_id=tokenizer.eos_token_id,
do_sample=False
)
generated_ids = model.generate(input_ids=inputs["input_ids"].to(model.device), generation_config=generation_config)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
for i, prompt in enumerate(prompts):
input_id = inputs
print(f"Prompt: {prompt}")
print(f"Generated: {response[i]}")
print("-" * 50)
"""
--------------------------------------------------
Prompt: Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!Do you have mayonnai
se recipes?
Generated: user name=user
Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!Do you have mayonnaise recip
es?
ai name=assistant
<think>
Okay, the user is asking for mayonnaise recipes. Let me start by recalling the basics of mayonnaise. Traditional mayo is made with egg yolks, oil, and some acid like lemon juice or
vinegar. But there are variations, like vegan mayo using different ingredients.
First, I should outline the classic recipe. Maybe start with the basic ingredients: egg yolks, oil, lemon juice or vinegar, mustard, salt, and pepper. Then explain the steps. But wa
it, some people might not know how to make it from scratch, so I should detail the process step by step.
Wait, the user mentioned they like fresh lemon juice. So maybe emphasize using fresh lemon juice instead of vinegar. Also, maybe mention different types of oil, like olive oil or ve
getable oil. But olive oil can be strong, so maybe a mix of oils?
Then, think about variations. The user might want different flavors. For example, adding herbs, garlic, or other spices. Also, vegan options using aquafaba or other substitutes. May
be a recipe using avocado for a healthier version.
Also, consider the texture. Some people might want a thicker or thinner mayo. Maybe mention adjusting the oil quantity. Or using different types of mustard for flavor variations.
Wait, the user asked for recipes, so maybe list a few different ones. Classic, vegan, garlic, herb, etc. But need to make sure the instructions are clear. Also, check if there are a
ny common mistakes in making mayo, like adding oil too fast, which can cause splitting.
Hmm, maybe start with the classic recipe, then variations. Also, note that homemade mayo doesn't have preservatives, so it should be used within a week or so. Maybe mention storage
tips.
Wait, the user might not know that mayo can be made at home easily. So maybe start with the basic recipe, then list other variations. Also, check if there are any dietary restrictio
ns, like vegan or egg-free. But the user didn't specify, so maybe just provide a few options.
Also, think about the tools needed. A blender or food processor, or a whisk. Maybe mention that if you don't have a blender, you can do it by hand, but it's more work.
Wait, the user might not have a blender, so maybe include a method using a whisk. But that could take longer. Alternatively, use a hand mixer or immersion blender.
Also, the ratio of oil to egg yolks. Typically, mayo uses about 1 cup of oil per egg yolk. But maybe adjust that for different consist
--------------------------------------------------
Prompt: What is your favourite condiment?
Generated: user name=user
What is your favourite condiment?
ai name=assistant
<think>
Okay, the user is asking about my favorite condiment. Let me think. First, I need to recall what a condiment is. Condiments are things like ketchup, mustard, mayo, etc. But since I'
m an AI, I don't have personal preferences. So I should explain that I don't have a favorite, but maybe mention some common ones.
Wait, the user might be looking for a fun answer. Maybe they want to know which condiment is popular or something. But I should clarify that I don't have preferences. Then, perhaps
list some popular condiments. Let me check if there's a standard answer for this. Maybe mention a few like ketchup, mustard, mayo, etc. But I need to make sure the answer is helpful
and not too technical. Also, maybe add a bit of humor or a light-hearted response. Let me structure the response: start by saying I don't have a favorite, then list some common one
s, and maybe add a joke or a fun fact. Yeah, that should work. Let me put that together.
</think>
I don’t have personal preferences, but if I *had* to pick a favorite condiment, I’d probably go with **mayo**—it’s creamy, versatile, and pairs well with almost anything (though
--------------------------------------------------
Prompt: Do you have mayonnaise recipes?
Generated: user name=user
Do you have mayonnaise recipes?
ai name=assistant
<think>
Okay, the user is asking if I have mayonnaise recipes. Let me start by recalling the previous conversation. They mentioned they have a lot of eggs and are looking for recipes. I gav
e them some egg-based recipes like deviled eggs, egg salad, and a frittata. Now they're asking about mayonnaise recipes.
Hmm, mayonnaise is made with eggs, so that makes sense. They probably want to use up their eggs. But I need to make sure I provide a good recipe. Let me think about the basic ingred
ients for mayonnaise. It's typically egg yolks, oil, lemon juice or vinegar, and seasonings. But maybe they want a homemade version instead of store-bought.
Wait, the user might not know how to make mayonnaise from scratch. So I should explain the steps clearly. Also, maybe they have specific dietary needs, like if they want a vegan ver
sion or something. But since they mentioned eggs, maybe they just want a classic recipe.
I should start by outlining the basic ingredients. Then, maybe give a step-by-step method. Also, mention variations if possible. For example, using different oils or adding flavors
like garlic or herbs. But I need to keep it simple. Let me check if I have a standard mayonnaise recipe in my knowledge.
Yes, the basic recipe is egg yolks, oil, lemon juice, and mustard. But some people use only egg yolks, others use whole eggs. I should clarify that. Also, the type of oil matters. M
aybe suggest a neutral oil like vegetable or canola, but some people use olive oil for a different flavor.
Wait, but olive oil can make the mayo taste stronger. Maybe mention that. Also, the method of adding oil slowly to emulsify. If they don't have a blender or food processor, they can
do it by hand with a whisk. But that might take longer.
I should also mention the possibility of using a blender or food processor to make it easier. Also, maybe some tips on how to fix if the mayo breaks, like adding a bit more water or
another egg yolk.
Wait, but the user might not know about emulsification. So I should explain that part. Also, maybe give a simple recipe first, then variations. Let me structure the answer: start wi
th the basic recipe, then maybe some variations or tips.
Also, check if there are any common mistakes people make when making mayo. Like adding oil too quickly, which can cause the emulsion to break. So maybe mention that. Also, the ratio
of oil to egg yolk. Typically,
--------------------------------------------------
"""
Generate the model
For reference, quantization tuning was performed on a single 140GB GPU.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
import transformers
model_name = "MiniMaxAI/MiniMax-M1-40k"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", trust_remote_code=True)
from auto_round import AutoRound
autoround = AutoRound(model=model, tokenizer=tokenizer, nsamples=512,
low_gpu_mem_usage=True, seqlen=2048, group_size=64, sym=True,
batch_size=1, gradient_accumulate_steps=4
)
autoround.quantize_and_save(format="auto_round:auto_gptq", output_dir=f"tmp_autoround/")
Evaluate the model
pip3 install lm-eval==0.4.9
lm-eval --model hf --model_args pretrained=Intel/MiniMax-M1-40k-int4-AutoRound-gptq-inc-v0 --tasks mmlu --batch_size 8
Metric | BF16(lm-eval==0.4.9) | INT4 |
---|---|---|
mmlu | 0.7915 | 0.7516 |
Ethical Considerations and Limitations
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
Therefore, before deploying any applications of the model, developers should perform safety testing.
Caveats and Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
Here are a couple of useful links to learn more about Intel's AI software:
- Intel Neural Compressor link
Disclaimer
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
Cite
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
- Downloads last month
- 20
Model tree for Intel/MiniMax-M1-40k-int4-AutoRound-gptq-inc-v0
Base model
MiniMaxAI/MiniMax-M1-40k