IrvineのもっとPC自作日記
本ページはプロモーションが含まれています。
  
 

【LLM】Google製テキスト生成AI Gemma2を試してみた

 

スポンサーリンク

 
【LLM】Google製テキスト生成AI Gemma2を試してみた
 

Googleが提供するPCで動くLLM、Gemmaが出た時に試してみたが、半年もたたずに新しいバージョン、Gemma2がリリースされた。早速試してみた。
応答が速く、以前よりも回答が良くなっているようだ。トレーニングできれば、パーソナルAIにできるのではないかな。
テキスト生成AIについてのまとめはこちら。

  

Gemma2とは

HuggingFaceに書かれているものを和訳したものを示す。

Gemmaは、Google製の軽量で最先端のオープンモデル・ファミリであり、Geminiモデルの作成に使用されたものと同じ研究とテクノロジーから構築されています。これらは、テキストからテキストへのデコーダーのみの大規模言語モデルで、事前トレーニング済みのバリアントと命令調整済みのバリアントの両方に対してオープンな重み付けを備えています。Gemma モデルは、質問への回答、要約、推論など、さまざまなテキスト生成タスクに適しています。比較的小型であるため、ラップトップ、デスクトップ、独自のクラウド インフラストラクチャなど、リソースが限られた環境に導入でき、最先端の AI モデルへのアクセスを民主化し、すべての人のイノベーションを促進するのに役立ちます。

このように、PCなどのGPUでも比較的早く回答ができる、軽量なLLMだ。トレーニングしたデータが9Bと27Bの2種類ある。Bは10億という意味だ。まずは27Bを使ってみよう。

Gemmaでも応答性はよかったが、回答がいまいちなところがあった。例えば明日の天気を聞くとリアルタイムデータにはアクセスできないという。
まあ、あらかじめトレーニングされたデータに基づいて動くAIでは難しいのかもしれないが。

インストール

GemmmaをインストールしているPCなら、Ollamaをインストールしているだろう。これを使うだけだ。
初めて使う場合は下のボタンからOllamaをインストールする。

コマンドプロンプトを開いて、起動する。
ollama run gemma2:27b

9Bなら
ollama run gemma2:9b

詳細はHuggingFaceのページを参照。

Gemma2 HuggingFace

Gemma2 出典:HuggingFace

今回もデータ量が巨大なのでしばらくダウンロードにかかる。終わるとOllamaの中でプロンプトが表示され、質問を入力できるようになる。

今回も英語と日本語でいつもの質問をしてみた。前回の記事と比較するといいと思う。

英語で質問

Gemma2 英語

Gemma2 英語

挨拶

Irvine
Hello
Gemma2
Hello! 👋 How can I help you today?
Irvine
How are you?
Gemma2
As an AI, I don’t have feelings! But I’m here and ready to assist you with any questions or tasks you may have.
What can I help you with today? 😊

Gemmaのときはもう少し返答が長かった。短くなったな。

CEOクイズ

Irvine
Who is CEO of Google?
Gemma2
The CEO of Google is **Sundar Pichai**.

He has been CEO of Google since October 2, 2015, and is also the CEO of Alphabet Inc., Google’s parent company.

Is there anything else you’d like to know about Sundar Pichai or Google?

ちょっと説明が長くなった。

Irvine
Who is CEO of Intel?
Gemma2
The CEO of Intel is **Pat Gelsinger**. He returned to the position in 2021 after a long time away from the
company.
What can I tell you about the world of semiconductors and CEOs?

Gemmaでは回答できなかったが今回は正しい回答だ。CEOになった年月も表示している。

Irvine
Who is CEO of AMD?
Gemma2
The CEO of AMD is **Lisa Su**. She’s been leading the company as CEO since October 2014!
AMD is known for its interesting leadership in recent years, with Dr. Lisa Su being one of the few women to lead a
major chip manufacturer.
Do you have any other questions I can answer? 🤔

こちらもGemmaでは回答できなかったが今回は正しい回答だ。CEOになった年月も表示している。

Irvine
Who is CEO of NVidia?
Gemma2
The CEO of Nvidia is **Jensen Huang**. He’s been at the helm since he co-founded the company in 1993 and is known
for his signature sweaters and enthusiastic presentations!
Do you want to know more about Jensen Huang or maybe compare him to other CEOs in the industry? 😊

