这是用户在 2024-6-3 19:10 为 https://github.com/ollama/ollama 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
Skip to content
ollama  /   ollama  /  
Owner avatar ollama Public
  • Watch 430

    Notifications

    Get push notifications on iOS or Android.
  • Lists

    Lists

Notifications

Notification settings

Get up and running with Llama 3, Mistral, Gemma, and other large language models.

License

Open in github.dev Open in a new github.dev tab Open in codespace

ollama/ollama

t

Add file

Add file

Folders and files

NameName
Last commit message
Last commit date
May 31, 2024
May 14, 2024
Jun 2, 2024
May 1, 2024
May 31, 2024
May 22, 2024
May 31, 2024
May 31, 2024
May 28, 2024
May 14, 2024
Jun 2, 2024
May 17, 2024
Jun 1, 2024
May 21, 2024
May 12, 2024
May 21, 2024
Mar 27, 2024
May 29, 2024
May 29, 2024
May 30, 2024
Jun 1, 2024
Aug 23, 2023
Mar 10, 2024
May 8, 2024
May 2, 2024
Jan 5, 2024
May 8, 2024
Jul 3, 2023
Apr 18, 2024
Jun 27, 2023
May 28, 2024
May 22, 2024
May 22, 2024
Mar 27, 2024

Repository files navigation

 ollama

Ollama 奥拉玛

Discord

Get up and running with large language models locally.
在本地启动并运行大型语言模型。

macOS macOS 操作系统

Download 下载

Windows preview Windows 预览版

Download 下载

Linux Linux操作系统

curl -fsSL https://ollama.com/install.sh | sh

Manual install instructions
手动安装说明

Docker 码头工人

The official Ollama Docker image ollama/ollama is available on Docker Hub.
官方的 Ollama Docker 镜像 ollama/ollama 可在 Docker Hub 上找到。

Libraries 图书馆

Quickstart 快速入门

To run and chat with Llama 3:
要运行并与 Llama 3 聊天:

ollama run llama3

Model library 模型库

Ollama supports a list of models available on ollama.com/library
Ollama 支持 ollama.com/library 上可用的模型列表

Here are some example models that can be downloaded:
以下是一些可以下载的示例模型:

Model  Parameters 参数 Size 大小 Download 下载
Llama 3 致电 3 8B 4.7GB ollama run llama3
Llama 3 致电 3 70B 40GB ollama run llama3:70b
Phi 3 Mini Phi 3 迷你 3.8B 2.3GB ollama run phi3
Phi 3 Medium Phi 3 培养基 14B 7.9GB ollama run phi3:medium
Gemma 杰玛 2B 1.4GB ollama run gemma:2b
Gemma 杰玛 7B 4.8GB ollama run gemma:7b
Mistral 米斯特拉尔 7B 4.1GB ollama run mistral
Moondream 2 月梦2 1.4B 829MB ollama run moondream
Neural Chat 神经聊天 7B 4.1GB ollama run neural-chat
Starling  7B 4.1GB ollama run starling-lm
Code Llama 代码骆驼 7B 3.8GB ollama run codellama
Llama 2 Uncensored 呼叫 2 未经审查 7B 3.8GB ollama run llama2-uncensored
LLaVA LLaVA公司 7B 4.5GB ollama run llava
Solar 太阳的 10.7B 6.1GB ollama run solar

Note: You should have at least 8 GB of RAM available to run the 7B models, 16 GB to run the 13B models, and 32 GB to run the 33B models.
注意:您应该至少有 8 GB 的 RAM 可用于运行 7B 型号,16 GB 可用于运行 13B 型号,32 GB 可用于运行 33B 型号。

Customize a model 自定义模型

Import from GGUF 从 GGUF 导入

Ollama supports importing GGUF models in the Modelfile:
Ollama 支持在 Modelfile 中导入 GGUF 模型:

  1. Create a file named Modelfile, with a FROM instruction with the local filepath to the model you want to import.
    创建一个名为 Modelfile 的文件,其中包含一条 FROM 指令,其中包含要导入的模型的本地文件路径。

    FROM ./vicuna-33b.Q4_0.gguf
    
  2. Create the model in Ollama
    在 Ollama 中创建模型

    ollama create example -f Modelfile
    
  3. Run the model 运行模型

    ollama run example
    

