Skip to content

A local AI English learning assistant optimized specifically for the Raspberry Pi 5.

Notifications You must be signed in to change notification settings

Freakz3z/LexiPi

Repository files navigation

🥧 LexiPi - Raspberry Pi 专用 AI 英语私教

English | 详细介绍 | 模型文件

LexiPi Performance Dashboard

LexiPi 是一个专为 Raspberry Pi 5 优化的本地 AI 英语学习助手。它运行在完全本地的环境中,利用深度优化的 LLM(大语言模型)提供流畅的口语对话和单词记忆服务,无需联网即可进行高性能推理。

🚀 核心优势: 在树莓派 5 (8GB) 上实现了 19+ TPS 的生成速度和 <230ms 的极低延迟,同时内存占用仅为同类模型的 60%


✨ 主要特性

  • 🔒 100% 本地运行: 所有推理都在树莓派上完成,保护隐私,无需 API 密钥,无惧断网。
  • ⚡ 极致性能优化:
    • 针对 ARM 架构优化的量化模型。
    • 定制的 config.json 调度策略,充分利用 4 核 CPU。
    • 内置预热机制 (Warm-up),拒绝冷启动卡顿。
  • 🗣️ 双模式教学:
    • Word Mode (单词模式): 快速查词、例句生成、词根记忆。
    • Oral Mode (口语模式): 沉浸式角色扮演对话,支持长上下文记忆。
  • 🧠 轻量级: 运行时仅占用约 1.8GB 内存,为系统和其他应用留出充足空间。
  • 🌐 Web 交互界面: 基于 Django 构建的现代化响应式 Web UI。

📊 性能表现 (Raspberry Pi 5)

经过深度优化,LexiPi 在各项指标上均全面超越原始 Base 模型 (Qwen3:0.6b):

指标 LexiPi (Word) LexiPi (Oral) Base Model 提升幅度
生成速度 (TPS) 19.1 16.4 15.8 🚀 +21%
内存占用 22.7% (~1.8GB) 25.5% 38.5% (~3.0GB) 📉 -41%
响应延迟 (TTFT) ~220ms ~225ms ~330ms 快 33%

(数据基于 2025年12月10日 实测结果)


🛠️ 安装指南

1. 环境要求

  • 硬件: Raspberry Pi 5 (推荐 8GB 版本,4GB 亦可运行但需调整配置)
  • 系统: Raspberry Pi OS (64-bit)
  • 软件: Python 3.11+, Ollama

2. 安装步骤

第一步:克隆项目

git clone https://github.com/yourusername/LexiPi.git
cd LexiPi

第二步:安装 Ollama & 模型

确保你已经安装了 Ollama

# 导入自定义模型 (假设你已有 GGUF 文件)
ollama create lexipi -f model/Modelfile

第三步:安装 Python 依赖

pip install -r requirements.txt

🚀 快速开始

启动服务

我们提供了便捷的启动脚本,会自动拉起 Django 服务并进行模型预热。

Windows:

start.bat

Linux / Raspberry Pi:

chmod +x start.sh
./start.sh

启动后,访问浏览器:http://localhost:8000


⚙️ 配置说明

项目根目录下的 config.json 允许你微调模型参数以适应不同的硬件环境:

{
    "models": {
        "configs": {
            "word": {
                "num_ctx": 2048,    // 上下文窗口
                "num_batch": 512,   // 批处理大小
                "num_thread": 4     // 线程数 (建议设为 CPU 核心数)
            },
            "oral": {
                "num_ctx": 4096,    // 口语模式需要更长的上下文
                "num_batch": 512
            }
        }
    }
}

📂 项目结构

LexiPi/
├── lexipi_web/          # Django Web 应用源码
├── model/               # 模型文件 (GGUF & Modelfile)
├── config.json          # 模型推理配置文件
├── performance_results.csv # 性能测试数据
├── test_performance.py  # 性能基准测试脚本
├── generate_dashboard.py # 图表生成脚本
├── start.sh             # Linux 启动脚本
└── start.bat            # Windows 启动脚本

About

A local AI English learning assistant optimized specifically for the Raspberry Pi 5.

Topics

Resources

Stars

Watchers

Forks