Last active
March 21, 2026 08:10
-
-
Save clairefro/4373d4c3a97310a63b40d520d9f518d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Hugging FaceからのモデルをOllamaで実行する方法 | |
| ## 参照:https://www.markhneedham.com/blog/2023/10/18/ollama-hugging-face-gguf-models | |
| ## Ollamaをゲット:https://ollama.com/download | |
| # 1. hugging faceのCLIを取得 | |
| ## pipの場合 | |
| pip install -U "huggingface_hub[cli]" | |
| ## pip3の場合は:pip3 install -U "huggingface_hub[cli]" | |
| ## どこかにモデルファイルのためのフォルダを作成 | |
| mkdir ~/ollama-models | |
| cd ~/ollama-models | |
| # 2. hugging faceからローカルにモデルをダウンロード | |
| ## ダウンロードが完了すると、./downloadsというフォルダーにモデルが保存されます | |
| ## 各モデルは約4G、、、ダウンロードは5〜10分ほどかかります | |
| ## チャットモデルの場合 | |
| huggingface-cli download mmnga/RakutenAI-7B-chat-gguf RakutenAI-7B-chat-q4_0.gguf --local-dir downloads --local-dir-use-symlinks False | |
| ## 指示モデルの場合 | |
| huggingface-cli download mmnga/RakutenAI-7B-instruct-gguf RakutenAI-7B-instruct-q4_0.gguf --local-dir downloads --local-dir-use-symlinks False | |
| ## ベースモデルの場合 | |
| huggingface-cli download mmnga/RakutenAI-7B-gguf RakutenAI-7B-q4_0.gguf --local-dir downloads --local-dir-use-symlinks False | |
| # 3. Ollama用のモデルファイルを作成 | |
| ## チャットモデルのモデルファイルを例に | |
| touch ./Rakuten-chat | |
| echo "FROM ./downloads/RakutenAI-7B-chat-q4_0.gguf" > ./Rakuten-chat | |
| # 4. OllamaでモデルをBuild | |
| ollama create rakuten-chat -f ./Rakuten-chat | |
| # 5. Ollamaでモデルを実行 | |
| ollama run rakuten-chat | |
| ## 実行した上、そのままターミナル上でチャットするか、OllamaのREST APIを使用できます | |
| ## Ollama REST APIの使用方法:https://www.postman.com/postman-student-programs/workspace/ollama-api/collection/21521806-f48dc31a-a9f1-4dad-9082-fd07f5cd2fda | |
| ## モデルをアンインストールには | |
| ollama rm <モデル名> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PostmanでAPIを試してまる
このコレクションをフォークし、generate(指示モデルの場合)またはchat(チャットモデルの場合)のリクエストを使用できます。
ロカルで使用する場合、ベースURLを
http://localhost:11434に設定します例)mistral(指示モデル)のロカルでの使用
.png?raw=true)