Import from PyTorch or Safetensors
从 PyTorch 或 Safetensors 导入

See the guide on importing models for more information.
有关详细信息,请参阅有关导入模型的指南。

Customize a prompt 自定义提示

Models from the Ollama library can be customized with a prompt. For example, to customize the llama3 model:
Ollama 库中的模型可以通过提示进行自定义。例如,要自定义 llama3 模型:

ollama pull llama3

Create a Modelfile: 创建一个 Modelfile

FROM llama3

# 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.
"""

Next, create and run the model:
接下来,创建并运行模型:

ollama create mario -f ./Modelfile
ollama run mario
>>> hi
Hello! It's your friend Mario.

For more examples, see the examples directory. For more information on working with a Modelfile, see the Modelfile documentation.
有关更多示例,请参阅 examples 目录。有关使用 Modelfile 的详细信息,请参阅 Modelfile 文档。

CLI Reference CLI 参考

Create a model 创建模型

ollama create is used to create a model from a Modelfile.
ollama create 用于从 Modelfile 创建模型。

ollama create mymodel -f ./Modelfile

Pull a model 拉取模型

ollama pull llama3

This command can also be used to update a local model. Only the diff will be pulled.
此命令还可用于更新本地模型。只会拉取差异。

Remove a model 删除模型

ollama rm llama3

Copy a model 复制模型

ollama cp llama3 my-model

Multiline input 多线输入

For multiline input, you can wrap text with """:
对于多行输入,您可以使用以下命令 """ 换行文本:

>>> """Hello,
... world!
... """
I'm a basic program that prints the famous "Hello, world!" message to the console.

Multimodal models 多式联运模型

>>> What's in this image? /Users/jmorgan/Desktop/smile.png
The image features a yellow smiley face, which is likely the central focus of the picture.

Pass the prompt as an argument
将提示作为参数传递

$ ollama run llama3 "Summarize this file: $(cat README.md)"
 Ollama is a lightweight, extensible framework for building and running language models on the local machine. It provides a simple API for creating, running, and managing models, as well as a library of pre-built models that can be easily used in a variety of applications.

List models on your computer
列出计算机上的型号

ollama list

Start Ollama 启动 Ollama

ollama serve is used when you want to start ollama without running the desktop application.
ollama serve 当您想要在不运行桌面应用程序的情况下启动 Ollama 时使用。

Building 建筑

See the developer guide 请参阅开发人员指南

Running local builds 运行本地生成

Next, start the server:
接下来,启动服务器:

./ollama serve

Finally, in a separate shell, run a model:
最后,在单独的 shell 中,运行一个模型:

./ollama run llama3

REST API REST 接口

Ollama has a REST API for running and managing models.
Ollama 有一个用于运行和管理模型的 REST API。

Generate a response 生成响应

curl http://localhost:11434/api/generate -d '{
  "model": "llama3",
  "prompt":"Why is the sky blue?"
}'

Chat with a model 与模特聊天

curl http://localhost:11434/api/chat -d '{
  "model": "llama3",
  "messages": [
    { "role": "user", "content": "why is the sky blue?" }
  ]
}'

See the API documentation for all endpoints.
请参阅所有端点的 API 文档。

Community Integrations 社区整合

Web & Desktop Web & 桌面

Terminal 终端

Database 数据库

  • MindsDB (Connects Ollama models with nearly 200 data platforms and apps)
    MindsDB(将 Ollama 模型与近 200 个数据平台和应用程序连接起来)
  • chromem-go with example chromem-go 示例

Package managers 包管理器

Libraries 图书馆

Mobile 移动

Extensions & Plugins 扩展和插件

Supported backends 支持的后端

  • llama.cpp project founded by Georgi Gerganov.
    llama.cpp由Georgi Gerganov创立的项目。
set 限制解除
×