こちらもGemmaでは回答できなかったが今回は正しい回答だ。革ジャンではなくセーターで有名とあるが何かと間違えているのかな?

IT用語

Irvine
What does PDCA mean?
Gemma2
PDCA stands for **Plan-Do-Check-Act**. It’s a cyclical approach to continuous improvement often used in quality
management.
**Here’s a breakdown:**
* **Plan:** Identify the problem, set goals and objectives for improvement, and plan the steps needed to achieve
them. This is where you brainstorm, outline strategies, and determine how to measure success.
* **Do:** Implement the planned solution through a small-scale test or pilot project.
* **Check:** Evaluate the results of the implementation against the predetermined goals.
* **Act:** Based on the evaluation in the “Check” phase, take corrective actions to address any issues and improve
the process.
The PDCA cycle is a powerful tool for addressing any problem or process that needs improvement.
**Let me know if you’d like me to elaborate on any of these steps.**
Do you want to learn more about how the **Plan-Do-Check-Act** cycle can be used in practice?

説明が詳細になった。

スマホ対決

Irvine
Which is popular, Android or iPhone?
Gemma2
That’s a great question!
Both Android and iPhone are incredibly popular operating systems for smartphones, but **Android is generally
considered the more popular one globally**.
It’s hard to say definitively which has a larger following because exact numbers are constantly changing. But
here’s why:
* **Market Share:** Android dominates the smartphone market, powering a vast majority of devices worldwide. This
is largely due to its open-source nature and availability on a wide range of phone models from different
manufacturers.
* **Variety:** Android has more variety in terms of price points, manufacturers, and device types. This leads to
a wider range of options for consumers, making it more accessible and appealing to a larger market.
* **Accessibility:** While iPhones are only available through Apple, Apple’s own stores, and authorized retailers,
Android devices are manufactured by a variety of companies like Samsung, Google, Xiaomi, Oppo, etc. This means
that you can find an iPhone for every budget and need in the market.
**However, it’s important to remember:**
* **Popularity varies by region:** Android has a larger global market share overall, but iPhones tend to be more
popular in certain countries like the US.
* **Global vs. regional:** Apple has a strong brand loyalty, so people often stick with iPhones. However, the
availability of different models and the open nature of Android means it’s accessible to a wider range of users
and budgets.
**So, while “popularity” can be subjective and vary depending on who you ask (and in what market!), it’s safe to
say that Android has a larger global market share due to its versatility.**
Let me know if you have any other questions about these two operating systems!

前とは違った回答だ。

東京

Irvine
Tokyo
Gemma2
Ah, Tokyo! What would you like to know about this fascinating city? 🇯🇵
Are you interested in:
* **Its history and culture?** I can tell you about the Edo period, traditional Japanese arts, or even specific
neighborhoods and their unique vibes.
* **Things to do there?** From exploring ancient temples and vibrant pop culture hubs to wandering through modern
art museums and bustling shopping streets, Tokyo has it all! I can share information on popular attractions,
hidden gems, and unique experiences.
* **The best time to visit?** Tokyo’s seasons are beautiful and offer different perspectives of the city.
* **Something else?** Maybe you want to know about its cuisine, technology, or nature spots?
Tell me what interests you about Tokyo and I can give you more specific information!

前回と同等の回答だ。

Irvine
Can you recommend Tokyo sightseeing?
Gemma2
I’d love to! To give you the best recommendations, tell me:
* **What are your interests?** (History, anime, nature, food, shopping, art, etc.)
* **Who are you traveling with?** (Friends, family, solo?) This helps me gauge what type of attractions might be
more appealing.
* **How long will you be in Tokyo?**
Knowing these things will help me tailor a list that’s perfect for you!

前回はいくつか候補を挙げてくれたが、今回はどういうところがいいのか、質問を返してきた。

Irvine
Can you tell me the weather forecast of tomorrow in Tokyo?
Gemma2
I can’t provide real-time information, and that includes weather forecasts. As an AI, I don’t have access to live
data like weather patterns.
To get the weather forecast for tomorrow in Tokyo, I recommend checking a reliable online weather source or your
favorite weather app. They will have the most up-to-date information.

