Ollama User Guide
About 2 min
Ollama User Guide
1. About
Official Website: https://ollama.com/
Github: https://github.com/ollama/ollama
Model Library: https://ollama.com/search
Model Library Information:
- Model Categories: All/Embedding/Vision/Tools
- Model Sorting: Popular/Newest
- Model Name
- Model Description
- Available Parameter Scales
- Model Size, Unique Identifier, Upload Time, and Download Command for Different Scales and Variants
- Download Count (Indicating Popularity)
- Number of Tags (Different Scales and Variant Versions Available for Download)
- Update Date
2. What
Used for local deployment of open-source large models.
Developers can test and debug models locally.
Users can use language models offline to ensure data privacy, fast response times, and complete freedom, all for free.
Features:
- Simple operation, simplified model deployment and management, with a low usage threshold.
- Supports multiple platforms: macOS, Linux, and Windows.
- The model library is comprehensive and updated quickly. In addition to models in the library, users can download GGUF models from HuggingFace, deploy locally downloaded GGUF model files, or create custom models.
3. How To Use (macOS Platform)
3.1. Installing Ollama
- Download from the official website to get Ollama-darwin.zip. Double-click to get Ollama.app, and move it to Applications.
- The first time you open it, you will be prompted to install the command-line tools. Enter the password to authorize, and installation will be complete.
3.2. Downloading Models
3.2.1. From the Model Library
- Find the model you want to download locally from the model library (it will be downloaded to the hidden .ollama folder in the user directory).
- Copy the download command to the command line to start the download (usually a
run
orpull
command).
3.2.2. From HuggingFace
- Search for GGUF models on HuggingFace (https://huggingface.co/models).
- Execute the command in the terminal:
ollama run hf.co/{username}/{repository}
ollama run hf.co/{username}/{repository}:{quantization}
3.3. Creating a Custom Model and Pushing to the Model Library
- Create the model file
Modelfile
- FROM: Base Model
- FROM ./vicuna-33b.Q4_0.gguf # Ollama supports importing GGUF models in the Modelfile by pointing to the local file path of the GGUF model to import.
- FROM llama3.2
- PARAMETER: Parameter Configuration
- SYSTEM: System Prompt
FROM llama3.2
# set the temperature to 1 [higher is more creative, lower is more coherent]
PARAMETER temperature 1
# set the system message
SYSTEM """
You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.
"""
- Execute the command to create the custom model
ollama create my_model_name -f ./Modelfile
- Run the custom model
ollama run my_model_name
Upload to the official model library:
- Register and log in to the official website, where the name will be the namespace for uploading the model (
my_namespace
). - Go to the "My models" section and create a new model. The model name should match the custom
my_model_name
. Follow the prompt to set up the public key in the website Settings. - Copy the model to the namespace:
ollama cp my_model_name my_namespace/my_model_name
- Push the model to the model library:
ollama push my_namespace/my_model_name
- Once the upload is successful, if you choose to make the model public, it will appear in the model library.
- Register and log in to the official website, where the name will be the namespace for uploading the model (
3.4. Managing and Using Models
- Add:
- pull
- run
- cp
- create
- Remove:
- rm
- Check:
- List models: list
- List running models: ps
- Show details: show
- Usage:
- run
- Exit chat: Use Ctrl + d or /bye to exit
- stop
3.5. More Commands
Type ollama
in the command window to see all usage options.
Usage:
ollama [flags]
ollama [command]
Available Commands:
serve Start ollama (和运行桌面应用是一样的)
create Create a model from a Modelfile
show Show information for a model
run Run a model
stop Stop a running model
pull Pull a model from a registry
push Push a model to a registry
list List models
ps List running models
cp Copy a model
rm Remove a model
help Help about any command
Flags:
-h, --help help for ollama
-v, --version Show version information
Use "ollama [command] --help" for more information about a command.