1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mac Studioでollamaのdeepseek-r1:671bを動かしてみた

Posted at

背景・目的

  • Mac StudioのM3 Ultraが発売された。512GBのメモリを積んでいる
  • ollamaのdeepseek-r1:671bは4bit量子化版で404GBある
  • 動くかを試してみた

結論

  • 動いた
  • OLLAMA_KEEP_ALIVEを長くしつつ、GPUが利用可能なメモリサイズの変更が必要だった

ollamaのdeepseek-r1について

image.png

上記の画像のように、蒸留版(1.5b ~ 70b)と蒸留なしのモデルが提供されている。
512GBのメモリを積んだMacなら671bのモデルを動かせるのでは?と思い試してみた。

初期設定だとエラー

$ ollama run deepseek-r1:671b
Error: llama runner process has terminated: signal: killed

image.png

360GB ~ 380GBぐらいまでメモリに乗ったところで、上記のようにプロセスが死んでしまった。

MacのユニファイドメモリはGPUに割り当てられるメモリの最大上限値があるためかと思われる。2/3か3/4か

設定を変更して試す

$ sysctl iogpu.wired_limit_mb
iogpu.wired_limit_mb: 0 
$ sudo sysctl iogpu.wired_limit_mb=450000
Password:
iogpu.wired_limit_mb: 0 -> 450000

上記の設定をして動かしてみても、同様のエラーになってしまった。

time=2025-03-19T11:27:46.038+09:00 level=INFO source=server.go:619 msg="waiting for server to become available" status="llm server loading model"
time=2025-03-19T11:28:57.051+09:00 level=INFO source=server.go:619 msg="waiting for server to become available" status="llm server not responding"
time=2025-03-19T11:29:06.342+09:00 level=ERROR source=sched.go:456 msg="error loading llama server" error="llama runner process has terminated: signal: killed"

調べてみたところ、OLLAMA_KEEP_ALIVEの時間を長くすれば解決する可能性があるとのことなので以下を設定

export OLLAMA_KEEP_ALIVE=-1

動いた

$ ollama run deepseek-r1:671b
>>> 富士山の高さは?
<think>
嗯,用户问的是“富士山的高さは?”也就是富士山的海拔高度是多少。首先得确认正确的数据,因为可能有不同的资料来源会有细微差别。

日本国土地理院是权威机构,他们的测量结果应该是最准确的。记得之前查过资料,富士山的标高大约是3776米左右。不过最好再核实一下最新的数据有没有变化。

另外要注意的是,有时候不同来源可能会有小数点后的差异或者四舍五入的不同说法,但通常都会以3776米为准。可能还需要提到这是静冈县和山梨县交界处的活火山,以及它是日本最高峰的信息。

用户可能是为了旅游计划、学习地理知识或者写作业需要这个信息,所以回答要简洁明确,同时提供一点相关背景可能会有帮助。
</think>

富士山の標高は**3,776メートル**です。これは日本国内で最も高い山であり、静岡県と山梨県にまたがる活火山(現在は休火山状態)としても知られています。最新の測量データでは小数点以下の数値が付く場合もありますが、一般的には「
3,776m」が公式な数値として広く認知されています🇯🇵🗻

動作中のメモリ利用状況は以下

image.png

参考リンク

https://github.com/ollama/ollama/issues/8571
https://github.com/ollama/ollama/blob/main/docs/faq.md

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?