前回同様にリアルタイム情報にはアクセスできないと回答。まあ仕方ない。

Irvine
How can I go from Tokyo to Osaka by train ?
Gemma2
You’re in for a treat! Traveling by train is a fantastic way to experience Japan and get a glimpse of its diverse
landscapes. Here’s how to get from Tokyo to Osaka by train:
**The Best Option:** The Shinkansen (bullet train) is the fastest, easiest, and most scenic way to travel between
Tokyo and Osaka.

**Tokyo to Osaka by Shinkansen:**
1. **Choose your route:** There are two main Shinkansen lines that connect Tokyo and Osaka:
* **Tokaido Shinkansen:** This line runs directly from Tokyo Station to Shin-Osaka Station. It’s a popular
option for tourists as it offers the opportunity to see Mount Fuji on a clear day.**

2. **Get your tickets early:** Shinkansen tickets are best purchased in advance, especially if you’re traveling
on popular routes like Osaka. You can buy them online or at ticket counters in major train stations.

3. **Consider different types of Shinkansen:** There are various types of Shinkansen trains:
* **Nozomi:** The fastest and most frequent option, but it doesn’t stop at all stations on the route.**

4. **Purchase a Japan Rail Pass:** If you plan to travel extensively by train in Japan, purchasing a Japan Rail
Pass before arriving can save you a lot of money. This is a great way to make the trip more affordable for
tourists.

**Osaka is a popular destination on the Shinkansen line,** so you’ll have plenty of options.
**From Tokyo:**
* **Travel to Nagoya:** Take the Tokaido Shinkansen (the train line connecting Tokyo and Osaka) to Shin-Osaka
Station. This is the fastest way to get to Osaka.
* **Purchase JR Shinkansen tickets:** You can buy them in advance online, at a travel agent, or at a JR ticket
office.
**The Shinkansen journey offers:**
* **Speed and Efficiency:** The train journey will be a smooth and quick experience.
* **Comfort and Convenience:** Enjoy comfortable seating, spacious interiors, and amenities like free Wi-Fi and
charging ports on many trains.
* **Stunning Views:** The Shinkansen route between Tokyo and Osaka is renowned for its views of Mount Fuji during
certain times of the year.

**Important Considerations:**
* **Timing:** The journey time from Tokyo to Osaka by Shinkansen is roughly **2.5-3 hours**.
* **Cost:** Consider the cost of individual tickets vs. a Japan Rail Pass. If you’re planning on traveling
elsewhere in Japan, a **JR Pass might be more economical.**
* **Comfort and Convenience:** The Shinkansen offers a comfortable and convenient way to travel between Tokyo and
Osaka.
**To choose the best option for your trip, consider:**
* **Your Budget:** Individual tickets can be expensive, but a JR Pass will save you money if you’re traveling on
multiple lines.**
**There are different types of Shinkansen trains, some faster than others:**
* **Hikari:** A good option for those on a tighter budget.
* **Kodama:** This is the slowest and least expensive type of Shinkansen and stops at every station.
**Choosing the right Shinkansen:**
* **Cost:** The Tokaido Shinkansen is the most popular route, connecting Tokyo to Osaka with the highest speed and
fewest stops.**

**5. Travel Time:**
* **Nozoka:** Stops at all stations along the route.
* **Kodama:** Stops at every station between Tokyo and Osaka.

Let me know if you’d like more information on any of these specific train types, as they often have different
levels of comfort and amenities.
**I hope this helps!**
Do you have a particular route in mind or a preference for a specific type of Shinkansen?

ずいぶん長くなり、注意点まで書いてくれている。

日本語で質問

Gemma2 日本語

Gemma2 日本語

挨拶

Irvine
こんにちは
Gemma2
こんにちは!😊
こんにちはと言ってもらえて嬉しいです。😊 あなたに何ができるか、教えてください!
どうしますか?😄

CEOクイズ

Irvine
インテルのCEOは誰ですか
Gemma2
インテルのCEOは **Pat Gelsinger** です。
Irvine
AMDのCEOは誰ですか

正解

