Text Generation
Transformers
Safetensors
mistral3
image-text-to-text
neuralmagic
redhat
llmcompressor
quantized
INT4
conversational
compressed-tensors
Instructions to use RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic") model = AutoModelForMultimodalLM.from_pretrained("RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic
- SGLang
How to use RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic with Docker Model Runner:
docker model run hf.co/RedHatAI/Ministral-3-14B-Instruct-2512-FP8-dynamic
Upload folder using huggingface_hub
Browse files
convert_ministral_hf_to_mistral.py
CHANGED
|
@@ -130,21 +130,21 @@ def convert_state_dict(hf_state_dict, config):
|
|
| 130 |
if "language_model" in hf_key:
|
| 131 |
if hf_key.endswith("q_proj.weight"):
|
| 132 |
tensor = permute_for_mistral_rope(tensor, text_num_attention_heads, text_query_dim, text_hidden_size)
|
| 133 |
-
elif hf_key.endswith("q_proj.weight_scale") and tensor.size(0)
|
| 134 |
tensor = permute_for_mistral_rope(tensor, text_num_attention_heads, text_query_dim, 1)
|
| 135 |
elif hf_key.endswith("k_proj.weight"):
|
| 136 |
tensor = permute_for_mistral_rope(tensor, text_num_key_value_heads, text_key_value_dim, text_hidden_size)
|
| 137 |
-
elif hf_key.endswith("k_proj.weight_scale") and tensor.size(0)
|
| 138 |
tensor = permute_for_mistral_rope(tensor, text_num_key_value_heads, text_key_value_dim, 1)
|
| 139 |
|
| 140 |
if "vision_tower" in hf_key:
|
| 141 |
if hf_key.endswith("q_proj.weight"):
|
| 142 |
tensor = permute_for_mistral_rope(tensor, vision_num_attention_heads, vision_query_dim, vision_hidden_size)
|
| 143 |
-
elif hf_key.endswith("q_proj.weight_scale") and tensor.size(0)
|
| 144 |
tensor = permute_for_mistral_rope(tensor, vision_num_attention_heads, vision_query_dim, 1)
|
| 145 |
elif hf_key.endswith("k_proj.weight"):
|
| 146 |
tensor = permute_for_mistral_rope(tensor, vision_num_key_value_heads, vision_key_value_dim, vision_hidden_size)
|
| 147 |
-
elif hf_key.endswith("k_proj.weight_scale") and tensor.size(0)
|
| 148 |
tensor = permute_for_mistral_rope(tensor, vision_num_key_value_heads, vision_key_value_dim, 1)
|
| 149 |
|
| 150 |
mistral_dict[mistral_key] = tensor
|
|
|
|
| 130 |
if "language_model" in hf_key:
|
| 131 |
if hf_key.endswith("q_proj.weight"):
|
| 132 |
tensor = permute_for_mistral_rope(tensor, text_num_attention_heads, text_query_dim, text_hidden_size)
|
| 133 |
+
elif hf_key.endswith("q_proj.weight_scale") and tensor.size(0) > 1:
|
| 134 |
tensor = permute_for_mistral_rope(tensor, text_num_attention_heads, text_query_dim, 1)
|
| 135 |
elif hf_key.endswith("k_proj.weight"):
|
| 136 |
tensor = permute_for_mistral_rope(tensor, text_num_key_value_heads, text_key_value_dim, text_hidden_size)
|
| 137 |
+
elif hf_key.endswith("k_proj.weight_scale") and tensor.size(0) > 1:
|
| 138 |
tensor = permute_for_mistral_rope(tensor, text_num_key_value_heads, text_key_value_dim, 1)
|
| 139 |
|
| 140 |
if "vision_tower" in hf_key:
|
| 141 |
if hf_key.endswith("q_proj.weight"):
|
| 142 |
tensor = permute_for_mistral_rope(tensor, vision_num_attention_heads, vision_query_dim, vision_hidden_size)
|
| 143 |
+
elif hf_key.endswith("q_proj.weight_scale") and tensor.size(0) > 1:
|
| 144 |
tensor = permute_for_mistral_rope(tensor, vision_num_attention_heads, vision_query_dim, 1)
|
| 145 |
elif hf_key.endswith("k_proj.weight"):
|
| 146 |
tensor = permute_for_mistral_rope(tensor, vision_num_key_value_heads, vision_key_value_dim, vision_hidden_size)
|
| 147 |
+
elif hf_key.endswith("k_proj.weight_scale") and tensor.size(0) > 1:
|
| 148 |
tensor = permute_for_mistral_rope(tensor, vision_num_key_value_heads, vision_key_value_dim, 1)
|
| 149 |
|
| 150 |
mistral_dict[mistral_key] = tensor
|