iTranslated by AI
Can weblab-10b Run on a Home PC? I Tried It Out
On August 18, the Matsuo Laboratory at the University of Tokyo released "weblab-10B", a 10-billion parameter LLM, as open source! While there are several open-source LLMs originating from Japan, 10 billion parameters is likely one of the largest at this point. The more parameters an LLM has, the higher the PC specs required to run it. But can weblab-10b run on a home PC!? I decided to find out.
PC Specs
CPU: Core i7 12th Gen
GPU: RTX 3060 VRAM: 12GB
RAM: 32GB DDR5
C Drive: NVMe M.2 SSD 500GB
This might be laughable for running an LLM (lol), but I think it's on the higher end of low-tier consumer PCs! As for the price, I've tinkered with it a lot since buying it, but the total would be around 250,000 yen.
Running it right away!
It seems weblab-10B also has a model fine-tuned for instructions called "weblab-10b-instruction-sft". This time, I will use the base version.
The code published on Hugging Face is as follows.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("matsuo-lab/weblab-10b")
model = AutoModelForCausalLM.from_pretrained("matsuo-lab/weblab-10b")
if torch.cuda.is_available():
model = model.to("cuda")
text = "吾輩は猫である。"
token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
with torch.no_grad():
output_ids = model.generate(
token_ids.to(model.device),
max_new_tokens=100,
do_sample=True,
temperature=0.6,
top_p=0.9,
pad_token_id=tokenizer.pad_token_id,
bos_token_id=tokenizer.bos_token_id,
eos_token_id=tokenizer.eos_token_id
)
output = tokenizer.decode(output_ids.tolist()[0])
print(output)
Running this starts the model download. The size was 21GB. Given that rinna's 3.6-billion parameter model is 7GB and CyberAgent's 7-billion parameter model is 12GB, 10 billion parameters is no joke.
The execution result was as follows!

In my PC environment, I couldn't run it with the code as is...
I'll apply some tips for running models more lightly that I've used with other LLMs.
(I'm not very familiar with the details, so I can't provide an in-depth explanation...)
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("matsuo-lab/weblab-10b", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("matsuo-lab/weblab-10b",device_map="auto",torch_dtype=torch.float16)
model.tie_weights()
text ="""以下はAIと人間の会話です。
人:こんにちは。
AI:こんにちは。
人:熊本のおすすめ観光地を教えてください。
AI:"""
token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
with torch.no_grad():
output_ids = model.generate(
token_ids.to(model.device),
max_new_tokens=128,
do_sample=True,
temperature=0.6,
top_p=0.9,
pad_token_id=tokenizer.pad_token_id,
bos_token_id=tokenizer.bos_token_id,
# eos_token_id=tokenizer.eos_token_id
)
output = tokenizer.decode(output_ids.tolist()[0])
print(output)
I commented out eos_token_id because it caused an error when specified.
Also, when you run it, the following message appears. I think it's a message regarding device_map, but it doesn't seem to be a problem, so it's safe to ignore.
The model weights are not tied. Please use the `tie_weights` method before using the `infer_auto_device` function.
The prompt is below. I asked about recommended sightseeing spots in Kumamoto!
text ="""以下はAIと人間の会話です。
人:こんにちは。
AI:こんにちは。
人:熊本のおすすめ観光地を教えてください。
AI:"""
Although it is a non-chat model, I specified it to output in a conversational format.
AI:熊本のおすすめ観光地は阿蘇山です。
人:阿蘇山ですか。
AI:はい、阿蘇山は世界で最も活発な火山の一つで、世界で最も美しい景色の一つです。
人:阿蘇山はどこにあります #Terminated at the token limit
It's actually quite good! It took about 5 minutes to respond.
Of course, this time varies depending on the PC specs and the parameters specified for the output.
By the way, I tried testing other LLMs with almost the same settings to see what kind of answers they would give.
rinna chat model (3.6 billion parameters)
AI:熊本は美しい自然の景観や、歴史ある街並みで知られる人気の観光地です。代表的な観光スポットには、阿蘇山や水前寺成趣園などがあります。
CyberAgent open-calm (7 billion parameters)
AI:そうですね、阿蘇はどうかしら? 自然がいっぱいで歴史もあって...それから温泉もね。
人:そうですよね。私も大好きです。他にも黒川温泉や杖立温泉といった温泉街があるんだけど、どこがお好きですか?
AI:そうねえ、そうだなあ...。うーん、やっぱり山かな。景色がいいところが好きです。あとは海にも行きたいですね。天草ってご存知ですか? あそこの海がいいですよね。ああ、そういえば最近行かれたんですか?
人:ええ、先日行ったばかりです。ちょうど今の時期だとカキのシーズンなんですよ。新鮮でおいしいのがたくさんあって、もう大満足でした。ほかにもいろいろあるんですけど、それはまた今度ご紹介します #Terminated at the token limit
Both give an answer in about 1 minute.
Please use the response content this time as a reference only! Responses vary greatly depending on whether the model is a chat model or a non-chat model, the content of the prompt, the parameter settings, etc., so I think it's best to adjust and verify them yourself.
Personally, I like the rinna chat model because of the quality of its answers and its speed.
I think the answers from weblab-10b are quite good, but it takes too much time on my PC specs...
However, it's definitely a good model, so I want to try using it more in the future!
Please let me know your thoughts if you use it!
Discussion