Gemma2
AMDの現在のCEOは**Lisa Su**です。
彼女は2014年からCEOを務めており、その間、インテルのCPUを製造する会社であるAMDの業績向上に大きく貢献してきました。

ん?インテルCPUを製造するAMD?

Irvine
NVidiaのCEOは誰ですか
Gemma2
Nvidia の CEO は **Jensen Huang** です。😊
彼は Nvidia の創設者の一人でもあり、1993年から同社を率いています。
何か他に知りたいことがあれば、遠慮なく聞いてください。😄

正解

Irvine
GoogleのCEOは誰ですか
Gemma2
Googleの現在のCEOは **Sundar Pichai** です。
彼は2015年からCEOを務めています。
何か他のことを知りたいですか?
Irvine
MicrosoftのCEOは誰ですか
Gemma2
Microsoft の CEO は **Satya Nadella** です。
彼は、2014年以来、Sundar Pichai によってGoogleが率いられていることを覚えておく必要がありますね!😊
Microsoft のCEOは Google の共同創設者であるジェンソン・フアンではなく、 **サティア・ナデラ** です。
何か他に知りたいことはありますか?

ん-いっていることがよくわからない。

Irvine
1万円札に載っている人は誰?
Gemma2
1万円札に描かれているのは、**野口英世** の肖像です。
彼は日本の有名な実業家ではなく、**細菌学者**で、 **「日本は世界を救う」** というキャッチフレーズで知られる顔見世の
新しいデザインは、多くの人が興味を持ち、企業や研究機関の窓口に
あるように、彼が歴史に残る人物であることを示すヒントがいくつかあります。
* サティア・ナデラは **Microsoft の CEO** です。・・・

ん?マイクロソフトの話が混じっている?
しかも質問は不正解。

Irvine
次のオリンピックはいつどこでやるの?
Gemma2
次のオリンピックは **2024年**、**フランスのパリ** で開催されます!🎉
* 具体的な日付は **2024年7月26日から 8月11日まで** です。

正解

東京クイズ

Irvine
東京
Gemma2
You’re right! The next Olympic Games are in Paris, but…
Did you know that the next Olympics are actually going to be held in **France**, not just anywhere? The Games
will be held in **Paris** , specifically. 🇫🇷・・・

あれ、英語であるし、オリンピックの話が混じっている。

Irvine
東京のお勧めの観光地を教えて
Gemma2
東京のおすすめの観光地ですね!
東京にはたくさんの魅力的な場所がありますので、あなたの興味に合わせていくつかご紹介します。
**定番の観光スポット:**
* **東京スカイツリー:** 東京のシンボルとも言える、高さ634mの巨大なタワーです。展望台からは、東京の景色を一望できます

* **東京タワー:** 東京タワーの足元にあるフットタウンは、お土産屋さんやレストランなどがあります。観覧車からの眺めも楽
しめます。
* **渋谷スクランブル交差点:** 世界的に有名なスクランブル交差点で、スクランブルクロッシングを体験しましょう。
* **浅草寺:** 雷門と仲見世通りを見に行くだけでも価値があります。歴史ある寺院の雰囲気と、下町の風情を楽しめるでしょう

**個性的な体験ができる場所:**
* **秋葉原:** アニメや漫画好きなら、アニメショップやメイド喫茶など、日本のサブカルチャーを体感できる場所です。
* **原宿:** 個性的なファッションやストリートカルチャーが楽しめる街です。
* **浅草寺:** 東京の象徴的な場所の一つで、多くの観光客が訪れます。

**ちょっと変わった東京のスポット:**
* **猫カフェ:** 猫と触れ合いながらお茶を楽しめる、人気の体験です。
* **ロボットレストラン:** 刺激的なロボットショーは、忘れられない思い出になるでしょう。

**自然を満喫できる場所:**
* **新宿御苑:** 広い庭園で、四季折々の花や景色を見ることができ、都会のオアシスとして知られています。
* **皇居:** 東京の中心にある広大な庭園です。

**歴史・文化に触れる場所:**
* **東京国立博物館:** 日本美術や歴史を深く学ぶことができます。
* **浅草橋:** 昔ながらの「下町」の雰囲気を感じることができる場所として知られています。
* **新宿御苑:** 都会の喧騒から離れて、静寂な時間を楽しむことができます。

