Model Details
This model is an int4 model with group_size 128 and symmetric quantization of mistralai/Mistral-Small-3.1-24B-Instruct-2503 generated by intel/auto-round algorithm.
Please follow the license of the original model.
INT4 Inference
Requirements
pip install git+https://github.com/huggingface/transformers.git
Note: There is no official HuggingFace sample code of the original model. The following code may have issues.
from transformers import AutoProcessor, Mistral3ForConditionalGeneration, AutoTokenizer
from huggingface_hub import hf_hub_download
import torch
from datetime import datetime, timedelta
model_id = "OPEA/Mistral-Small-3.1-24B-Instruct-2503-int4-AutoRound-awq-sym"
def load_system_prompt(repo_id: str, filename: str) -> str:
file_path = hf_hub_download(repo_id=repo_id, filename=filename)
with open(file_path, "r") as file:
system_prompt = file.read()
today = datetime.today().strftime("%Y-%m-%d")
yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
model_name = repo_id.split("/")[-1]
return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
SYSTEM_PROMPT = load_system_prompt(model_id, "SYSTEM_PROMPT.txt")
model = Mistral3ForConditionalGeneration.from_pretrained(
model_id, torch_dtype=torch.float16, device_map="auto"
).eval()
processor = AutoProcessor.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id)
url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
prompt = "Which of the depicted countries has the best food? Which the second and third and fourth? Name the country, its color on the map and one its city that is visible on the map, but is not the capital. Make absolutely sure to only name a city that can be seen on the map."
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{
"role": "user",
"content": [
{
"type": "text",
"text": prompt,
},
{"type": "image"}
],
},
]
inputs = processor.apply_chat_template(
messages, add_generation_prompt=True, tokenize=False,
return_dict=True
)
inputs =processor(images=url,
text=inputs,
add_special_tokens=False,
return_tensors="pt").to(model.device).to(torch.float16)
input_len = inputs["input_ids"].shape[-1]
with torch.inference_mode():
generation = model.generate(**inputs, max_new_tokens=512, do_sample=True)
generation = generation[0][input_len:]
decoded = processor.decode(generation, skip_special_tokens=True)
print(decoded)
"""
Your question is subjective as the "best food" can vary greatly depending on personal preferences. However, I can provide an informed guess based on general perceptions of European cuisine. Let's break it down from the map:
1. **Italy (Green)** - Known for its diverse and rich culinary tradition. A non-capital city visible on the map is Rome.
2. **France (Light Brown)** - Famous for its fine dining and gourmet cuisine. A non-capital city visible on the map is Marseille.
3. **Spain (Yellow)** - Renowned for its vibrant and flavorful dishes. A non-capital city visible on the map is Barcelona.
4. **Germany (Orange)** - Known for its hearty and diverse cuisine. A non-capital city visible on the map is Munich.
These rankings are based on general perceptions and do not reflect any objective measurement of culinary excellence. Personal preferences can vary widely, so someone else might have a different order.
"""
Generate the model
Here is the sample command to reproduce the model.
pip install git+https://github.com/intel/auto-round.git@main
auto-round-mllm \
--model mistralai/Mistral-Small-3.1-24B-Instruct-2503 \
--device 0 \
--bits 4 \
--format 'auto_awq,auto_gptq' \
--output_dir "./tmp_autoround"
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
- 0
Model tree for OPEA/Mistral-Small-3.1-24B-Instruct-2503-int4-AutoRound-awq-sym
Base model
mistralai/Mistral-Small-3.1-24B-Base-2503