連載
サイバーエージェントが公開した大規模言語モデルの実力を試す:清水亮の「世界を変えるAI」(1/4 ページ)
5月16日、サイバーエージェントが商用利用可能な7B(68億パラメータ)の大規模言語モデルOpenCalm7Bを公開した。早速その実力を試してみた。
5月16日、サイバーエージェントが商用利用可能な7B(68億パラメータ)の大規模言語モデルOpenCalm7Bを公開した。OpenCalm7Bは、日本語版Wikipediaと日本語版コモンクロールを学習したとされている。ライセンスはCC-BY-SA 4.0だ。
早速その実力を試してみた。
まずOpenCalm7Bを動かすには、TransformerをインストールしたPCで、VRAMは最低14GBくらいは必要となる。今回、筆者はV100を4基搭載したさくらインターネットの高火力サーバを利用した。
(ldm310) ubuntu@ubuntu:~$ python Python 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import torch >>> from transformers import AutoModelForCausalLM, AutoTokenizer >>> >>> model = AutoModelForCausalLM.from_pretrained("cyberagent/open-calm-7b", device_map="auto", torch_dtype=torch.float16) Downloading (…)lve/main/config.json: 100%| ■■■■■■| 611/611 [00:00<00:00, 351kB/s] Downloading (…)model.bin.index.json: 100%|■■| 42.0k/42.0k [00:00<00:00, 281kB/s] Downloading (…)00001-of-00002.bin";: 100%|■| 9.93G/9.93G [14:44<00:00, 11.2MB/s] Downloading (…)00002-of-00002.bin";: 100%|■■■■■■■■■■■■■■■■■■■■■■■| 3.95G/3.95G [05:51<00:00, 11.3MB/s] Downloading shards: 100%|■■■■■■■■■■■■■■■■■■■■■■■■| 2/2 [20:37<00:00, 618.61s/it]05:51<00:00, 11.4MB/s] Loading checkpoint shards: 100%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 2/2 [00:09<00:00, 4.61s/it] Downloading (…)neration_config.json: 100%|■■■■■■■■■■■■■■■■■■■■■■■■■■■| 116/116 [00:00<00:00, 58.1kB/s] >>> tokenizer = AutoTokenizer.from_pretrained("cyberagent/open-calm-7b") Downloading (…)okenizer_config.json: 100%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 323/323 [00:00<00:00, 229kB/s] Downloading (…)/main/tokenizer.json: 100%|■■■■■■■■■■■■■■■■■■■■■■■| 3.23M/3.23M [00:00<00:00, 3.26MB/s] Downloading (…)cial_tokens_map.json: 100%|■■■■■■■■■■■■■■■■■■■■■■■■■■■| 129/129 [00:00<00:00, 94.8kB/s] >>> inputs = tokenizer("AIによって私達の暮らしは、", return_tensors="pt").to(model.device)
最初にモデルをダウンロードするのに10〜20分ほどかかる。
>>> with torch.no_grad(): ... tokens = model.generate( ... **inputs, ... max_new_tokens=64, ... do_sample=True, ... temperature=0.7, ... pad_token_id=tokenizer.pad_token_id, ... ) ... ... /home/ubuntu/anaconda3/envs/ldm310/lib/python3.10/site-packages/transformers/models/gpt_neox/modeling_gpt_neox.py:220: UserWarning: where received a uint8 condition tensor. This behavior is deprecated and will be removed in a future version of PyTorch. Use a boolean condition instead. (Triggered internally at /opt/conda/conda-bld/pytorch_1666643003845/work/aten/src/ATen/native/TensorCompare.cpp:413.) attn_scores = torch.where(causal_mask, attn_scores, mask_value) >>> output = tokenizer.decode(tokens[0], skip_special_tokens=True) >>> print(output)
例文として掲載されていた「AIによって私達の暮らしは、」を入力した結果はこうなった。
関連記事
- 百花繚乱の大規模言語モデル その現状まとめ【2023年4月末版】
米OpenAIが独占的に提供する大規模言語モデル(LLM)に対し、さまざまなLLMが登場している。特に注目はオープンで自由な大規模言語モデル「Dolly-v2」だ。さながら現在は「不自由な大規模言語モデルと自由な大規模言語モデルの小競り合い」が起きている状態だ。 - 百花繚乱の大規模言語モデル その現状まとめ【2023年4月末版】
米OpenAIが独占的に提供する大規模言語モデル(LLM)に対し、さまざまなLLMが登場している。特に注目はオープンで自由な大規模言語モデル「Dolly-v2」だ。さながら現在は「不自由な大規模言語モデルと自由な大規模言語モデルの小競り合い」が起きている状態だ。 - 仕事で使うGPT-4実践テクニック 実際に「AIアートグランプリ」の事務局で使ってみた
第一回AIアートグランプリの興奮もさめやらぬなか、GPT-4があっさりと公開。せっかくなので、まずは第一回AIアートグランプリの報告書をGPT4にまとめてもらってみる。さらにChain of Thoughtでキャッチフレーズを考えさせるなど、事務局の仕事に活用してみた。 - なぜ人々は、ChatGPTという“トリック"に振り回されるのか? Google「Bard」参戦、チャットAI戦争の行方
OpenAIが2022年に発表した対話型AI「ChatGPT」の衝撃は、米国ビッグテック最強の一角であるGoogleを動揺させた。Googleは急ぎ「Bard」と名付けたチャットボットを投入し、巻き返しを図る。 - まさに「世界変革」──この2カ月で画像生成AIに何が起きたのか?
2022年8月22日。日本時間にして午前4時ごろ、「世界変革」はついに実行された。「どんな絵も描ける」AIである「Stable Diffusion」がついにオープンソースとして公開されたのだ。そこからの2カ月を振り返る。
Copyright © ITmedia, Inc. All Rights Reserved.