这里是按照「分类」阅读往期的 HelloGitHub 月刊内容, 您目前在查看 HelloGitHub 人工智能 集合。
将“旧”设备接入数字世界。该项目基于 ESP32 等便宜的硬件(不到 10 欧)和 TensorFlow Lite 框架,实现对仪表数字的自动识别和数据传输,轻松将传统设备(水表、燃气表、电表)改造成智能设备。

让 LLM 输出结构化数据的 Python 库。该项目是用于处理大语言模型(LLMs)结构化输出的 Python 库。它基于 Pydantic 实现了数据验证和类型注释,能够将 LLM 的结果(自然语言)转换为结构化数据,支持多种大语言模型服务,以及自动重试、流式响应等功能。
import instructor from pydantic import BaseModel from openai import OpenAI # Define your desired output structure class UserInfo(BaseModel): name: str age: int # Patch the OpenAI client client = instructor.from_openai(OpenAI()) # Extract structured data from natural language user_info = client.chat.completions.create( model="gpt-4o-mini", response_model=UserInfo, messages=[{"role": "user", "content": "John Doe is 30 years old."}], ) print(user_info.name) #> John Doe print(user_info.age) #> 30
轻量级的 C++ AI 工具包。这是一个用 C++ 编写的 AI 工具包,内置超过 100 种 AI 模型,包括对象检测、人脸识别、分割、抠图等领域。它支持 ONNXRuntime、MNN、NCNN、TNN 和 TensorRT 等主流推理引擎,帮助开发者快速部署和使用 AI 模型。
#include "lite/lite.h" int main(int argc, char *argv[]) { std::string onnx_path = "yolov5s.onnx"; std::string test_img_path = "test_yolov5.jpg"; std::string save_img_path = "test_results.jpg"; auto *yolov5 = new lite::cv::detection::YoloV5(onnx_path); std::vector<lite::types::Boxf> detected_boxes; cv::Mat img_bgr = cv::imread(test_img_path); yolov5->detect(img_bgr, detected_boxes); lite::utils::draw_boxes_inplace(img_bgr, detected_boxes); cv::imwrite(save_img_path, img_bgr); delete yolov5; return 0; }
从零开始训练小型语言模型。这不仅是一个微型语言模型的实现,更是一份入门 LLM 的教程,旨在降低学习和上手 LLM 的门槛。它提供了从数据预处理到模型训练、微调和推理的全流程代码和教程。最小模型仅 0.02B 参数,可在普通 GPU 上轻松运行。

开源的 LLMs 漏洞扫描工具。该项目是 NVIDIA 开源的用于扫描 LLMs 漏洞的工具,支持检测 LLM 可能存在的安全问题和不良行为,包括幻觉、数据泄漏、提示注入、错误信息、有毒内容生成和越狱等。

为 LLM 应用注入记忆能力的开发框架。该项目是用于构建具有记忆功能的 LLM 应用的 Python 框架,支持创建拥有长期记忆和持久状态的智能体(Agent),并能够集成多种 LLM API 服务。

更高效的 LLMs 推理和服务引擎。这是一个高效易用的大型语言模型推理引擎,专为解决推理速度慢、资源利用率低等问题而设计。它基于 PyTorch 和 CUDA,并结合内存优化算法(PagedAttention)、计算图优化和模型并行技术,大幅降低 GPU 内存占用,并充分利用多 GPU 资源提升推理性能。同时,vLLM 与 HF 模型无缝兼容。支持在 GPU、CPU、TPU 等多种硬件平台上高效运行,适用于实时问答、文本生成和推荐系统等场景。
from vllm import LLM prompts = ["Hello, my name is", "The capital of France is"] # Sample prompts. llm = LLM(model="lmsys/vicuna-7b-v1.3") # Create an LLM. outputs = llm.generate(prompts) # Generate texts from the prompts.

使用视觉模型将 PDF 转换为 Markdown。该项目基于视觉模型 API 服务,提供了将 PDF 文档转化为 Markdown 的功能。其原理是先将原文件(如 pdf、docx)转换为图片,然后把图片发给视觉模型处理,最后汇总所有结果生成完整的 Markdown 文件。
import path from "path"; import { zerox } from "zerox"; const result = await zerox({ filePath: path.resolve(__dirname, "./hellogithub.pdf"), openaiAPIKey: process.env.OPENAI_API_KEY, });

Krita 的 AI 绘画助手插件。这是一个专为 Krita 绘画软件开发的 AIGC 插件,旨在提供更便捷和可控的图像生成体验。用户只需选择区域并输入文本提示,即可轻松实现图像填充、扩展、放大、添加和删除对象等操作,支持本地运行、Stable Diffusion、ControlNet、IP-Adapter 和自定义检查点等功能。
