0
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?

mlx-community の「Llama-3-ELYZA-JP-8B-8bit」「Swallow-13b-instruct-v0.1-8bit」を mlx-lm で試す

Last updated at Posted at 2025-01-12

はじめに

以下の記事を書いた際に使っていた「mlx-lm」を、別のモデルとも組み合わせて使ってみた話です。

●MLX でローカルLLM:「mlx-community/phi-4-4bit」を試す(M4 Mac mini、mlx-lm を利用) - Qiita
 https://qiita.com/youtoy/items/a12ee071dd8290fc0715

お試しの結果

先に試した結果を掲載してみます。

利用したモデルは、タイトルに記載しているとおり「Llama-3-ELYZA-JP-8B-8bit」と「Swallow-13b-instruct-v0.1-8bit」です。

Llama-3-ELYZA-JP-8B-8bit

Swallow-13b-instruct-v0.1-8bit

今回使っているマシン

今回使っているマシンは、これまでと同じ M4 の Mac mini です(※ スペックは以下のとおり)。

  • Apple M4チップ
  • CPU: 10コアCPU
  • グラフィックス: 10コアGPU
  • 16コアNeural Engine
  • メモリ: 24GBユニファイドメモリ
  • ストレージ: 512GB SSD

今回の内容関連の情報

今回の内容を試した背景などを書いてみます。

モデル選び

今回の内容を試す前に「mlx-community/phi-4-4bit」を試してみて、他のモデルも試してみたくなりました。また、その際に使った mlx-lm を使うと、別のモデルを使うのが簡単層だったので、それも確かめてみたかったというのがあります。

モデルを探す

それで MLX に対応したモデルで、わりと最近情報が出ていたものを探しました。

そのうちの 1つが、以下の Llama-3-ELYZA-JP-7Bモデル関連の内容です。

このポストで書かれていたのは、以下の 2つです。

●mlx-community/Llama-3-ELYZA-JP-8B-8bit at main
https://huggingface.co/mlx-community/Llama-3-ELYZA-JP-8B-8bit/tree/main

●mlx-community/Llama-3-ELYZA-JP-8B-4bit at main
https://huggingface.co/mlx-community/Llama-3-ELYZA-JP-8B-4bit/tree/main

それらのうち、モデルサイズの大きなほうを試してみることにしました。

モデルを使う: Llama-3-ELYZA-JP-8B-8bit

モデルの使い方を見てみると、前回と同じ「mlx-lm」を使って試せそうでした。

2025-01-12_13-35-20.jpg

またコマンドの内容は、前回使ったもののモデルの部分を変更するのみで試せそうでした。
具体的には以下の内容です。

mlx_lm.generate --model mlx-community/Llama-3-ELYZA-JP-8B-8bit --prompt "東京について説明して"

環境は、冒頭に掲載していた前回の記事に書いていたものを使っています。

実際に試してみると、前回準備済みの環境で上記のコマンドを入力するだけで、簡単に「Llama-3-ELYZA-JP-8B-8bit」を使ったお試しができました。

モデルを探して使う: Swallow-13b-instruct-v0.1-8bit

その後、もう1つモデルを検索して試すことにしました。

対象として選んだのは「Swallow 13B instruct」です。Swallow 13B instruct の MLX に対応したものを検索してみたところ、以下のものがありました。

●mlx-community/Swallow-13b-instruct-v0.1-8bit
https://huggingface.co/mlx-community/Swallow-13b-instruct-v0.1-8bit/
●mlx-community/Swallow-7b-instruct-v0.1-8bit
https://huggingface.co/mlx-community/Swallow-7b-instruct-v0.1-8bit/
●mlx-community/Swallow-13b-instruct-v0.1-4bit
https://huggingface.co/mlx-community/Swallow-13b-instruct-v0.1-4bit/
●mlx-community/Swallow-7b-instruct-v0.1-4bit
https://huggingface.co/mlx-community/Swallow-7b-instruct-v0.1-4bit/
●mlx-community/Swallow-70b-instruct-v0.1-8bit
https://huggingface.co/mlx-community/Swallow-70b-instruct-v0.1-8bit/
●mlx-community/Swallow-70b-instruct-v0.1-4bit
 https://huggingface.co/mlx-community/Swallow-70b-instruct-v0.1-4bit

この中で、自分のマシンで動くものでモデルサイズの大きいものを選んで試しました。

こちらのお試しでも、冒頭に掲載していた前回の記事に書いていた環境を使っています。
コマンドは以下の内容のものにしました。

mlx_lm.generate --model mlx-community/Swallow-13b-instruct-v0.1-8bit --prompt "東京について説明して"

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
0
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?