关键字名称 / 关键名称:./SLMo42.md
(项目背景说明:https://github.com/escrivivir-co/oasis-features-lab-no-official)
Oasis AI服务 - GPU优化版
为Oasis提供的AI服务,包含GPU优化的本地模型及函数调用支持。
🚀 特性
- GPU加速针对支持CUDA的NVIDIA GPU进行了优化
- 本地模型使用node-llama-cpp在本地运行模型
- 函数调用内置函数调用功能
- 性能监控GPU诊断和基准测试工具
- GPU优化专为高端GPU进行优化
📋 要求
- 支持ES模块的Node.js 18+
- 配备驱动程序450.80.02+的NVIDIA GPU(推荐RTX系列)
- 8GB+ 显存(建议GPU使用24GB)
- Windows 10/11 或 Linux
🛠️ 安装
npm install
npm run setup🎯 可用脚本
核心服务
npm start- 启动AI服务npm run build- 构建服务npm run setup- 运行安装程序
GPU诊断与测试
npm run gpu:check- 检查GPU状态并获取建议npm run diagnostic- 与 gpu:check 相同(别名)npm run verify-gpu- 完整的GPU验证(检查+简单测试)
GPU性能测试
npm run gpu:test-simple- 简单的GPU性能测试npm run gpu:test-real- 实际模型测试,同时监控VRAM(视频随机存取存储器)npm run test:local-model- 测试本地模型加载(别名)
函数调用测试
npm run gpu:test-functions- 使用自定义包装器测试函数npm run gpu:test-simple-functions- 测试无包装器的功能(推荐)npm run test:functions- 简单的功能测试(别名)
Legacy Llama 测试
npm run llama:test-handler- 测试llama处理器npm run llama:test-functions- 测试llama函数npm run llama:test-no-functions- 无函数测试
综合测试
npm run test:all-gpu- 运行所有GPU测试(检查+简单+函数)npm run benchmark- 性能基准(简单功能+函数)
🎮 快速入门
- 检查您的GPU设置:
npm run gpu:check- 进行一个简单的测试:
npm run gpu:test-simple- 使用函数进行测试:
npm run test:functions- 进行全面测试:
npm run test:all-gpu🔧 GPU 配置
这些设置针对GPU进行了优化,以提供以下服务:
const config = {
gpu: true, // GPU enabled by default
gpuLayers: undefined, // Auto - load maximum layers on GPU
vramPadding: 256, // 256MB padding for 24GB VRAM
};对于不同的GPU,请进行调整 vramPadding:
- 4GB 显存(用于VR)64MB 填充
- 8GB 显存128MB 填充
- 16GB+ 显存256MB+ 填充
📊 性能指标
预期的GPU性能表现:
- 模型加载约5-6GB的VRAM使用量
- 推理速度每次响应200-500毫秒
- 每秒代币数15-30(取决于型号大小)
🐛 故障排除
未检测到GPU
npm run gpu:check检查输出以获取建议。
模型加载问题
确保模型文件存在于:
src/AI/models/oasis-42-1-chat.Q4_K_M.gguf函数调用问题
使用简单函数进行测试:
npm run test:functions性能问题
运行基准测试:
npm run benchmark📁 文件结构
src/AI/
├── package.json
├── ai_service.mjs
├── models/
│ └── oasis-42-1-chat.Q4_K_M.gguf
└── plugins/
├── node_llama_cpp_handler.mjs # Main model handler
├── llama_functions_handler.mjs # Function calling handler
├── gpu_diagnostics.mjs # GPU diagnostic tools
├── test_gpu_simple.mjs # Simple GPU test
├── test_simple_functions.mjs # Function test
└── test_*.mjs # Various test files🏆 GPU优化结果
✅ GPU已启用并正常工作 ✅ 使用了5+ GB显存(VRAM) (模型已完全加载到GPU上) ✅ 亚秒级响应 (表现出色) ✅ GPU得到充分利用 (最大加速度)
您的 node-llama-cpp 客户端现已优化为支持 GPU! 🚀(火箭发射或快速前进的符号,常用来表示快速、进步或突破)
