Instructions to use Naitik-sudo123/phi35-mini-gsm8k-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Naitik-sudo123/phi35-mini-gsm8k-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/phi-3.5-mini-instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Naitik-sudo123/phi35-mini-gsm8k-lora") - Transformers
How to use Naitik-sudo123/phi35-mini-gsm8k-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Naitik-sudo123/phi35-mini-gsm8k-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Naitik-sudo123/phi35-mini-gsm8k-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Naitik-sudo123/phi35-mini-gsm8k-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Naitik-sudo123/phi35-mini-gsm8k-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Naitik-sudo123/phi35-mini-gsm8k-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Naitik-sudo123/phi35-mini-gsm8k-lora
- SGLang
How to use Naitik-sudo123/phi35-mini-gsm8k-lora 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 "Naitik-sudo123/phi35-mini-gsm8k-lora" \ --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": "Naitik-sudo123/phi35-mini-gsm8k-lora", "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 "Naitik-sudo123/phi35-mini-gsm8k-lora" \ --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": "Naitik-sudo123/phi35-mini-gsm8k-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use Naitik-sudo123/phi35-mini-gsm8k-lora with Docker Model Runner:
docker model run hf.co/Naitik-sudo123/phi35-mini-gsm8k-lora
- Model Card for Model ID
- Requires a CUDA GPU and
pip install bitsandbytes
Model Card for Model ID
Phi-3.5-mini GSM8K SFT Adapter
The plain supervised fine-tuning (SFT) adapter from a small GSM8K project: a LoRA adapter for Phi-3.5-mini-instruct trained on the GSM8K training set to write step-by-step solutions that end with #### N. It is the starting point of the project; the later adapters are phi35-mini-gsm8k-rft-lora and the final phi35-mini-gsm8k-dpo-lora, which is the one used with the verifier in the demo.
Model Details
Model Description
Developed by: Naitik (Hugging Face: Naitik-sudo123, Kaggle: naitiksudo), student at Keshav Mahavidyalaya, University of Delhi Model type: LoRA adapter (QLoRA-trained) for a causal language model Language: English License: MIT (same as the base model) Finetuned from: unsloth/phi-3.5-mini-instruct-bnb-4bit, a 4-bit, Llama-architecture repackaging of microsoft/Phi-3.5-mini-instruct
Model Sources [optional]
Demo / write-up: https://huggingface.co/spaces/Naitik-sudo123/gsm8k-generator-verifier Author's GitHub: https://github.com/naitiksaxena-sudo
Uses
Direct Use
generating step-by-step solutions to GSM8K-style arithmetic word problems, and serving as a baseline for the later RFT and DPO adapters.
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
anything where a wrong numerical answer has real consequences (finance, medicine, engineering, grading students). It was trained and tested only on GSM8K-style problems.
Bias, Risks, and Limitations
No evaluation reported. This adapter was not evaluated under the project's final evaluation setup, so no accuracy figure is given here. The final DPO adapter's results are on its own card. Narrow training. GSM8K only: English, grade-school arithmetic word problems, one solution style. It is not a general math tutor. 4-bit base. Trained on and intended for the 4-bit quantized base model. Inherited limitations from Phi-3.5-mini-instruct and from GSM8K (possible benchmark contamination in the base model).
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
How to Get Started with the Model
Requires a CUDA GPU and pip install bitsandbytes
from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel
base_id = "unsloth/phi-3.5-mini-instruct-bnb-4bit" # already 4-bit quantized tok = AutoTokenizer.from_pretrained(base_id) base = AutoModelForCausalLM.from_pretrained(base_id, device_map="auto") model = PeftModel.from_pretrained(base, "Naitik-sudo123/phi35-mini-gsm8k-lora")
msgs = [{"role": "user", "content": question}] # training used the chat template text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True) add_special = not (tok.bos_token and text.startswith(tok.bos_token)) inputs = tok(text, return_tensors="pt", add_special_tokens=add_special).to(model.device) out = model.generate(**inputs, max_new_tokens=500, do_sample=False, pad_token_id=tok.eos_token_id) print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
The adapter targets q_proj, k_proj, v_proj, gate_proj and up_proj as separate layers (Llama-format weights), so use the Unsloth repackage above. Microsoft's original checkpoint fuses those layers, and against it only o_proj and down_proj would receive adapter weights.
Training Details
Training Data
The full GSM8K training split (openai/gsm8k, MIT license), 7,473 problems, formatted with the model's chat template (user = question, assistant = worked solution ending in #### N).
Training Procedure
QLoRA with Unsloth and TRL, 1 epoch, 935 steps (batch size 8), learning rate 2e-4, optimizer adamw_8bit, weight decay 0.01, linear schedule, max sequence length 2048, seed 3407. LoRA rank 16, lora_alpha 16, dropout 0, no bias, all seven linear projections (q/k/v/o/gate/up/down_proj). Wall time about 42 minutes.
Preprocessing [optional]
[More Information Needed]
Training Hyperparameters
- Training regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
[More Information Needed]
Environmental Impact
Hardware: Kaggle, 2× NVIDIA T4 Compute time: about 42 minutes
Technical Specifications [optional]
Architecture: Phi-3.5-mini-instruct (decoder-only transformer, loaded as LlamaForCausalLM from the Unsloth repackage) + LoRA adapter Software: PEFT 0.21.0 (recorded in the adapter config); trained with Unsloth and TRL in a Kaggle session (their versions were not recorded).
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
Hugging Face: Naitik-sudo123
Framework versions
- PEFT 0.19.1
- Downloads last month
- 14