Text Generation
PEFT
Safetensors
Transformers
chemistry
educational-ai
lora
qlora
sft
trl
unsloth
reasoning
local-llm
conversational
Instructions to use rish3on3AI/chem-Phi-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use rish3on3AI/chem-Phi-Mini with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/phi-4-mini-reasoning-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "rish3on3AI/chem-Phi-Mini") - Transformers
How to use rish3on3AI/chem-Phi-Mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rish3on3AI/chem-Phi-Mini") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("rish3on3AI/chem-Phi-Mini", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rish3on3AI/chem-Phi-Mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rish3on3AI/chem-Phi-Mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rish3on3AI/chem-Phi-Mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rish3on3AI/chem-Phi-Mini
- SGLang
How to use rish3on3AI/chem-Phi-Mini 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 "rish3on3AI/chem-Phi-Mini" \ --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": "rish3on3AI/chem-Phi-Mini", "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 "rish3on3AI/chem-Phi-Mini" \ --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": "rish3on3AI/chem-Phi-Mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use rish3on3AI/chem-Phi-Mini with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for rish3on3AI/chem-Phi-Mini to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for rish3on3AI/chem-Phi-Mini to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for rish3on3AI/chem-Phi-Mini to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="rish3on3AI/chem-Phi-Mini", max_seq_length=2048, ) - Docker Model Runner
How to use rish3on3AI/chem-Phi-Mini with Docker Model Runner:
docker model run hf.co/rish3on3AI/chem-Phi-Mini
| base_model: unsloth/phi-4-mini-reasoning-unsloth-bnb-4bit | |
| library_name: peft | |
| model_name: ChemPhi-Mini | |
| license: apache-2.0 | |
| pipeline_tag: text-generation | |
| tags: | |
| - chemistry | |
| - educational-ai | |
| - lora | |
| - qlora | |
| - sft | |
| - transformers | |
| - trl | |
| - unsloth | |
| - reasoning | |
| - peft | |
| - local-llm | |
| # ChemPhi-Mini | |
| ChemPhi-Mini is a lightweight chemistry-focused reasoning model fine-tuned from `unsloth/phi-4-mini-reasoning-unsloth-bnb-4bit` using supervised fine-tuning (SFT). | |
| This project explores efficient domain adaptation for educational AI systems under constrained hardware environments. The goal was to build a compact chemistry tutoring and reasoning assistant capable of running locally with minimal GPU resources while maintaining useful scientific explanation capabilities. | |
| --- | |
| # Project Goals | |
| This project was built to explore: | |
| - Parameter-efficient fine-tuning (PEFT) | |
| - Low-resource LLM training workflows | |
| - Chemistry-focused educational reasoning | |
| - Lightweight local AI systems | |
| - Quantized inference and deployment | |
| - Linux-based AI experimentation | |
| The model is part of a broader self-hosted AI and systems engineering learning workflow involving: | |
| - Linux infrastructure | |
| - Local inference pipelines | |
| - GPU-constrained experimentation | |
| - Open-source AI tooling | |
| --- | |
| # Base Model | |
| Base model used: | |
| `unsloth/phi-4-mini-reasoning-unsloth-bnb-4bit` | |
| Core characteristics: | |
| - Phi-4 Mini Reasoning architecture | |
| - 4-bit quantized | |
| - Optimized using the Unsloth ecosystem | |
| - Designed for efficient fine-tuning and inference | |
| --- | |
| # Training Method | |
| This model was fine-tuned using: | |
| - LoRA (Low-Rank Adaptation) | |
| - PEFT | |
| - TRL SFTTrainer | |
| - 4-bit quantization | |
| - Supervised Fine-Tuning (SFT) | |
| Training focused on: | |
| - Chemistry explanations | |
| - Conceptual reasoning | |
| - Educational QA | |
| - Scientific response formatting | |
| --- | |
| # Hardware & Environment | |
| Training environment: | |
| - Google Colab | |
| - NVIDIA T4 GPU | |
| - CUDA-enabled PyTorch stack | |
| This project specifically explored practical AI development under limited VRAM conditions. | |
| --- | |
| # Tech Stack | |
| - Transformers | |
| - TRL | |
| - PEFT | |
| - Unsloth | |
| - PyTorch | |
| - Hugging Face ecosystem | |
| Framework versions: | |
| - PEFT 0.19.1 | |
| - TRL 0.24.0 | |
| - Transformers 5.5.0 | |
| - PyTorch 2.10.0+cu128 | |
| - Datasets 4.3.0 | |
| - Tokenizers 0.22.2 | |
| --- | |
| # Example Usage | |
| ```python | |
| from transformers import pipeline | |
| generator = pipeline( | |
| "text-generation", | |
| model="rish3on3AI/ChemPhi-Mini", | |
| device="cuda" | |
| ) | |
| messages = [ | |
| { | |
| "role": "user", | |
| "content": "Explain why increasing temperature favors endothermic reactions." | |
| } | |
| ] | |
| output = generator( | |
| messages, | |
| max_new_tokens=256, | |
| return_full_text=False | |
| ) | |
| print(output[0]["generated_text"]) |