**ロボットレストラン** は、ちょっと変わった体験をしたい方におすすめです。

**歴史的な場所** を探しているなら、
* **秋葉原にあるロボットレストラン「かっぱ寿司」** など、東京にはたくさんの面白い場所があります。
**どの様な体験を求めていますか?**

例えば、
* **歴史・文化** がお好きですか?
* **最新のテクノロジー** を見てみたいですか?
* **アニメや漫画、ゲームなど** の特定の分野で、 **おすすめの場所** や **イベント** はありますか?

* Let me know what kind of interests you have, and I can give you a more personalized list!

他にない秋葉原、ロボットレストランが上がっている。さすが27B。

Irvine
東京から大阪へ電車で行く方法を教えて
Gemma2
東京から大阪へ電車で行く方法はいくつかあります。
**新幹線で行く:**
* **新幹線「のぞみ」や「ひかり」を使う** のが最も早く、快適です。東京駅から新大阪駅まで、 **東海道新幹線(とうかいし
んかんせん)「のぞみ」または「ひかり」** で移動できます。

**新幹線に乗車する時の注意点:**
* **乗車券は事前に購入するのがおすすめです。** 特に混雑期には、予約が必須です。
* **新幹線はJR東海とJR西日本が運行しています。** 東京駅から名古屋駅や新大阪駅へ向かう際には、東京駅を管理する会社は
「のぞみ」に乗車する時に指定した座席を確保する為にも事前に確認しておきましょう!
* **新幹線は、東京駅から京都駅・名古屋駅など、多くの都市に停車します。**
* **「のぞみ」は、停車駅が少ないので、東京から大阪への移動時間は「のぞみ」と「みずほ(こだま)」「おとく」などの

「弾丸旅行」を体験したいなら、
**東京から大阪へ行く** ために、
* **新幹線で大阪へ行く**
のが最も一般的な方法です。
* **東京駅** から **新幹線の「のぞみ」** や **「ひかり」** で **「東京駅-名古屋駅」**間を **新幹線** で移動する場合
は、
**東京駅・品川駅** などから乗車できます。・・・

前半は正解。この後もだらだらと続き、みずほ、こだみ、おとくという意味不明な列車も登場。酔っぱらっているのかな?

Irvine
PDCAってどういう意味?
Gemma2
PDCA は、ビジネス改善や問題解決などでよく使われる **「フレームワーク」** の名前です。
**「計画(Plan)」、「実行(Do)」、「確認(Check)」、「行動(Action)」** の頭文字をとっています。
* **P: Planning (計画)**
* まずは目標を定め、そしてそれを達成するための計画を立てます。
* **D: Do (実行)**
* 「Plan」の後に「Do」が続くように、具体的な行動計画を立てます。
* **D: Do**
* 「Check」とは、
**「P」は「計画」**
* **「Do」は「実行」**
を利用したものです。・・・

Actionの説明がないのかな。

スマホ対決

Irvine
AndroidとiPhoneのどっちが人気あるの?
Gemma2
AndroidとiPhone、どちらが世界で人気か?という質問ですね!
世界的に見ると、**Android** が圧倒的に利用者数が多いです。
最新のデータによると、スマートフォン市場全体の **「Android」** のシェアは **「70%以上」** です。

**「スマホの最新のシェア率」** は、世界中のモバイルオペレーティングシステム (OS) の人気を測る上で重要な指標です。
**「Android」**
**「Androidのマーケットシェア」**は、
*
スマートフォン市場全体で、* **「世界中のスマホ利用者数」** を考えると、Android は圧倒的に多いです。
**「Google Playストアのアプリのダウンロード数や人気ランキングを参考にすると良いでしょう」**・・・

