starwhale

starwhale

一体化机器学习运维平台 加速AI模型开发流程

Starwhale是一个开源的MLOps/LLMOps平台,致力于优化机器学习运维流程。平台提供模型、运行时和数据集的统一管理,支持模型评估、在线演示和大语言模型微调等功能。Starwhale支持独立版、服务器版和云端版部署,适应不同应用场景。其开放架构允许开发者自定义MLOps功能,为AI团队打造高效、标准化的开发环境。

StarwhaleMLOpsLLMOps机器学习运营模型开发Github开源项目
<div align="center"> <img src="https://github.com/star-whale/docs/raw/main/static/img/starwhale.png" width="600" style="max-width: 600px;"> <h1 align="center" style="margin-top: 10px">An MLOps/LLMOps Platform</h1>

🚀 ️☁️ Starwhale Cloud is now open to the public, try it! 🎉🍻

</div> <p align="center"> <a href="https://pypi.org/project/starwhale/"> <img src="https://img.shields.io/pypi/v/starwhale?style=flat"> </a> <a href='https://artifacthub.io/packages/helm/starwhale/starwhale'> <img src='https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/starwhale' alt='Artifact Hub'/> </a> <a href="https://pypi.org/project/starwhale/"> <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/starwhale"> </a> <a href="https://github.com/star-whale/starwhale/actions/workflows/client.yml"> <img src="https://github.com/star-whale/starwhale/actions/workflows/client.yml/badge.svg" alt="Client/SDK UT"> </a> <a href="https://github.com/star-whale/starwhale/actions/workflows/server-ut-report.yml"> <img src="https://github.com/star-whale/starwhale/actions/workflows/server-ut-report.yml/badge.svg" alt="Server UT"> </a> <a href="https://github.com/star-whale/starwhale/actions/workflows/console.yml"> <img src="https://github.com/star-whale/starwhale/actions/workflows/console.yml/badge.svg"> </a> <a href="https://github.com/star-whale/starwhale/actions/workflows/e2e-test.yml"> <img src='https://github.com/star-whale/starwhale/actions/workflows/e2e-test.yml/badge.svg' alt='Starwhale E2E Test'> </a> <a href='https://app.codecov.io/gh/star-whale/starwhale'> <img alt="Codecov" src="https://img.shields.io/codecov/c/github/star-whale/starwhale?flag=controller&label=Java%20Cov"> </a> <a href="https://app.codecov.io/gh/star-whale/starwhale"> <img alt="Codecov" src="https://img.shields.io/codecov/c/github/star-whale/starwhale?flag=standalone&label=Python%20cov"> </a> </p> <h4 align="center"> <p> <b>English</b> | <a href="https://github.com/star-whale/starwhale/blob/main/README_ZH.md">中文</a> <p> </h4>

What is Starwhale

Starwhale is an MLOps/LLMOps platform that brings efficiency and standardization to machine learning operations. It streamlines the model development liftcycle, enabling teams to optimize their workflows around key areas like model building, evaluation, release and fine-tuning.

products

Starwhale meets diverse deployment needs with three flexible configurations:

  • 🐥 Standalone - Deployed in a local development environment, managed by the swcli command-line tool, meeting development and debugging needs.
  • 🦅 Server - Deployed in a private data center, relying on a Kubernetes cluster, providing centralized, web-based, and secure services.
  • 🦉 Cloud - Hosted on a public cloud, with the access address https://cloud.starwhale.cn. The Starwhale team is responsible for maintenance, and no installation is required. You can start using it after registering an account.

As its core, Starwhale abstracts Model, Runtime and Dataset as first-class citizens - providing the fundamentals for streamlined operations. Starwhale further delivers tailored capabilities for common workflow scenarios including:

  • 🔥 Models Evaluation - Implement robust, production-scale evaluations with minimal coding through the Python SDK.
  • 🌟 Live Demo - Interactively assess model performance through user-friendly web interfaces.
  • 🌊 LLM Fine-tuning - End-to-end toolchain from efficient fine-tuning to comparative benchmarking and publishing.

Starwhale is also an open source platform, using the Apache-2.0 license. The Starwhale framework is designed for clarity and ease of use, empowering developers to build customized MLOps features tailored to their needs.

framework

Key Concepts

🐘 Starwhale Dataset

Starwhale Dataset offers efficient data storage, loading, and visualization capabilities, making it a dedicated data management tool tailored for the field of machine learning and deep learning

dataset overview

import torch from starwhale import dataset, Image # build dataset for starwhale cloud instance with dataset("https://cloud.starwhale.cn/project/starwhale:public/dataset/test-image", create="empty") as ds: for i in range(100): ds.append({"image": Image(f"{i}.png"), "label": i}) ds.commit() # load dataset ds = dataset("https://cloud.starwhale.cn/project/starwhale:public/dataset/test-image") print(len(ds)) print(ds[0].features.image.to_pil()) print(ds[0].features.label) torch_ds = ds.to_pytorch() torch_loader = torch.utils.data.DataLoader(torch_ds, batch_size=5) print(next(iter(torch_loader)))

🐇 Starwhale Model

