Instructions to use mihirpatel1111/ReasonForge-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mihirpatel1111/ReasonForge-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mihirpatel1111/ReasonForge-3B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mihirpatel1111/ReasonForge-3B") model = AutoModelForCausalLM.from_pretrained("mihirpatel1111/ReasonForge-3B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mihirpatel1111/ReasonForge-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mihirpatel1111/ReasonForge-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mihirpatel1111/ReasonForge-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mihirpatel1111/ReasonForge-3B
- SGLang
How to use mihirpatel1111/ReasonForge-3B 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 "mihirpatel1111/ReasonForge-3B" \ --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": "mihirpatel1111/ReasonForge-3B", "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 "mihirpatel1111/ReasonForge-3B" \ --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": "mihirpatel1111/ReasonForge-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use mihirpatel1111/ReasonForge-3B with Docker Model Runner:
docker model run hf.co/mihirpatel1111/ReasonForge-3B
# ReasonForge-3B: Fine-Tuning Llama-3.2-3B-Instruct
This project details the complete end-to-end pipeline for fine-tuning, evaluating, exporting, and running a reasoning model using Unsloth, QLoRA, and Ollama.
🚀 Project Overview
- Base Model:
unsloth/Llama-3.2-3B-Instruct(Quantized 4-bit) - Fine-Tuned Model:
ReasonForge-3B - Dataset:
ServiceNow-AI/R1-Distill-SFT(v0) - Inference & Deployment Engine: Ollama (using GGUF conversion)
🛠️ Step-by-Step Workflow
1. Installation & Environment Setup
We initialize our environment by installing Unsloth, which accelerates training by up to 2x and significantly reduces memory usage:
pip install unsloth
pip install --force-reinstall --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git
2. Loading the Model & Tokenizer
We load a 4-bit quantized version of the Llama-3.2-3B model using Unsloth's FastLanguageModel class:
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "unsloth/Llama-3.2-3B-Instruct",
max_seq_length = 2048,
dtype = None,
load_in_4bit = True,
)
3. Applying PEFT/LoRA Adapters
To optimize parameter-efficient fine-tuning (QLoRA), we attach LoRA adapters onto targeted linear projection layers:
model = FastLanguageModel.get_peft_model(
model,
r = 16,
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
lora_alpha = 16,
lora_dropout = 0,
bias = "none",
use_gradient_checkpointing = "unsloth",
random_state = 3407,
)
4. Dataset Structuring & Fine-Tuning
We map our raw reasoning data using an custom r1_prompt template and train the adapter using SFTTrainer for 30 steps:
trainer_stats = trainer.train()
5. Native Inference & GGUF Conversion
We test the model natively after patching the chat template for inference. The fine-tuned weights are saved locally and exported directly to a GGUF format Llama-3.2-3B-Instruct.Q8_0.gguf using Unsloth's packaging features:
model.save_pretrained_gguf("ReasonForge-3BF", tokenizer)
6. Local Running via Ollama
We set up and launch Ollama within Colab, load the generated GGUF file via a custom Modelfile, and run the model natively through the command line:
# Creating and launching the ollama service
ollama create reasonforge -f ReasonForge-3BF_gguf/Modelfile
ollama run reasonforge "How many r's are in strawberry?"
Uploaded finetuned model
- Developed by: mihirpatel1111
- License: apache-2.0
- Finetuned from model : unsloth/Llama-3.2-3B-Instruct-unsloth-bnb-4bit
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
- Downloads last month
- 35
Model tree for mihirpatel1111/ReasonForge-3B
Base model
meta-llama/Llama-3.2-3B-Instruct