【Python】大規模言語モデルと対話するためのライブラリ「llm」のインストールについて解説しています。
「llm(https://github.com/simonw/llm)」は、OpenAI、PaLM、自分のマシンにインストールされているローカル モデルなどの大規模言語モデルと対話できます。なお、このライブラリではコマンドラインインタフェース(CLI)を介してコンピューターシステムを操作することができます(CLI ユーティリティ)。
■Python
今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows11)
■llmをインストールする
llmをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。
pip install llm
起動後、上記のコマンドを入力し、Enterキーを押します。
なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、バージョンの切り替えを行います。
py -3.8 -m pip install llm
切り替えるために、上記のコマンドを入力し、Enterキーを押します。
Defaulting to user installation because normal site-packages is not writeable Collecting llm Downloading llm-0.5-py3-none-any.whl (22 kB) Collecting click Downloading click-8.1.5-py3-none-any.whl (98 kB) |████████████████████████████████| 98 kB 1.3 MB/s Collecting openai Using cached openai-0.27.8-py3-none-any.whl (73 kB) Collecting python-ulid Downloading python_ulid-1.1.0-py3-none-any.whl (9.4 kB) Collecting click-default-group-wheel Downloading click_default_group_wheel-1.2.2-py3-none-any.whl (3.9 kB) Collecting pluggy Downloading pluggy-1.2.0-py3-none-any.whl (17 kB) Collecting sqlite-utils Downloading sqlite_utils-3.33-py3-none-any.whl (65 kB) |████████████████████████████████| 65 kB 955 kB/s Collecting PyYAML Using cached PyYAML-6.0-cp38-cp38-win_amd64.whl (155 kB) Requirement already satisfied: pydantic>=2.0.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from llm) (2.0.3) Requirement already satisfied: pydantic-core==2.3.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from pydantic>=2.0.0->llm) (2.3.0) Requirement already satisfied: typing-extensions>=4.6.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from pydantic>=2.0.0->llm) (4.7.1) Requirement already satisfied: annotated-types>=0.4.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from pydantic>=2.0.0->llm) (0.5.0) Collecting colorama Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB) Collecting requests>=2.20 Using cached requests-2.31.0-py3-none-any.whl (62 kB) Collecting tqdm Using cached tqdm-4.65.0-py3-none-any.whl (77 kB) Collecting aiohttp Using cached aiohttp-3.8.4-cp38-cp38-win_amd64.whl (324 kB) Collecting urllib3<3,>=1.21.1 Using cached urllib3-2.0.3-py3-none-any.whl (123 kB) Collecting charset-normalizer<4,>=2 Using cached charset_normalizer-3.2.0-cp38-cp38-win_amd64.whl (96 kB) Collecting certifi>=2017.4.17 Using cached certifi-2023.5.7-py3-none-any.whl (156 kB) Collecting idna<4,>=2.5 Using cached idna-3.4-py3-none-any.whl (61 kB) Collecting aiosignal>=1.1.2 Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB) Collecting multidict<7.0,>=4.5 Using cached multidict-6.0.4-cp38-cp38-win_amd64.whl (28 kB) Collecting frozenlist>=1.1.1 Downloading frozenlist-1.4.0-cp38-cp38-win_amd64.whl (44 kB) |████████████████████████████████| 44 kB 685 kB/s Collecting yarl<2.0,>=1.0 Using cached yarl-1.9.2-cp38-cp38-win_amd64.whl (61 kB) Collecting attrs>=17.3.0 Using cached attrs-23.1.0-py3-none-any.whl (61 kB) Collecting async-timeout<5.0,>=4.0.0a3 Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB) Collecting python-dateutil Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting tabulate Downloading tabulate-0.9.0-py3-none-any.whl (35 kB) Collecting sqlite-fts4 Downloading sqlite_fts4-1.0.3-py3-none-any.whl (10.0 kB) Collecting six>=1.5 Using cached six-1.16.0-py2.py3-none-any.whl (11 kB) Installing collected packages: multidict, idna, frozenlist, colorama, yarl, urllib3, six, click, charset-normalizer, certifi, attrs, async-timeout, aiosignal, tqdm, tabulate, sqlite-fts4, requests, python-dateutil, click-default-group-wheel, aiohttp, sqlite-utils, PyYAML, python-ulid, pluggy, openai, llm WARNING: The script normalizer.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script tqdm.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script tabulate.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script sqlite-utils.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script openai.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script llm.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed PyYAML-6.0 aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 attrs-23.1.0 certifi-2023.5.7 charset-normalizer-3.2.0 click-8.1.5 click-default-group-wheel-1.2.2 colorama-0.4.6 frozenlist-1.4.0 idna-3.4 llm-0.5 multidict-6.0.4 openai-0.27.8 pluggy-1.2.0 python-dateutil-2.8.2 python-ulid-1.1.0 requests-2.31.0 six-1.16.0 sqlite-fts4-1.0.3 sqlite-utils-3.33 tabulate-0.9.0 tqdm-4.65.0 urllib3-2.0.3 yarl-1.9.2 WARNING: You are using pip version 21.1.1; however, version 23.2 is available. You should consider upgrading via the 'C:\Program Files\Python38\python.exe -m pip install --upgrade pip' command.
Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、llmが正常にインストールされたことになりますが、「WARNING」と表示されました。「WARNING」はエラーではなく警告で、インストールは行われているので、今回は一旦無視しています。
なお、今回はllmのバージョン0.5をインストールしました。
コメント