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?

貧乏でもたっぷり遊べるLLM!OllamaとオープンソースLLM

Last updated at Posted at 2025-04-28

課金なし!OllamaとオープンソースLLM

Ollamaとは?

image.png image.png

  • Ollamaは、ローカルでオープンソースのLLMを超簡単に動かせるツール。
  • ターミナルコマンドだけで、モデルのダウンロード・実行・チャット可。
  • ローカルで起動したLLMに対して、APIを通じてアクセスすることも可能!

Ollamaのインストール(MacOS)

Homebrew で Ollama をインストールしました

$ brew install ollama

モデル(Llama 3 [Metaの最新大型モデル])を起動

$ ollama run llama3

⚠️エラーが出ちゃった

Error: could not connect to ollama app, is it running?

Ollama自体が動いてないからモデルも動かせない (そら、そうだ)

# Ollamaのデーモンを起動
$ ollama serve

(改めて!🤫) Llama 3 をダウンロード & 起動☕️

# Llama 3 をダウンロード & 起動
% ollama run llama3

しばらくダウンロードが終わるのを待つと, こんなメッセージが🤭

ayuko@ootaamubenoMacBook-Pro ~ % ollama run llama3
pulling manifest 
pulling 6a0746a1ec1a: 100% ▕██████████████████▏ 4.7 GB                         
pulling 4fa551d4f938: 100% ▕██████████████████▏  12 KB                         
pulling 8ab4849b038c: 100% ▕██████████████████▏  254 B                         
pulling 577073ffcc6c: 100% ▕██████████████████▏  110 B                         
pulling 3f8eb4da87fa: 100% ▕██████████████████▏  485 B                         
verifying sha256 digest 
writing manifest 
success 
>>> Send a message (/? for help)

llama3のチャットをお触りしてみよう

早速、チャットを始めましょう🤗

>>> こんにちは、自己紹介して!
Konnichiwa! 😊

I'm LLaMA, a large language model trained by Meta AI. I'm here to assist 
you with your questions and tasks in Japanese.

A little about me:

* I can understand and respond in natural language, just like a human.
* My training data includes a massive amount of text from the internet, 
which I use to generate responses.
* I can be used for various purposes, such as language learning, 
translation, writing assistance, and more.
* I'm constantly learning and improving my responses based on user 
interactions.

As for your interests, I'd love to know what you're passionate about! Do 
you have a favorite anime, manga, or Japanese food? Let's chat and see if 
we can find common ground! 😊

日本語でも反応してくれた!

コマンド /? を入力すると、コマンドの一覧が表示

>>> /?
Available Commands:
  /set            Set session variables
  /show           Show model information
  /load <model>   Load a session or model
  /save <model>   Save your current session
  /clear          Clear session context
  /bye            Exit
  /?, /help       Help for a command
  /? shortcuts    Help for keyboard shortcuts

Use """ to begin a multi-line message.

よく使いそうなコマンド

操作 コマンド/入力
通常メッセージを送信 (例)こんにちは!
新しいチャットを始める /reset
セッションを終了 Ctrl + C
lammaを停止 /bye または Ctrl + D
ヘルプ /?

今日はここまで

驚くほど手軽にローカルLLMが構築できた。
"日本語で"とプロンプトを入れれば、一応、日本語で回答してくれたよ。
次回は日本語で学習させたllama3やカスタムも試してみたい。

>>> 日本語で回答して。
こんにちは!自己紹介します。

私たちはLLaMA、Meta AIが訓練した大規模言語モデルです。我々は、日本語での問い合わせやタス
クに対応することを目指しています。

ちょっと私の情報:

* 私たちは自然言語で理解し、人間のように返信します。
* 私たちのトレーニングデータには、インターネットから大量のテキストがあります。これを基に
レスポンスを生成します。
* 私たちは、異なる目的で使用することができます。例えば、言語学習、翻訳、書きかけの
-Assistance などです。
* 私たちは、ユーザーのインタラクションに基づいて、常に学びながらレスポンスを改善していま
す。

あなたの興味について知りたいと思います!あるいは、日本のアニメーション、漫画や日本食が好
きなのですか?一緒に話し合い、あなたと同じく何か分かるものを見つけることにします!

0
0
0

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?