0
stars
3
commits
2
linked in READMEs
Jan 11, 2026
updated
This model is a fine-tuned version of mistralai/Devstral-Small-2-24B-Instruct-2512. It has been trained using TRL. TRL (Transformer Reinforcement Learning) is HuggingFace's library for training language models with reinforcement learning, including supervised fine-tuning. This repository is tested on a Devstral-Small-2-24B-Instruct-2512 model which is Supervised Fine-tuned using the open-thoughts/OpenThoughts-Agent-v1-SFT dataset. The LoRA adapter is then directly pushed under Madhurprash/Devstral-Small-2-24B-Instruct-2512-SFT-LoRA-OpenThoughts here. This adapter can then be directly merged into the base model and tested on the Terminal Bench 2.0 benchmark.
from transformers import pipeline
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
generator = pipeline("text-generation", model="None", device="cuda")
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
This model was trained with SFT.
This guide covers the complete workflow for fine-tuning models with LoRA adapters, merging them with base models, and deploying them using vLLM. This repository is tested on a Devstral-Small-2-24B-Instruct-2512 model which is Supervised Fine-tuned using the open-thoughts/OpenThoughts-Agent-v1-SFT dataset. The LoRA adapter is then directly pushed under Madhurprash/Devstral-Small-2-24B-Instruct-2512-SFT-LoRA-OpenThoughts here. This adapter can then be directly merged into the base model and tested on the Terminal Bench 2.0 benchmark.
The LoRA adapter will be saved to the output directory specified in your training configuration.
Note: Specific training scripts should be configured based on your model architecture and dataset requirements.
After training, you have two options:
Use the generic merge script that loads configuration from vLLM/config.yaml:
python merge_lora.py
With custom configuration:
python merge_lora.py --config /path/to/config.yaml
Override specific parameters:
python merge_lora.py \
--base-model "mistralai/Devstral-Small-2-24B-Instruct-2512" \
--adapter-path "./outputs/devstral-sft" \
--output-path "./outputs/merged-devstral-sft"
For Mistral models specifically:
python merge_mistral_lora.py
This script is hardcoded for Mistral3ForConditionalGeneration and uses the original configuration.
The push_to_hf.py script provides three modes for uploading to HuggingFace Hub:
Merge the LoRA adapter with the base model and push the merged model:
python push_to_hf.py \
--hf-repo-id "your-username/your-model-name" \
--mode merge
With HuggingFace token:
python push_to_hf.py \
--hf-repo-id "your-username/your-model-name" \
--hf-token "your_hf_token_here" \
--mode merge
Push only the LoRA adapter without merging:
python push_to_hf.py --hf-repo-id yourusername/repo-id --mode adapter --adapter-path adapter-path --hf-token your-hf-token
Push an already merged model:
python push_to_hf.py \
--hf-repo-id "your-username/your-model-name" \
--mode existing \
--model-path "/path/to/merged/model"
You can provide your HuggingFace token in three ways:
--hf-token "your_token"huggingface-cli login beforehandHF_TOKEN in your environmentThe vLLM server supports serving merged models or using LoRA adapters dynamically.
Navigate to the vLLM directory and run:
cd ../../vLLM
python serve.py
The server will:
config.yamlhttp://localhost:8000Edit vLLM/config.yaml to configure:
model_information:
model_config:
is_model_local: true
model_path: "/path/to/merged/model"
vllm_engine_config:
enable_lora: false
model_information:
model_config:
is_model_local: false
model_id: "mistralai/Devstral-Small-2-24B-Instruct-2512"
vllm_engine_config:
enable_lora: true
lora_modules:
devstral-sft: "/path/to/adapter"
max_loras: 1
max_lora_rank: 8
Once the server is running, you can use it like any OpenAI-compatible API:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="not-needed"
)
response = client.chat.completions.create(
model="devstral-sft", # or your model name
messages=[
{"role": "user", "content": "Hello, how are you?"}
]
)
vLLM/config.yamlgeneral:
name: "agentic-SLM-vllm-deployment"
description: "vLLM deployment configuration"
model_information:
model_config:
is_model_local: false
model_id: "your-model-id"
model_path: "/path/to/local/model"
trust_remote_code: true
dtype: "auto"
vllm_engine_config:
max_model_len: 32768
tensor_parallel_size: 8
tool_call_parser: "mistral"
enable_auto_tool_choice: true
enable_lora: false
lora_modules:
adapter-name: "/path/to/adapter"
max_loras: 1
max_lora_rank: 8
inference_parameters:
temperature: 0.6
max_tokens: 8192
lora_merge:
base_model: "mistralai/Devstral-Small-2-24B-Instruct-2512"
adapter_path: "/path/to/adapter"
output_path: "/path/to/output"
true to load from local path, false for HuggingFace Hubis_model_local: false)is_model_local: true)true to enable dynamic LoRA adapter loadingHere's a complete example workflow:
# Your training script here
python train.py --output-dir ./outputs/devstral-sft
Edit ../../vLLM/config.yaml:
lora_merge:
base_model: "mistralai/Devstral-Small-2-24B-Instruct-2512"
adapter_path: "./outputs/devstral-sft"
output_path: "./outputs/merged-devstral-sft"
python merge_lora.py
python push_to_hf.py \
--hf-repo-id "your-username/devstral-sft" \
--mode merge \
--hf-token "your_token"
Update ../../vLLM/config.yaml to use your model:
model_information:
model_config:
is_model_local: false
model_id: "your-username/devstral-sft"
cd ../../vLLM
python serve.py
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "your-username/devstral-sft",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Out of Memory Errors
max_model_lentensor_parallel_sizeHuggingFace Authentication Failed
huggingface-cli login--hf-tokenvLLM Server Won't Start
config.yaml syntaxLoRA Adapter Not Loading
enable_lora: true in configmax_lora_rank matches your adapterCite TRL as:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
3 commits
0
stars
3
commits
2
linked in READMEs
Jan 11, 2026
updated
This model is a fine-tuned version of mistralai/Devstral-Small-2-24B-Instruct-2512. It has been trained using TRL. TRL (Transformer Reinforcement Learning) is HuggingFace's library for training language models with reinforcement learning, including supervised fine-tuning. This repository is tested on a Devstral-Small-2-24B-Instruct-2512 model which is Supervised Fine-tuned using the open-thoughts/OpenThoughts-Agent-v1-SFT dataset. The LoRA adapter is then directly pushed under Madhurprash/Devstral-Small-2-24B-Instruct-2512-SFT-LoRA-OpenThoughts here. This adapter can then be directly merged into the base model and tested on the Terminal Bench 2.0 benchmark.
from transformers import pipeline
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
generator = pipeline("text-generation", model="None", device="cuda")
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
This model was trained with SFT.
This guide covers the complete workflow for fine-tuning models with LoRA adapters, merging them with base models, and deploying them using vLLM. This repository is tested on a Devstral-Small-2-24B-Instruct-2512 model which is Supervised Fine-tuned using the open-thoughts/OpenThoughts-Agent-v1-SFT dataset. The LoRA adapter is then directly pushed under Madhurprash/Devstral-Small-2-24B-Instruct-2512-SFT-LoRA-OpenThoughts here. This adapter can then be directly merged into the base model and tested on the Terminal Bench 2.0 benchmark.
The LoRA adapter will be saved to the output directory specified in your training configuration.
Note: Specific training scripts should be configured based on your model architecture and dataset requirements.
After training, you have two options:
Use the generic merge script that loads configuration from vLLM/config.yaml:
python merge_lora.py
With custom configuration:
python merge_lora.py --config /path/to/config.yaml
Override specific parameters:
python merge_lora.py \
--base-model "mistralai/Devstral-Small-2-24B-Instruct-2512" \
--adapter-path "./outputs/devstral-sft" \
--output-path "./outputs/merged-devstral-sft"
For Mistral models specifically:
python merge_mistral_lora.py
This script is hardcoded for Mistral3ForConditionalGeneration and uses the original configuration.
The push_to_hf.py script provides three modes for uploading to HuggingFace Hub:
Merge the LoRA adapter with the base model and push the merged model:
python push_to_hf.py \
--hf-repo-id "your-username/your-model-name" \
--mode merge
With HuggingFace token:
python push_to_hf.py \
--hf-repo-id "your-username/your-model-name" \
--hf-token "your_hf_token_here" \
--mode merge
Push only the LoRA adapter without merging:
python push_to_hf.py --hf-repo-id yourusername/repo-id --mode adapter --adapter-path adapter-path --hf-token your-hf-token
Push an already merged model:
python push_to_hf.py \
--hf-repo-id "your-username/your-model-name" \
--mode existing \
--model-path "/path/to/merged/model"
You can provide your HuggingFace token in three ways:
--hf-token "your_token"huggingface-cli login beforehandHF_TOKEN in your environmentThe vLLM server supports serving merged models or using LoRA adapters dynamically.
Navigate to the vLLM directory and run:
cd ../../vLLM
python serve.py
The server will:
config.yamlhttp://localhost:8000Edit vLLM/config.yaml to configure:
model_information:
model_config:
is_model_local: true
model_path: "/path/to/merged/model"
vllm_engine_config:
enable_lora: false
model_information:
model_config:
is_model_local: false
model_id: "mistralai/Devstral-Small-2-24B-Instruct-2512"
vllm_engine_config:
enable_lora: true
lora_modules:
devstral-sft: "/path/to/adapter"
max_loras: 1
max_lora_rank: 8
Once the server is running, you can use it like any OpenAI-compatible API:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="not-needed"
)
response = client.chat.completions.create(
model="devstral-sft", # or your model name
messages=[
{"role": "user", "content": "Hello, how are you?"}
]
)
vLLM/config.yamlgeneral:
name: "agentic-SLM-vllm-deployment"
description: "vLLM deployment configuration"
model_information:
model_config:
is_model_local: false
model_id: "your-model-id"
model_path: "/path/to/local/model"
trust_remote_code: true
dtype: "auto"
vllm_engine_config:
max_model_len: 32768
tensor_parallel_size: 8
tool_call_parser: "mistral"
enable_auto_tool_choice: true
enable_lora: false
lora_modules:
adapter-name: "/path/to/adapter"
max_loras: 1
max_lora_rank: 8
inference_parameters:
temperature: 0.6
max_tokens: 8192
lora_merge:
base_model: "mistralai/Devstral-Small-2-24B-Instruct-2512"
adapter_path: "/path/to/adapter"
output_path: "/path/to/output"
true to load from local path, false for HuggingFace Hubis_model_local: false)is_model_local: true)true to enable dynamic LoRA adapter loadingHere's a complete example workflow:
# Your training script here
python train.py --output-dir ./outputs/devstral-sft
Edit ../../vLLM/config.yaml:
lora_merge:
base_model: "mistralai/Devstral-Small-2-24B-Instruct-2512"
adapter_path: "./outputs/devstral-sft"
output_path: "./outputs/merged-devstral-sft"
python merge_lora.py
python push_to_hf.py \
--hf-repo-id "your-username/devstral-sft" \
--mode merge \
--hf-token "your_token"
Update ../../vLLM/config.yaml to use your model:
model_information:
model_config:
is_model_local: false
model_id: "your-username/devstral-sft"
cd ../../vLLM
python serve.py
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "your-username/devstral-sft",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Out of Memory Errors
max_model_lentensor_parallel_sizeHuggingFace Authentication Failed
huggingface-cli login--hf-tokenvLLM Server Won't Start
config.yaml syntaxLoRA Adapter Not Loading
enable_lora: true in configmax_lora_rank matches your adapterCite TRL as:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
3 commits