动手学Ollama,CPU玩转大模型部署,在线阅读地址:https://datawhalechina.github.io/handy-ollama/
| Files | Last commit | Last update |
|---|---|---|
| 1 year ago | ||
| 1 year ago | ||
| 1 year ago | ||
| 2 years ago | ||
| 1 year ago | ||
| 1 year ago | ||
| 1 year ago |
📚 Master Large Model Deployment on CPU from Scratch!
Learn Ollama Hands-On: Fast Local Deployment of Large Language Models
简体中文 | English
🚀 Introduction
A hands-on tutorial series for Ollama, designed to simplify the process of deploying large language models locally. With this guide, you'll be able to manage and run powerful LLMs right on your CPU, making advanced AI accessible without GPU dependencies!
Our comprehensive tutorial covers everything from beginner basics to advanced usage, complete with real-world examples that demonstrate practical applications of LLM deployment. Whether you're a complete novice or an experienced developer, our step-by-step instructions and practical tips will help you master Ollama and start building your own LLM-powered applications.
Key Topics Covered:
- Introduction, Installation & Configuration:
- macOS, Windows, Linux, and Docker deployment guides.
- Custom Model Integration:
- Import from GGUF, PyTorch, Safetensors, and custom prompt engineering.
- Ollama REST API:
- Comprehensive usage guide with examples in Python, Java, JavaScript, and C++.
- LangChain Integration:
- Seamless integration with Python and JavaScript workflows.
- Visual Interfaces & Use Cases:
- Build interactive chat UIs with FastAPI and WebUI, plus practical RAG and Agent applications.
We warmly welcome contributions! Submit issues or pull requests to help improve this project. Let's make advanced AI accessible to everyone!
Our Mission: Empower every LLM enthusiast to explore and experiment, regardless of programming background or computational resources. We're breaking down technical barriers to make LLM deployment achievable on personal computers. Join us on this exciting journey!
Directory Structure:
docs ---------------------- Markdown documentation files
notebook ------------------ Notebook source code and Python/Java/JavaScript examples
images -------------------- Image assets
📖 Read Online: https://datawhalechina.github.io/handy-ollama/
⚠️ Security Notice
Security Advisory: Ollama's Default Configuration Risks
According to the Tsinghua University Cyberspace Mapping Joint Research Center, the open-source cross-platform LLM tool Ollama has security vulnerabilities in its default configuration, including unauthorized access and model theft risks. Given the widespread use of models like DeepSeek deployed via Ollama in private environments without configuration changes, users face risks of data leakage, unauthorized resource usage, and service disruptions.
Key Risks:
- Unauthorized Access:
- Default configuration exposes port 11434 without authentication. Attackers can access models, execute commands, and steal sensitive data.
- Data Leakage:
- Sensitive information (e.g., model licenses, parameters) can be extracted via unprotected API endpoints.
- Exploitable Vulnerabilities:
- Historical vulnerabilities (CVE-2024-39720/39722/39719/39721) allow data poisoning, parameter theft, and malicious file operations.
Security Recommendations:
- Restrict Network Access:
- Configure Ollama to listen only on localhost and verify port settings.
- Firewall Configuration:
- Block public access to port 11434 using双向端口过滤.
- Enable Authentication:
- Use API keys, rate limiting, and IP whitelisting.
- Disable Risky APIs:
- Restrict or disable endpoints like
/push,/delete, and/pull.
- Restrict or disable endpoints like
- Update Regularly:
- Keep Ollama updated to patch known vulnerabilities.
We strongly recommend users audit their Ollama deployments, apply these security measures, and report any suspicious activity to local cybersecurity authorities. The National Cybersecurity Information Sharing Center will continue monitoring and issuing updates.
💡 Motivation
The rapid growth of open-source LLMs has democratized AI, but many require GPU resources for deployment. Our goal is to make LLM technology accessible to everyone—regardless of hardware limitations—using Ollama, an open-source tool that enables CPU-based deployment of powerful language models.
This tutorial series empowers learners, hobbyists, and developers to deploy and experiment with LLMs locally, fostering innovation across industries.
🎯 Target Audience
- Resource-Constrained Users: Run LLMs locally without GPU dependencies.
- Developers: Build and test LLM-powered applications on consumer hardware.
- AI Enthusiasts: Experiment with state-of-the-art models without cloud costs.
- Privacy-Conscious Users: Keep sensitive data and model operations local.
✨ Highlights
While many LLM tutorials rely on GPU acceleration, this project focuses exclusively on CPU-based deployment, making advanced AI accessible to anyone with a modern computer. Through hands-on examples and clear explanations, we bridge the gap between theory and practice.
📖 Roadmap
Table of Contents (Work in Progress)
Note: We welcome contributions to complete the pending sections! Submit issues or pull requests to help expand this project.
Interested in becoming a maintainer? Contact us to join our core team!
🙏 Acknowledgments
Official Ollama Repository: https://github.com/ollama/ollama
Special thanks to our contributors!
Star History
LICENSE
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Introduction
动手学Ollama,CPU玩转大模型部署,在线阅读地址:https://datawhalechina.github.io/handy-ollama/
Customize your domain