「.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
OSS(オープンソース)のLLMは、ローカルマシンやオンプレミス環境で動作可能なものが多く、
クラウドサービスに依存せずに利用でき、機密情報を扱うクローズドな環境でも安全に導入できる。
コミュニティの活動状況を確認。
OSS LLMのメンテナンス体制とサポート体制を確認。
モデルのトレーニングや推論に使用するデータの保護を確認。
アブダビのTechnology Innovation Institute(TII)によって開発
BigScience?という協力的AI研究ワークショップによって開発
草の根の非営利の人工知能研究グループによって開発
Salesforceが提供するLLM
AI/BI系のプラットフォームベンダで、色々なOSSをホストしている。
フロントアプリ作成(データパイプラインの構築と管理)をサポートするローコード・ツール
ollama
ollama run llama2 ollama run llama3
ollama run gemma2
ollama run phi3
curl https://ollama.ai/install.sh | sh※ リダイレクトされる場合は、-Lオプションを追加する。
ollama serve
ollama run llama3
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
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())
Pythonで実装されており、モデル設定のURLからサーバサイドで実行されている事が解る。
docker run -d -p 5955:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
http://127.0.0.1:5955/
http://host.docker.internal:11434
StreamlitはPythonアプリ(CLI)を迅速にWeb化するツール。
標準I/Oへ書き込むのではなくAPIを使用して専用のStreamへの書き込む。
pip install streamlit
streamlit run LLM_Streamlit.py
http://localhost:8501/
5(営業日/週) * 4(週/月)* 3(時間/日)= 60(時間/月)で見積もり
※ 1か月フル稼働は730時間なので30/730=0.04ヵ月分(つまり、以下の「/月」は、=0.04ヵ月分)
Azureバッション2万/月
コレはミニマム環境なので、予算としては、5万/月ほどあると良さそう。
LlamaIndexを使うか、NoSQLの機能を使用する(古くはElasticsearchなどあるが、ベクトル検索、グラフ検索に対応した新しいものが出てきている)。
LLMの新規作成時にタスクへ適応させるためのFT(GPT-n、BERT)ではなく、作成後のLLMの精度を上げるために行われるFTについて言及
Llama、Gemma、phiなどがある。