Starwhale Model is a standard format for packaging machine learning models that can be used for various purposes, like model fine-tuning, model evaluation, and online serving. A Starwhale Model contains the model file, inference codes, configuration files, and any other files required to run the model.

overview

# model build swcli model build . --module mnist.evaluate --runtime pytorch/version/v1 --name mnist # model copy from standalone to cloud swcli model cp mnist https://cloud.starwhale.cn/project/starwhale:public # model run swcli model run --uri mnist --runtime pytorch --dataset mnist swcli model run --workdir . --module mnist.evaluator --handler mnist.evaluator:MNISTInference.cmp

🐌 Starwhale Runtime

Starwhale Runtime aims to provide a reproducible and sharable running environment for python programs. You can easily share your working environment with your teammates or outsiders, and vice versa. Furthermore, you can run your programs on Starwhale Server or Starwhale Cloud without bothering with the dependencies.

overview

# build from runtime.yaml, conda env, docker image or shell swcli runtime build --yaml runtime.yaml swcli runtime build --conda pytorch --name pytorch-runtime --cuda 11.4 swcli runtime build --docker pytorch/pytorch:1.9.0-cuda11.1-cudnn8-runtime swcli runtime build --shell --name pytorch-runtime # runtime activate swcli runtime activate pytorch # integrated with model and dataset swcli model run --uri test --runtime pytorch swcli model build . --runtime pytorch swcli dataset build --runtime pytorch

🐄 Starwhale Evaluation

Starwhale Evaluation enables users to evaluate sophisticated, production-ready distributed models by writing just a few lines of code with Starwhale Python SDK.

import typing as t import gradio from starwhale import evaluation from starwhale.api.service import api def model_generate(image): ... return predict_value, probability_matrix @evaluation.predict( resources={"nvidia.com/gpu": 1}, replicas=4, ) def predict_image(data: dict, external: dict) -> None: return model_generate(data["image"]) @evaluation.evaluate(use_predict_auto_log=True, needs=[predict_image]) def evaluate_results(predict_result_iter: t.Iterator): for _data in predict_result_iter: ... evaluation.log_summary({"accuracy": 0.95, "benchmark": "test"}) @api(gradio.File(), gradio.Label()) def predict_view(file: t.Any) -> t.Any: with open(file.name, "rb") as f: data = Image(f.read(), shape=(28, 28, 1)) _, prob = predict_image({"image": data}) return {i: p for i, p in enumerate(prob)}

🦍 Starwhale Fine-tuning

Starwhale Fine-tuning provides a full workflow for Large Language Model(LLM) tuning, including batch model evaluation, live demo and model release capabilities. Starwhale Fine-tuning Python SDK is very simple.

import typing as t from starwhale import finetune, Dataset from transformers import Trainer @finetune( resources={"nvidia.com/gpu":4, "memory": "32G"}, require_train_datasets=True, require_validation_datasets=True, model_modules=["evaluation", "finetune"], ) def lora_finetune(train_datasets: t.List[Dataset], val_datasets: t.List[Dataset]) -> None: # init model and tokenizer trainer = Trainer( model=model, tokenizer=tokenizer, train_dataset=train_datasets[0].to_pytorch(), # convert Starwhale Dataset into Pytorch Dataset eval_dataset=val_datasets[0].to_pytorch()) trainer.train() trainer.save_state() trainer.save_model() # save weights, then Starwhale SDK will package them into Starwhale Model

Installation

🍉 Starwhale Standalone

Requirements: Python 3.7~3.11 in the Linux or macOS os.

python3 -m pip install starwhale

🥭 Starwhale Server

Starwhale Server is delivered as a Docker image, which can be run with Docker directly or deployed to a Kubernetes cluster. For the laptop environment, using swcli server start command is a appropriate choice that depends on Docker and Docker-Compose.

swcli server start

Quick Tour

We use MNIST as the hello world example to show the basic Starwhale Model workflow.

🪅 MNIST Evaluation in Starwhale Standalone

🪆 MNIST Evaluation in Starwhale Server

Examples

Documentation, Community, and Support

Contributing

🌼👏PRs are always welcomed 👍🍺. See Contribution to Starwhale for more details.

License

Starwhale is licensed under the [Apache License

编辑推荐精选

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

热门AI工具AI办公办公工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

模型训练热门AI工具内容创作智能问答AI开发讯飞星火大模型多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

AI助手热门AI工具AI创作AI辅助写作讯飞绘文内容运营个性化文章多平台分发
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

Hunyuan3D-2

Hunyuan3D-2

高分辨率纹理 3D 资产生成

Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。

3FS

3FS

一个具备存储、管理和客户端操作等多种功能的分布式文件系统相关项目。

3FS 是一个功能强大的分布式文件系统项目,涵盖了存储引擎、元数据管理、客户端工具等多个模块。它支持多种文件操作,如创建文件和目录、设置布局等,同时具备高效的事件循环、节点选择和协程池管理等特性。适用于需要大规模数据存储和管理的场景,能够提高系统的性能和可靠性,是分布式存储领域的优质解决方案。

下拉加载更多