llama.cpp 開始支援 GPU 了
source link: https://blog.gslin.org/archives/2023/05/15/11185/llama-cpp-%e9%96%8b%e5%a7%8b%e6%94%af%e6%8f%b4-gpu-%e4%ba%86/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
llama.cpp 開始支援 GPU 了
前陣子因為重灌桌機,所以在重建許多環境... 其中一個就是 llama.cpp,連到專案頁面上時意外發現這兩個新的 feature:
OpenBLAS support
cuBLAS and CLBlast support
這代表可以用 GPU 加速了,所以就照著說明試著編一個版本測試。
編好後就跑了 7B 的 model,看起來快不少,然後改跑 13B 的 model,也可以把完整 40 個 layer 都丟進 3060 (12GB 版本) 的 GPU 上:
./main -m models/13B/ggml-model-q4_0.bin -p "Building a website can be done in 10 simple steps:" -n 512 -ngl 40
從 log 可以看到 40 layers 到都 GPU 上面,吃了 7.5GB 左右:
llama.cpp: loading model from models/13B/ggml-model-q4_0.bin llama_model_load_internal: format = ggjt v2 (latest) llama_model_load_internal: n_vocab = 32000 llama_model_load_internal: n_ctx = 512 llama_model_load_internal: n_embd = 5120 llama_model_load_internal: n_mult = 256 llama_model_load_internal: n_head = 40 llama_model_load_internal: n_layer = 40 llama_model_load_internal: n_rot = 128 llama_model_load_internal: ftype = 2 (mostly Q4_0) llama_model_load_internal: n_ff = 13824 llama_model_load_internal: n_parts = 1 llama_model_load_internal: model size = 13B llama_model_load_internal: ggml ctx size = 90.75 KB llama_model_load_internal: mem required = 9807.48 MB (+ 1608.00 MB per state) llama_model_load_internal: [cublas] offloading 40 layers to GPU llama_model_load_internal: [cublas] total VRAM used: 7562 MB llama_init_from_file: kv self size = 400.00 MB
30B 的 model 我也試著丟上去跑,但只能丟 28 layers 上去 (全部是 60 layers),再多 GPU 的記憶體就撐不住了。
但能用 GPU 算是一個很大的進展,現在這版只快了一半的時間,不知道後面還有沒有 tune 的空間...
Related
玩最近 Facebook Research (Meta) 放出來的 LLaMA
很多地方應該都有提到 Facebook Research (Meta) 放出來的 LLaMA 了,對應的論文是「LLaMA: Open and Efficient Foundation Language Models」這篇,但這邊論文提到的 open 並不是一般常見的 open 定義,而只是常見的行銷詞彙而已,實際上只是 free for charging with constraints。 另外要注意 LLaMA 是個 LLM 而已,跟 ChatGPT 不算是同樣性質的東西,能對比應該是 GPT-3 (或是 GPT-3.5)。 主要是 ChatGPT 多了 SL 與 RL 的步驟,而產出來的東西更接近商業化產品要的結果。 LLaMA 的特點在於效能不錯,可以用 LLaMA-13B 打贏 GPT-3 (175B),另外這次訓練出來最大的 LLaMA-65B 則可以站上第一梯隊 (與 DeepMind 的…
March 16, 2023In "Computer"
這兩個禮拜爆紅的 Stable Diffusion
Stable Diffusion 是 Stability AI 訓練出來的 model,跟之前提到的 DALL-E 最大的差異就是產生出的圖的限制少很多: Unlike competing models like DALL-E, Stable Diffusion is open source and does not artificially limit the images it produces, though the license prohibits certain harmful use cases. 這也造就了這兩個禮拜整個 Stable Diffusion 的各種應用急速成長。 用 Simon Willison 的「Stable Diffusion is a really big deal」這篇來當作總覽還不錯。…
September 6, 2022In "Computer"
用 GPU 跑 FFT
遲早會有人把腦筋動到 GPU 強大的運算能力上 :p 這次是利用 Nvidia 的 GPU 弄出一個數學函示庫 GPUFFTW,利用 GPU 計算 FFT 的基本運算加速:High performance FFT on GPUs。 在 Benchmark 中,透過 GPU 加速可以使得 FFT 整體的速度大約是純用 CPU 計算的四倍,但顯示卡的價錢卻只有 CPU 的 1/3。換句話說,把這類運算丟給 GPU 做,讓 CPU 計算其他的事情。 不過還是有些限制: 只有 32-bits (single-precision) float point 可以用,這是 GPU 所造成的限制,如果以後有 GPU 支援 64-bits 才有辦法支援上去。 只能跑 1-D FFT。…
May 30, 2006In "Computer"
Author Gea-Suan LinPosted on May 15, 2023Categories Computer, Murmuring, SoftwareTags blas, card, clblast, cpp, cublas, gpu, graphics, language, large, learning, llama, llama.cpp, llm, machine, model, nvidia, openblas, performance, speed, support, video
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Notify me of follow-up comments by email.
Notify me of new posts by email.
To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)
Post navigation
Recommend
-
9
LastPass 開始進入「殺」的階段,免費使用者只能在一個平台上使用 LastPass 進入了「套養殺」最後一個階段「殺」,宣佈縮減 LastPass Free 的可用範圍。在 2021/03/16 開始 (一個月後),LastPass Free...
-
1
DDIA閱讀紀錄(1) – 第一章:好的開始,但擔心理論多於實務 – 軟人手札直接觀看文章 就像大部分的技術書籍一樣,第一章主要是在為整本書所涵蓋的內容立下...
-
3
Cloudflare 開始在正式環境用 ARM server 了 在「Designing Edge Servers with Arm CPUs to Deliver 57% More Performance Per Watt」這邊
-
6
HiNet 開始提供 2G/1G 的線路 HiNet 開始提供 2G/1G 的線路了,但在企業上網的「HiNet企業上網促銷網站」這邊還沒看到 2G/1G 的方案,反倒是在...
-
10
Elasticsearch 的 Python 套件開始阻擋 OpenSearch 的伺服器了 在 Hacker News Daily 上看到的:「Official Elasticsearch Pyth...
-
19
Docker Desktop 要開始對商用收費了,以及 Open Source 版本的設法 Hacker News Daily 上看到的,Docker Desktop 修改了他...
-
11
llama.cpp 65B run · GitHub Instantly share code, notes, and snippets. ...
-
7
llama.cpp 的載入速度加速 在 Hacker News 上看到「
-
7
nginx 開始嘗試支援 HTTP/3 Hacker News 上看到「
-
4
llama.cpp 官方支援 Falcon 先前有提過採用 Apache License 2.0 的
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK