1. brew安裝
mac需要先安裝brew,如果本地已經安裝過brew這一步可以忽略,遇到問題可以自己ai問?
/bin/bash -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
可能遇到source .zprofile失敗,因為默認文件不可見,需要在文件夾下讓文件可見,權限問題chmod解決。
2. tabby安裝
brew install tabbyml/tabby/tabby
3. 啟動服務
官方給的命令如下:無法科學上網的話,這條命令大概率會失敗
tabby serve --device metal --model StarCoder-1B --chat-model Qwen2-1.5B-Instruct
錯誤1:?
Library not loaded: /opt/homebrew/opt/openssl@3/lib/libssl.3.dylibReferenced from: <E16908F1-ECA2-3D1D-8113-B7760B8E3425> /opt/homebrew/Cellar/tabby/0.26.0/bin/tabbyReason: tried: '/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib' (no such file), '/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib' (no such file)
解決方法:安裝openssl@3?
brew install openssl@3ln -s /opt/homebrew/opt/openssl@3/lib/libssl.3.dylib /usr/local/lib/
錯誤2:
Writing to new file.
File exists. Resuming.
File exists. Resuming.
The application panicked (crashed).
Message: Failed to fetch model 'StarCoder-1B' due to 'Fetching 'https://huggingface.co/TabbyML/models/resolve/main/starcoderbase-1B.Q8_0.gguf' failed: Server returned error sending request for url (https://huggingface.co/TabbyML/models/resolve/main/starcoderbase-1B.Q8_0.gguf) HTTP status'
Location: /Users/runner/work/tabby/tabby/crates/tabby-download/src/lib.rs:210Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
解決辦法:
這個是最難解決的,如果實在無法科學上網,這種方法可以替代
從這個魔塔社區找自己想要使用的模型(前提是自己的電腦能跑的起來),選擇適合自己的配置的模型,查找對應的gguf后綴的模型
下載下來之后重命名為這種格式model-00001-of-00001.gguf(一定要重命名,有具體含義的,可以找AI問下,跟切片相關的),然后放到以下目錄:/<your tabby目錄>/TabbyML/<tabby.json中命名的模型名一致>/ggml/model-00001-of-00001.gguf
比如我下載下來的是deepseek-coder-6.7b-base.Q4_K_M.gguf,我的ggml的上一層目錄命名為DeepseekCoder-6.7B,然后修改tabby.json中的name與之對應。
我還下載了一個模型:qwen2.5-3b-instruct-q4_k_m.gguf作為chat-model,配置如下
差點忘了,還有一個關鍵的:embed-text模型也要下載下來,gguf文件同樣修改命名方式放到ggml目錄即可(一般直接搜索名稱有可能很難找到gguf的文件,后面加上-gguf搜索,比如Nomic-Embed-Text-gguf,可以直接找到這樣的文件,記得是切換到模型文件才能看到哈)
啟動參數需要修改的幾個點:
1. --model參數,改成本地目錄到TabbyML的下一級目錄,比如:DeepseekCoder-6.7B
2. --chat-model參數,改成本地目錄到TabbyML的下一級目錄,比如:qwen2.5-3b-instruct
3. tabby.json文件修改
參考:
{"prompt_template": "<PRE>{prefix}<SUF>{suffix}<MID>","chat_template": "<s>{% for message in messages %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + '</s> ' }}{% endif %}{% endfor %}",
}
啟動命令如下:
tabby serve --device metal --model /Users/xxx/.tabby/models/TabbyML/DeepseekCoder-6.7B --chat-model /Users/xx/.tabby/models/TabbyML/qwen2.5-3b-instruct
終于啟動成功了,具體使用我后續再寫一個,據說可以把自己的代碼離線運用起來