InternLM 是开源模型领域的开源项目,由 InternLM 开发,2023 年首次发布。
在全站 13,090 个收录项目中,它的 GitHub 星标数(7,279)位列前 7%,在开源模型分类的 424 个项目里位列前 9%。
项目已超过三个月没有代码更新,维护节奏明显放缓,最近一次代码更新于 2026-09-22。Apache-2.0许可,可免费下载使用,无在线服务。
它主要面向的使用场景是:中文对话助手和客服系统开发。同类可对比的替代方案包括 LLaMA、ChatGLM、Qwen。

开箱即用的中文大模型,从预训练到部署全流程搞定
InternLM 是由上海人工智能实验室开源的大型语言模型系列,涵盖 InternLM、InternLM2、InternLM2.5 和 InternLM3 等多个版本。该项目旨在提供高性能、可商用的大模型基座,解决中文场景下的自然语言理解与生成问题。核心能力包括模型预训练、微调、RLHF 对齐、长上下文支持(如 1M token)以及高效的 FlashAttention 加速。项目提供了完整的模型权重、训练代码和推理工具,支持从学术研究到工业落地的全流程。其模型在中文理解、数学推理和代码生成等任务上表现优异,且针对国产硬件和部署场景做了优化。通过开源,项目降低了大模型的使用门槛,开发者可以基于其进行二次开发或直接部署。
1安装 LMDeploy
LMDeploy 是官方推荐的压缩、部署与服务化工具包,用一条 pip 命令安装即可,建议在独立虚拟环境中执行。
pip install lmdeploy2本地批量推理
用 LMDeploy 的 pipeline 直接加载模型并提问,脚本会自动从 HuggingFace 拉取权重,首次运行需等待下载完成。
import lmdeploy
model_dir = "internlm/internlm3-8b-instruct"
pipe = lmdeploy.pipeline(model_dir)
response = pipe("Please tell me five scenic spots in Shanghai")
print(response)3启动兼容 API 服务
启动 OpenAI 兼容的推理服务,--model-name 用于指定请求时使用的模型名,--server-port 指定监听端口。
lmdeploy serve api_server internlm/internlm3-8b-instruct --model-name internlm3-8b-instruct --server-port 233334发起对话请求
服务启动后,用 curl 向本地 23333 端口发送 chat/completions 请求,注意 model 字段要与启动时的 --model-name 保持一致。
curl http://localhost:23333/v1/chat/completions
-H "Content-Type: application/json"
-d '{
"model": "internlm3-8b-instruct",
"messages": [
{"role": "user", "content": "Please tell me five scenic spots in Shanghai"}
]
}'5安装 Ollama 方案
另一种更轻量的本地运行方式:先用官方脚本安装 Ollama,再安装 ollama 的 Python 客户端库。
curl -fsSL https://ollama.com/install.sh | sh
pip install ollama6Ollama 流式推理
通过 ollama.chat 指定 model 为 internlm/internlm3-8b-instruct,开启 stream 逐块打印模型回复内容。
import ollama
system_prompt = """You are an AI assistant whose name is InternLM (书生·浦语).
- InternLM (书生·浦语) is a conversational language model that is developed by Shanghai AI Laboratory (上海人工智能实验室). It is designed to be helpful, honest, and harmless.
- InternLM (书生·浦语) can understand and communicate fluently in the language chosen by the user such as English and 中文."""
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "Please tell me five scenic spots in Shanghai"}
]
stream = ollama.chat(
model='internlm/internlm3-8b-instruct',
messages=messages,
stream=True,
)
for chunk in stream:
print(chunk['message']['content'], end='', flush=True)| 配置项 | 必填 | 说明 | 示例 |
|---|---|---|---|
model_dir | 是 | 模型权重目录或 HuggingFace 仓库名,LMDeploy 据此加载模型 | internlm/internlm3-8b-instruct |
--model-name | 否 | API 服务对外暴露的模型名称,需与请求体 model 字段一致 | internlm3-8b-instruct |
--server-port | 否 | OpenAI 兼容服务的监听端口 | 23333 |
num_ctx | 否 | Ollama 调用的上下文窗口长度 | 8192 |
num_predict | 否 | Ollama 调用的最大生成 token 数 | 2048 |
API 服务启动后,curl 请求返回包含模型回复的 JSON;或在 Python 中运行 pipeline,终端打印出上海五个景点即成功。
Q:curl 请求报模型名不存在怎么办?
A:检查请求体中的 model 字段是否与启动服务时 --model-name 的值完全一致,示例中为 internlm3-8b-instruct。
Q:如何让模型支持更长上下文?
A:使用 Ollama 调用时可通过 options 传入 num_ctx 参数,README 示例中设置为 8192。
Q:LMDeploy 和 Ollama 两种方式该选哪个?
A:LMDeploy 适合批量推理和自建 OpenAI 兼容服务;Ollama 安装更轻量,适合本地快速对话体验。可任选其一。
Q:首次运行很慢是正常的吗?
A:正常。首次运行会自动下载模型权重,体积较大,需要等待下载完成后再进行推理。
LLaMA、ChatGLM、Qwen
InternLM 是开源模型领域的开源项目,由 InternLM 开发,2023 年首次发布。
在全站 13,090 个收录项目中,它的 GitHub 星标数(7,279)位列前 7%,在开源模型分类的 424 个项目里位列前 9%。
项目已超过三个月没有代码更新,维护节奏明显放缓,最近一次代码更新于 2026-09-22。Apache-2.0许可,可免费下载使用,无在线服务。
它主要面向的使用场景是:中文对话助手和客服系统开发。同类可对比的替代方案包括 LLaMA、ChatGLM、Qwen。
Machine-Learning
开源
跟着博客笔记,边看边跑机器学习代码
All content related to machine learning from my blog
awesome-claude-fable-5-prompt-va···
开源
一站式掌握 Claude Fable 5 玩法,快速选型不踩坑
Ultimate Claude Fable 5 Guide 2026: Use Cases, Integrations & Benchmarks
Diffusion-Models-Papers-Survey-T···
开源
学视频生成怕绕路?这份资料库帮你理清
Diffusion model papers, survey, and taxonomy
CoreML-Models
开源
下载即用的苹果端 AI 模型库,免去转换烦恼
Core ML model zoo for iOS/macOS — PyTorch models converted to ready-to-use .mlpacka···