This guide will help you set up your local environment to run the Phi-3 model using Ollama. You can run the model in a few different ways, including using GitHub Codespaces, VS Code Dev Containers, or your local environment.
You can run this template virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:
A related option is VS Code Dev Containers, which will open the project in your local VS Code using the Dev Containers extension:
-
Start Docker Desktop (install it if not already installed)
-
Open the project:
-
In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.
-
Continue with the deployment steps
-
Make sure the following tools are installed:
-
Ask Ollama to download and run the phi3:mini model:
ollama run phi3:mini
That will take a few minutes to download the model.
-
Once you see "success" in the output, you can send a message to that model from the prompt.
>>> Write a haiku about hungry hippos
-
After several seconds, you should see a response stream in from the model.
-
To learn about different techniques used with language models, open the Python notebook ollama.ipynb and run each cell . If you used a model other than 'phi3:mini', change the
MODEL_NAME
in the first cell. -
To have a conversation with the phi3:mini model from Python, open the Python file chat.py and run it. You can change the
MODEL_NAME
at the top of the file as needed, and you can also modify the system message or add few-shot examples if desired.