Irvine
東京の明日の天気を教えて
Gemma2
申し訳ありませんが、私は天気予報を提供することができないAIです。天気情報はリアルタイムで変化するため、正確な予測をす
るには最新のデータが必要になります。
最新の天気予報を確認するには、気象庁のウェブサイト (https://www.jma.go.jp/)や信頼できる天気予報アプリをお勧めします。

URLの提示をするのは進化している。(9Bの方では誤った回答をしていたが)

Irvine
東京の明日の気温を教えて
Gemma2
私は天気予報を提供できません。天気予報は、気象条件の変化を予測するために、最新の気象データと複雑なモデルを使用する必
要があるため、リアルタイムの情報にアクセスできる専門の天気予報サービスやアプリで確認することをお勧めします。
最新の東京の天気予報情報を入手するのに役立つウェブサイトをいくつかご紹介します:
* **日本気象協会:** https://www.jma.go.jp/
* **ウェザーニュース:** https://weathernews.jp/
これらのサービスでは、最新の気温、天気予報、湿度、気温変化などの情報が得られます。

まあそうだわな。

Irvine
日本の最南端はどこ
Gemma2
日本の最南端は**沖縄県の宮古島にある尖草岳(せんそうがく)**です。約1,000メートルで、日本列島の最南端をなっています。

不正解。(9Bは正解)

Irvine
世界の人口は何人
Gemma2
世界の人口は常に変動していますが、2023年10月現在、約80億人と言われています。
正確な数字を知りたい場合は、国連人口基金(UNFPA)などの信頼できる人口統計のデータソースを参照してください。彼らは世
界の人口に関する最新の推定値を提供しています。

正解

Irvine
RFPのひな型を作って
Gemma2
## RFP(Request for Proposal:提案依頼書)のひな型
**[会社名]**
**RFP 提出先:**
**[企業名]**
**[企業住所]**:
**日付:** [日付] **件名:** 世界の[日付]の最新人口に関するデータを提供する、という提案依頼の例ですね!

世界の人口に関する質問は、データ分析が得意な私達には少し難しいです。私は世界の人口やその詳細を把握していません。
**しかし、RFP(提案依頼書)のテンプレートを作成することはできます!**
**[企業名]** 様
**[日付]**
**提案依頼書**
**[プロジェクト名]**
**[提案の対象となるプロジェクトについて簡潔に記述]**

**1. プロジェクト概要**

* この提案を何のために作成されましたか? [企業名]

**2. 提案目的**

[提案する具体的なデータ分析タスクを説明する。例として、以下の項目を参考に編集・追加する。]

* **データ:** 人口、人口密度、年齢構造など、必要なデータのタイプを指定]**

* **範囲:** 本社、工場、従業員数などの情報を提供する。**
* **目的:** [提案するデータ分析の具体的な目標を記述。例:

* 私は[企業名]の[あなたの名前・役職]です。この提案は、世界の人口の動向を分析し、[目的のデータ分析]に関するデータを提供する目的で作成しました。
* このデータ分析の結果を、[対象となる相手]に活用して頂きたく、・・・

ここでも先の質問の影響がみられる。27Bは記憶する機能があるのかな。

動画の紹介

動画は9Bのデータでとっているのでかなり軽快だ。27Bでよく見られただらだらと続く回答や前の質問の記憶があって変な回答をすることはなかった。

まとめ

  • Gemmaは日本語に非対応だったがmGemma2は対応
  • ほかのLLMと異なり、GPUのリソース消費は少ない
  • 9Bは割とまともな回答だった、27Bは迷走しているような回答が出てくる。
  • 記憶している機能があるのか、直前の質問に関する回答を思い出したように話し出す

最近はJisaku8のRTX3060 12GBでは処理しきれないデータ量のLLMも出てきている。CoPilot-PCはGPUほど潤沢なリソースがあるはずないので、当面は10B前後のトレーニングデータに落ち着いていくのかな。

PR

   
著者プロフィール
irvine
 ソフトウェア設計、ストレージ設計を経てクラウドにかかわる仕事をしている、東京郊外在住のエンジニア。
 仕事でUS,UK,SGなどの国とかかわる。
 自作PC、スマホ、タブレット、AV機器好き。ドラクエウォークはルーチンワーク。Linuxやストレージ、IT業界の動向は興味を持っている。
 新しい機器、サービスに興味あり。年数回のレビュー(自腹購入、ご依頼)と発表されて興味があるものの新製品机上レビューをやっている。
 2022年はJAPANNEXT様のアンバサダーを務めました。
 
 

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です