Cost Efficiency (Open Source)
Lower Long Term costs
Customised data control
Pre-trained model
Get Your Phi AI Model Running in a Day
Artificial intelligence models like Phi-4 bring immense power to text generation and processing. In this guide, we will walk through how to set up Phi-4 using Docker and Ollama, ensuring a smooth and isolated environment for AI execution.
Before running Phi-4, ensure that you have access to a Linux based system (Ubuntu recommended) with Docker installed. If you're using an AWS EC2 instance, connect to it first:
ssh -i "your-key.pem" ubuntu@your-ec2-ip
Then, update system packages:
sudo apt update && sudo apt upgrade -y
If Docker isn’t already installed, add it with:
sudo apt install docker.io -y
sudo systemctl start docker
sudo systemctl enable docker
To run Phi-4, you first need Ollama, a containerized environment optimized for large models. Set up Ollama with:
docker run -d --name ollama -v ollama:/root/.ollama -p 11434:11434 ollama/ollama
This initializes a background container with persistent storage.
Once the Ollama container is running, access it using:
docker exec -it ollama /bin/bash
Inside the container, pull Phi-4:
ollama pull phi:4
This step downloads all necessary dependencies.
After installation, start the Phi-4 model with:
ollama run phi:4
To check if it's working, enter a sample query:
>>> What are the key differences between deep learning and machine learning?
To simplify interactions, you can deploy a browser based UI:
docker run -d --name ollama-ui -p 4200:8080 -e
LLAMA_BASE_URL=http://<YOUR-EC2-IP>:11434 -v open
webui:/app/backend/data --restart always
ghcr.io/open-webui/open webui:main
Access the UI via http://<YOUR-EC2-IP>:4200.
Deploying Phi-4 using Docker and Ollama offers a seamless way to interact with the model while maintaining an efficient environment. Whether using the command-line or a web UI, this setup ensures easy access and optimal performance.
Ready to transform your business with our technology solutions? Contact Us today to Leverage Our AI/ML Expertise.