Instructions to use brodatech/finance-phi3-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use brodatech/finance-phi3-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="brodatech/finance-phi3-gguf", filename="phi-3-mini-4k-instruct.Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use brodatech/finance-phi3-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf brodatech/finance-phi3-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf brodatech/finance-phi3-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf brodatech/finance-phi3-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf brodatech/finance-phi3-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf brodatech/finance-phi3-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf brodatech/finance-phi3-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf brodatech/finance-phi3-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf brodatech/finance-phi3-gguf:Q4_K_M
Use Docker
docker model run hf.co/brodatech/finance-phi3-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use brodatech/finance-phi3-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "brodatech/finance-phi3-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "brodatech/finance-phi3-gguf", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/brodatech/finance-phi3-gguf:Q4_K_M
- Ollama
How to use brodatech/finance-phi3-gguf with Ollama:
ollama run hf.co/brodatech/finance-phi3-gguf:Q4_K_M
- Unsloth Studio
How to use brodatech/finance-phi3-gguf 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 brodatech/finance-phi3-gguf 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 brodatech/finance-phi3-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for brodatech/finance-phi3-gguf to start chatting
- Docker Model Runner
How to use brodatech/finance-phi3-gguf with Docker Model Runner:
docker model run hf.co/brodatech/finance-phi3-gguf:Q4_K_M
- Lemonade
How to use brodatech/finance-phi3-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull brodatech/finance-phi3-gguf:Q4_K_M
Run and chat with the model
lemonade run user.finance-phi3-gguf-Q4_K_M
List all available models
lemonade list
| pipeline_tag: text-generation | |
| library_name: gguf | |
| tags: | |
| - finance | |
| - phi3 | |
| - unsloth | |
| - llama-cpp | |
| - gguf-4bit | |
| # ๐ Financial Analyst AI (Phi-3 Mini 4K Instruct) | |
| This is a fine-tuned, 4-bit quantized (GGUF) version of Microsoft's `Phi-3-Mini-4k-instruct`, specialized in professional financial analysis, stock market valuation, and corporate finance. | |
| The model was trained using **Unsloth** on a financial instruction dataset and has been aggressively optimized for low-memory environments. It easily runs on standard laptops with less than **3GB of RAM** while maintaining high factual accuracy. | |
| --- | |
| # ๐ง Model Persona & Use Cases | |
| This model is explicitly trained to act as a **Professional Financial Analyst**. | |
| It is best used for: | |
| - Stock market analysis and valuation metrics | |
| - Corporate finance and accounting principles | |
| - Investment strategy and portfolio management | |
| - Explaining economic trends and market indicators | |
| - Risk assessment and financial modeling | |
| --- | |
| # ๐ How to Use | |
| You can interact with this model directly in your browser, via Ollama, or using Python. | |
| --- | |
| ## Option 1: Hugging Face Widget | |
| You can test the model immediately using the **Hosted Inference API** widget on the right side of this page. | |
| > **Note:** Because this is a GGUF model, it may take **15โ30 seconds** to load into Hugging Face's server RAM on the first prompt. | |
| --- | |
| ## Option 2: Run Locally via Ollama | |
| If you have Ollama installed, you can pull and run the model directly from this repository with a single command. | |
| It will automatically download the weights and apply the correct system prompt. | |
| ```bash | |
| ollama run hf.co/Wellwisher12/finance-phi3-gguf | |
| ``` | |
| --- | |
| ## Option 3: Run via Python (`main.py`) | |
| This repository includes `main.py` script that utilizes `llama-cpp-python` to run the model with strict memory constraints (`n_ctx=1024`) to prevent out-of-memory errors on local machines. | |
| ### Prerequisites | |
| ```bash | |
| pip install llama-cpp-python huggingface-hub | |
| ``` | |
| ### Execution | |
| ```bash | |
| # Clone the repository | |
| git clone https://huggingface.co/Wellwisher12/finance-phi3-gguf | |
| # Navigate into the directory | |
| cd finance-phi3-gguf | |
| # Launch the interactive terminal | |
| python main.py | |
| ``` | |
| --- | |
| # โ๏ธ Required System Prompt | |
| To achieve the best and most accurate results, the model should be initialized with the following system prompt. | |
| > **Note:** This is automatically handled if you use the provided `Modelfile` or `main.py` script. | |
| ```text | |
| You are a professional Financial Analyst with expertise in: | |
| - Stock market analysis and valuation | |
| - Corporate finance and accounting | |
| - Investment strategy and portfolio management | |
| - Economic trends and market indicators | |
| - Risk assessment and financial modeling | |
| Your responses should be: | |
| - Accurate and data-driven | |
| - Professional and neutral in tone | |
| - Comprehensive yet concise | |
| - Based on sound financial principles | |
| Always provide specific examples and metrics when relevant. | |
| ``` | |
| --- | |
| # ๐ Technical Specifications | |
| | Specification | Details | | |
| |---|---| | |
| | Base Model | `unsloth/phi-3-mini-4k-instruct` | | |
| | Dataset | `gbharti/finance-alpaca` | | |
| | Quantization | `Q4_K_M (4-bit)` | | |
| | Format | `GGUF` | | |
| | Recommended Temperature | `0.2` | | |
| | Recommended Context Window | `1024 - 2048 tokens` | | |
| --- | |
| # โ Key Features | |
| - Fine-tuned specifically for financial reasoning tasks | |
| - Lightweight and optimized for low-RAM systems | |
| - Compatible with Ollama and `llama.cpp` | |
| - Quantized GGUF format for efficient local inference | |
| - Professional analyst-style responses | |
| - Reduced hallucinations with low-temperature inference | |
| --- | |
| # ๐ก Recommended Hardware | |
| | Hardware | Recommendation | | |
| |---|---| | |
| | RAM | Minimum 4GB | | |
| | CPU | Modern multi-core CPU | | |
| | GPU | Optional | | |
| | Storage | ~2-3GB free space | | |
| --- | |
| # ๐ Example Prompt | |
| ```text | |
| Analyze Apple's current valuation using P/E ratio, revenue growth, and free cash flow trends. | |
| ``` | |
| --- | |
| # ๐ License | |
| Please follow the licensing terms of the original base model and dataset used in this project. | |
| - Base Model: `Microsoft Phi-3 Mini` | |
| - Dataset: `finance-alpaca` | |
| --- | |
| # ๐ Credits | |
| - Microsoft for the Phi-3 architecture | |
| - Unsloth for efficient fine-tuning | |
| - Hugging Face ecosystem | |
| - Finance-Alpaca dataset contributors |