跳到正文
Machine Learning Mastery· Iván Palomares Carrascosa·· 7 天前AI 评分65

用 FastAPI 将 Scikit-LLM 零样本文本分类流水线部署为 REST API

Serving Scikit-LLM Pipelines as REST APIs with FastAPI

AI 导读

教程演示如何用 FastAPI 将基于本地 Ollama 模型 llama3 的 Scikit-LLM 零样本文本分类流水线部署为 REST API。文章通过 train.py 训练并用 joblib 序列化分类器,再由 app.py 以异步 /predict 端点提供推理,可绕开付费云 API 与商业锁定;并说明该方法不更新模型权重,仅让 LLM 在给定标签集内做确定性分类。

来源:Machine Learning Mastery · machinelearningmastery.com