运行你自己的 GaiaNet 节点
Japanese(日本語) | Chinese(中文) | Korean(한국어) | Turkish (Türkçe) | Farsi(فارسی) | Arabic (العربية) | Indonesia | Russian (русскийة) | Portuguese (português) | 我们需要您的帮助,将此 README 翻译成您的母语。
喜欢我们的工作吗?⭐ 给我们点个 Star!
查看我们的官方文档]和一本关于如何定制开源模型的Manning 电子书]。
快速入门
在 Mac、Linux 或 Windows WSL 上,通过单行命令安装默认的节点软件栈。
curl -sSfL 'https://github.com/GaiaNet-AI/gaianet-node/releases/latest/download/install.sh' | bash
然后,按照屏幕上的提示设置环境路径。命令行将以
source开头。
初始化节点。它将下载 $HOME/gaianet/config.json 文件中指定的模型文件和向量数据库文件,由于文件较大,可能需要几分钟。
gaianet init
启动节点。
gaianet start
该脚本会在控制台上打印出官方节点地址,如下所示。 您可以打开浏览器访问该 URL 以查看节点信息,然后与节点上的 AI 智能体进行聊天。
... ... https://0xf63939431ee11267f4855a166e11cc44d24960c0.us.gaianet.network
要停止节点,您可以运行以下脚本。
gaianet stop
安装指南
curl -sSfL 'https://raw.githubusercontent.com/GaiaNet-AI/gaianet-node/main/install.sh' | bash
输出应如下所示:
[+] Downloading default config file ...
[+] Downloading nodeid.json ...
[+] Installing WasmEdge with wasi-nn_ggml plugin ...
Info: Detected Linux-x86_64
Info: WasmEdge Installation at /home/azureuser/.wasmedge
Info: Fetching WasmEdge-0.13.5
/tmp/wasmedge.2884467 ~/gaianet
######################################################################## 100.0%
~/gaianet
Info: Fetching WasmEdge-GGML-Plugin
Info: Detected CUDA version:
/tmp/wasmedge.2884467 ~/gaianet
######################################################################## 100.0%
~/gaianet
Installation of wasmedge-0.13.5 successful
WasmEdge binaries accessible
The WasmEdge Runtime wasmedge version 0.13.5 is installed in /home/azureuser/.wasmedge/bin/wasmedge.
[+] Installing Qdrant binary...
* Download Qdrant binary
################################################################################################## 100.0%
* Initialize Qdrant directory
[+] Downloading the rag-api-server.wasm ...
################################################################################################## 100.0%
[+] Downloading dashboard ...
################################################################################################## 100.0%
默认情况下,它安装到 $HOME/gaianet 目录。您也可以选择在替代目录中安装。
curl -sSfL 'https://raw.githubusercontent.com/GaiaNet-AI/gaianet-node/main/install.sh' | bash -s -- --base $HOME/gaianet.alt
初始化节点
gaianet init
输出应如下所示:
[+] Downloading Llama-2-7b-chat-hf-Q5_K_M.gguf ...
############################################################################################################################## 100.0%############################################################################################################################## 100.0%
[+] Downloading all-MiniLM-L6-v2-ggml-model-f16.gguf ...
############################################################################################################################## 100.0%############################################################################################################################## 100.0%
[+] Creating 'default' collection in the Qdrant instance ...
* Start a Qdrant instance ...
* Remove the existed 'default' Qdrant collection ...
* Download Qdrant collection snapshot ...
############################################################################################################################## 100.0%############################################################################################################################## 100.0%
* Import the Qdrant collection snapshot ...
* Recovery is done successfully
init 命令根据 $HOME/gaianet/config.json 文件初始化节点。您可以使用我们预设的一些配置。例如,下面的命令使用 llama-3 8B 模型初始化一个节点,并以伦敦指南作为知识库。
gaianet init --config https://raw.githubusercontent.com/GaiaNet-AI/node-configs/main/llama-3-8b-instruct_london/config.json
要查看预置配置列表,您可以执行 gaianet init --help。
除了像 gaianet_docs 这样的预置配置,您还可以传递一个指向您自己的 config.json 的 URL,以便将节点初始化为您期望的状态。
如果您需要 init 安装在替代目录中的节点,请执行此操作。
gaianet init --base $HOME/gaianet.alt
启动节点
gaianet start
输出应如下所示:
[+] Starting Qdrant instance ...
Qdrant instance started with pid: 39762
[+] Starting LlamaEdge API Server ...
Run the following command to start the LlamaEdge API Server:
wasmedge --dir .:./dashboard --nn-preload default:GGML:AUTO:Llama-2-7b-chat-hf-Q5_K_M.gguf --nn-preload embedding:GGML:AUTO:all-MiniLM-L6-v2-ggml-model-f16.gguf rag-api-server.wasm --model-name Llama-2-7b-chat-hf-Q5_K_M,all-MiniLM-L6-v2-ggml-model-f16 --ctx-size 4096,384 --prompt-template llama-2-chat --qdrant-collection-name default --web-ui ./ --socket-addr 0.0.0.0:8080 --log-prompts --log-stat --rag-prompt "Use the following pieces of context to answer the user's question.\nIf you don't know the answer, just say that you don't know, don't try to make up an answer.\n----------------\n"
LlamaEdge API Server started with pid: 39796
您可以启动该节点以用于本地使用。它仅可通过 localhost 访问,并且无法通过 GaiaNet 域名的任何公共 URL 访问。
gaianet start --local-only
您也可以在替代基础目录中启动已安装的节点。
gaianet start --base $HOME/gaianet.alt
停止节点
gaianet stop
输出应如下所示:
[+] Stopping WasmEdge, Qdrant and frpc ...
停止安装在替代基础目录中的节点。
gaianet stop --base $HOME/gaianet.alt
更新配置
使用 gaianet config 子命令可以更新 config.json 文件中定义的关键字段。更新配置后,您必须再次运行 gaianet init。
例如,要更新 chat 字段,请使用以下命令:
gaianet config --chat-url "https://huggingface.co/second-state/Llama-2-13B-Chat-GGUF/resolve/main/Llama-2-13b-chat-hf-Q5_K_M.gguf"
例如,要更新 chat_ctx_size 字段,请使用以下命令:
gaianet config --chat-ctx-size 5120
以下是 config 子命令的所有选项。
$ gaianet config --help
Usage: gaianet config [OPTIONS]
Options:
--chat-url <url> Update the url of chat model.
--chat-ctx-size <val> Update the context size of chat model.
--embedding-url <url> Update the url of embedding model.
--embedding-ctx-size <val> Update the context size of embedding model.
--prompt-template <val> Update the prompt template of chat model.
--port <val> Update the port of LlamaEdge API Server.
--system-prompt <val> Update the system prompt.
--rag-prompt <val> Update the rag prompt.
--rag-policy <val> Update the rag policy [Possible values: system-message, last-user-message].
--reverse-prompt <val> Update the reverse prompt.
--domain <val> Update the domain of GaiaNet node.
--snapshot <url> Update the Qdrant snapshot.
--qdrant-limit <val> Update the max number of result to return.
--qdrant-score-threshold <val> Update the minimal score threshold for the result.
--base <path> The base directory of GaiaNet node.
--help Show this help message
玩得开心!
资源与回馈贡献
在找文档?请查看文档或贡献指南。我们还推荐阅读Awesome-Gaia,其中包含来自 Gaia 社区的工具、项目和资源精选列表。
想与社区交流?加入我们的Telegram,分享你的想法以及你用 Gaianet 构建的内容。
发现了一个 bug?前往我们的问题追踪器,我们会尽力提供帮助。我们也欢迎拉取请求!
我们期望所有 Gaianet 贡献者遵守我们的行为准则。