GPT中文GPT中文论坛社区AI工具软件大全 GPT.CC Claude Fable 5 · GPT-5.6 直连,不用连国际网 去看看 →
AI工具软件大全
首页 / 文章 / 零一万物 Yi 快速上手教程(GitHub README 中文整理)
📖 教程 · 7 分钟读完 · 2026-07-24

零一万物 Yi 快速上手教程(GitHub README 中文整理)

从 零一万物 Yi 官方 GitHub README 翻译整理的快速上手指南。

零一万物 Yi 快速上手教程

是什么

Yi 系列模型是 01.AI(零一万物)从头训练的新一代开源双语大语言模型。基于 Transformer 架构,在 3T 多语言语料上训练,支持中文和英文。模型架构与 Llama 相同,但不是 Llama 的衍生品。

能干什么

Yi 模型在语言理解、常识推理、阅读理解等任务上表现出色:

提供两类模型:

怎么装

环境要求

安装方法

方式一:pip 安装

pip install transformers

方式二:Docker

docker pull 01ai/yi:latest

方式三:llama.cpp(适合 CPU 推理)

git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
make
# 下载 GGUF 格式模型后使用
./main -m yi-34b-chat.gguf -p "你好"

模型下载

模型托管在 Hugging Face 和 ModelScope(国内推荐):

模型 参数 下载地址
Yi-6B-Chat 6B 01-ai/Yi-6B-Chat
Yi-34B-Chat 34B 01-ai/Yi-34B-Chat
Yi-6B 6B (base) 01-ai/Yi-6B
Yi-34B 34B (base) 01-ai/Yi-34B

怎么用第一个例子

基础对话(Python)

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "01-ai/Yi-6B-Chat"  # 也可换为 Yi-34B-Chat

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    device_map="auto",
    trust_remote_code=True
)

messages = [
    {"role": "user", "content": "你好,请介绍一下你自己"}
]

input_ids = tokenizer.apply_chat_template(
    messages, 
    add_generation_prompt=True, 
    return_tensors="pt"
).to(model.device)

outputs = model.generate(
    input_ids,
    max_new_tokens=512,
    do_sample=True,
    temperature=0.7
)

response = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)
print(response)

启动 Web 界面

# 安装 gradio
pip install gradio

# 运行官方 Web demo
python web_demo.py --model 01-ai/Yi-6B-Chat

社区资源


翻译整理自 GitHub README,原文:https://github.com/01-ai/Yi

01

本文涉及的工具

02

相关阅读