「.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
WindowにOllama - Llama3をインストールして実行する。
ollama
ollama run llama2 ollama run llama3
ollama run gemma2
ollama run phi3
LinuxにOllama - Llama3をインストールして実行する。
curl https://ollama.ai/install.sh | sh※ リダイレクトされる場合は、-Lオプションを追加する。
ollama serve
ollama run llama3
success >>> こんにちは、あなたは誰ですか? こんにちは!I'm LLaMA, a large language model trained by a team of researcher at Meta AI. My primary function is to understand and respond to human input in a helpful and informative manner. I can converse on a wide range of topics, from science and history to entertainment and culture. I'm constantly learning and improving my abilities, so please bear with me if I make any mistakes. Nice to meet you!
curl -X POST -H "Content-Type:application/json" http://localhost:11434/api/chat -d "{\"model\": \"llama3\", \"messages\": [{ \"role\": \"user\", \"content\": \"why is the sky blue?\" }]}"
>ipconfig イーサネット アダプター vEthernet (WSL): 接続固有の DNS サフィックス . . . . .: リンクローカル IPv6 アドレス. . . . .: ... IPv4 アドレス . . . . . . . . . . . .: 172.xxx.xxx.1 サブネット マスク . . . . . . . . . .: 255.255.240.0 デフォルト ゲートウェイ . . . . . . .:
OLLAMA_HOST OLLAMA_ORIGINS
curl http://localhost:11434/api/generate -d '{ "model": "llama3", "prompt":"user", "content": "why is the sky blue?" }'チャット形式
curl http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ { "role": "user", "content": "why is the sky blue?" } ] }'
import requests url = "http://localhost:11434/api/chat" payload = { "model": "llama3", "messages": [ {"role": "user", "content": "why is the sky blue?"} ] } response = requests.post(url, json=payload) print(response.text) # print(response.json())
Error: digest mismatchになる場合(恐らくプロキシ環境で発生)、
huggingface.co(dockerで言うとdocker.comみたいな仕組み)から、
モデルのファイル(GGUF file、Model file)を手動ダウンロード。
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Phi-3-mini-4k-instruct-q4.gguf --local-dir .
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Modelfile_q4 --local-dir .
ollama create phi3 -f Modelfile_q4
ollama run phi3
ollama rm phi3
huggingface-cli download bartowski/Llama-3.2-1B-Instruct-GGUF Llama-3.2-1B-Instruct-Q8_0.gguf --local-dir .
ollama run hf.co/bartowski/Llama-3.2-1B-Instruct-GGUF:Q8_0
ollama show --modelfile hf.co/bartowski/Llama-3.2-1B-Instruct-GGUF:Q8_0 > Modelfile.txt
ollama create Llama3 -f Modelfile.txt
ollama run Llama3
ollama rm Llama3