common.title

Docs
Quantum Circuit
TYTAN CLOUD

QUANTUM GAMING


autoQAOA
Desktop RAG

Overview
Terms of service

Privacy policy

Contact
Research

Sign in
Sign up
common.title

Mistralの新しいモデル、Mixtral-8x22B MoEを動かしてみた

Yuichiro Minato

2024/04/11 12:17

Gigazineが詳しい。

Mistral AI suddenly announces new large-scale language model '8x22B MOE', with a context length of 65k and a parameter size of up to 176 billion

https://gigazine.net/gsc_news/en/20240410-mistral-8x22b-moe/

今回は22Bモデルを8つ組み合わせたMixture of Expertsモデルで、複数のモデルを内部に入れて入力によって専門家を変えて計算するというモデルになってる。コンテクス長は65kで、パラメータサイズは1760億となる。

公式にP2PのプラットフォームのBitTorrentでファイルが出されていてるが、融資によってHuggingFaceにおいてもらったようなので、そちらを使ってみました。

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "mistral-community/Mixtral-8x22B-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_id)

model = AutoModelForCausalLM.from_pretrained(model_id)

text = "Hello my name is"
inputs = tokenizer(text, return_tensors="pt")

outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

ファイルは59ファイルあり、全部で260GB程度ありました。相変わらず重たい。。。最近はcohereのcommand r+を含めてOSSのモデルの競争が一層激しくなっている気がします。xAIのGrokはH100x8枚必要でしたが、今回のMixtralの混合モデルはH100x4枚でいけました。。。もうハイグレードのGPUを8枚とか使うのが当たり前になってきましたね。めんどくさいのでfpも量子化も設定せずにそのまま行きました。

パフォーマンスはGPT-3.5以上ということでcohereもそうですが、ローカルで十分な性能なものが利用できる環境がすごいです。しかし、推論でもこのようなモデルが日常的にクラウドで提供されていたりするのは一体どういう運用がされているのか含めてかなり謎です。。。

標準では、 max_new_tokens=20に設定されていました。

Hello my name is Katie and I am a 20 year old student at the University of Wisconsin-Madison

となっていました。これだとちょっと物足りないので、出力トークン数を増やして日本語でも聞いてみました。自分のマシンのせいかもしれませんが、ものすごい出力に時間がかかります。。。初期のトークン数20だと物足りないのですが、ちょっと増やすのが憚られます。

max_new_tokens=50にして聞いてみました。instructモデルではないので、下記のように聞いてみました。

text = "日本でおすすめの観光地は、"

日本でおすすめの観光地は、京都です。京都は、日本の歴史的な都市で、多くの寺院や神社があります。京都では、桜の季節が最も

いい感じな気がします。それにしても重たいです。

text = "おすすめのタイ料理は"

おすすめのタイ料理は?

What is the best Thai food?

What is the best Thai food?

Thai food is one of the most popular cuisines in the world. It is known for its spicy, sour

僕の使い方が悪いんですかね。。。ちょっとハイパフォーマンスな言語モデルの使い方に慣れようと思いました。。。最後に英語でも聞いてみました。

text = "I am going to visit Japan. Where you recommend to visit in Japan during my stay?"

The place recommended during my stay in Japan is the “Kyoto International Manga Museum”.

The Kyoto International Manga Museum is a museum that collects and exhibits manga from all over the world.

The museum is located in the center of Kyoto, and

なんか良さそうでした。

© 2025, blueqat Inc. All rights reserved