{"id":13633367,"url":"https://github.com/star-whale/starwhale","last_synced_at":"2025-04-18T10:34:53.512Z","repository":{"id":36963854,"uuid":"443097587","full_name":"star-whale/starwhale","owner":"star-whale","description":"an MLOps/LLMOps platform","archived":false,"fork":false,"pushed_at":"2024-07-25T05:56:58.000Z","size":74003,"stargazers_count":208,"open_issues_count":119,"forks_count":34,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-02T06:23:27.635Z","etag":null,"topics":["ai","cloud-native","dataset","datastore","fine-tuning","infra","kubernetes","llm","llmops","mlops","model-evaluation","runtime"],"latest_commit_sha":null,"homepage":"https://starwhale.ai","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/star-whale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-30T14:26:20.000Z","updated_at":"2024-09-08T20:17:16.000Z","dependencies_parsed_at":"2024-06-19T16:24:33.161Z","dependency_job_id":"d12bb7f4-0680-4001-8822-34c917bb6395","html_url":"https://github.com/star-whale/starwhale","commit_stats":{"total_commits":2302,"total_committers":12,"mean_commits":"191.83333333333334","dds":0.7033014769765422,"last_synced_commit":"411c05d91bf6a4eb4c8be91af5f5263a4cf49172"},"previous_names":[],"tags_count":129,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/star-whale%2Fstarwhale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/star-whale%2Fstarwhale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/star-whale%2Fstarwhale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/star-whale%2Fstarwhale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/star-whale","download_url":"https://codeload.github.com/star-whale/starwhale/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223657211,"owners_count":17181005,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cloud-native","dataset","datastore","fine-tuning","infra","kubernetes","llm","llmops","mlops","model-evaluation","runtime"],"created_at":"2024-08-01T23:00:35.190Z","updated_at":"2024-11-09T02:32:04.607Z","avatar_url":"https://github.com/star-whale.png","language":"Java","funding_links":[],"categories":["Large Scale Deployment","Model Testing \u0026 Validation","人工智能","Tools (GitHub)"],"sub_categories":["ML Platforms","LLMOps vs MLOps"],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/star-whale/docs/raw/main/static/img/starwhale.png\" width=\"600\" style=\"max-width: 600px;\"\u003e\n    \u003ch1 align=\"center\" style=\"margin-top: 10px\"\u003eAn MLOps/LLMOps Platform\u003c/h1\u003e\n\n🚀 ️☁️ [Starwhale Cloud](https://cloud.starwhale.cn) is now open to the public, try it! 🎉🍻\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n\n\u003ca href=\"https://pypi.org/project/starwhale/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/starwhale?style=flat\"\u003e\n\u003c/a\u003e\n\n\u003ca href='https://artifacthub.io/packages/helm/starwhale/starwhale'\u003e\n    \u003cimg src='https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/starwhale' alt='Artifact Hub'/\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://pypi.org/project/starwhale/\"\u003e\n    \u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/starwhale\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/star-whale/starwhale/actions/workflows/client.yml\"\u003e\n    \u003cimg src=\"https://github.com/star-whale/starwhale/actions/workflows/client.yml/badge.svg\"  alt=\"Client/SDK UT\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/star-whale/starwhale/actions/workflows/server-ut-report.yml\"\u003e\n    \u003cimg src=\"https://github.com/star-whale/starwhale/actions/workflows/server-ut-report.yml/badge.svg\" alt=\"Server UT\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/star-whale/starwhale/actions/workflows/console.yml\"\u003e\n    \u003cimg src=\"https://github.com/star-whale/starwhale/actions/workflows/console.yml/badge.svg\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/star-whale/starwhale/actions/workflows/e2e-test.yml\"\u003e\n    \u003cimg src='https://github.com/star-whale/starwhale/actions/workflows/e2e-test.yml/badge.svg' alt='Starwhale E2E Test'\u003e\n\u003c/a\u003e\n\n\u003ca href='https://app.codecov.io/gh/star-whale/starwhale'\u003e\n    \u003cimg alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/star-whale/starwhale?flag=controller\u0026label=Java%20Cov\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://app.codecov.io/gh/star-whale/starwhale\"\u003e\n    \u003cimg alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/star-whale/starwhale?flag=standalone\u0026label=Python%20cov\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003e\n    \u003cp\u003e\n        \u003cb\u003eEnglish\u003c/b\u003e |\n        \u003ca href=\"https://github.com/star-whale/starwhale/blob/main/README_ZH.md\"\u003e中文\u003c/a\u003e\n    \u003cp\u003e\n\u003c/h4\u003e\n\n## What is Starwhale\n\nStarwhale 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.\n\n![products](https://starwhale-examples.oss-cn-beijing.aliyuncs.com/docs/products.png)\n\nStarwhale meets diverse deployment needs with three flexible configurations:\n\n- 🐥 **Standalone** - Deployed in a local development environment, managed by the `swcli` command-line tool, meeting development and debugging needs.\n- 🦅 **Server** - Deployed in a private data center, relying on a Kubernetes cluster, providing centralized, web-based, and secure services.\n- 🦉 **Cloud** - Hosted on a public cloud, with the access address \u003chttps://cloud.starwhale.cn\u003e. The Starwhale team is responsible for maintenance, and no installation is required. You can start using it after registering an account.\n\nAs 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:\n\n- 🔥 **Models Evaluation** - Implement robust, production-scale evaluations with minimal coding through the Python SDK.\n- 🌟 **Live Demo** - Interactively assess model performance through user-friendly web interfaces.\n- 🌊 **LLM Fine-tuning** - End-to-end toolchain from efficient fine-tuning to comparative benchmarking and publishing.\n\nStarwhale is also an open source platform, using the [Apache-2.0 license](https://github.com/star-whale/starwhale/blob/main/LICENSE). The Starwhale framework is designed for clarity and ease of use, empowering developers to build customized MLOps features tailored to their needs.\n\n![framework](https://starwhale-examples.oss-cn-beijing.aliyuncs.com/docs/framework.png)\n\n## Key Concepts\n\n### 🐘 Starwhale Dataset\n\nStarwhale 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\n\n![dataset overview](https://starwhale-examples.oss-cn-beijing.aliyuncs.com/docs/dataset-overview.svg)\n\n```python\nimport torch\nfrom starwhale import dataset, Image\n\n# build dataset for starwhale cloud instance\nwith dataset(\"https://cloud.starwhale.cn/project/starwhale:public/dataset/test-image\", create=\"empty\") as ds:\n    for i in range(100):\n        ds.append({\"image\": Image(f\"{i}.png\"), \"label\": i})\n    ds.commit()\n\n# load dataset\nds = dataset(\"https://cloud.starwhale.cn/project/starwhale:public/dataset/test-image\")\nprint(len(ds))\nprint(ds[0].features.image.to_pil())\nprint(ds[0].features.label)\n\ntorch_ds = ds.to_pytorch()\ntorch_loader = torch.utils.data.DataLoader(torch_ds, batch_size=5)\nprint(next(iter(torch_loader)))\n```\n\n### 🐇 Starwhale Model\n\nStarwhale 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.\n\n![overview](https://starwhale-examples.oss-cn-beijing.aliyuncs.com/docs/model-overview.svg)\n\n```bash\n# model build\nswcli model build . --module mnist.evaluate --runtime pytorch/version/v1 --name mnist\n\n# model copy from standalone to cloud\nswcli model cp mnist https://cloud.starwhale.cn/project/starwhale:public\n\n# model run\nswcli model run --uri mnist --runtime pytorch --dataset mnist\nswcli model run --workdir . --module mnist.evaluator --handler mnist.evaluator:MNISTInference.cmp\n```\n\n### 🐌 Starwhale Runtime\n\nStarwhale 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.\n\n![overview](https://starwhale-examples.oss-cn-beijing.aliyuncs.com/docs/runtime-overview.svg)\n\n```bash\n# build from runtime.yaml, conda env, docker image or shell\nswcli runtime build --yaml runtime.yaml\nswcli runtime build --conda pytorch --name pytorch-runtime --cuda 11.4\nswcli runtime build --docker pytorch/pytorch:1.9.0-cuda11.1-cudnn8-runtime\nswcli runtime build --shell --name pytorch-runtime\n\n# runtime activate\nswcli runtime activate pytorch\n\n# integrated with model and dataset\nswcli model run --uri test --runtime pytorch\nswcli model build . --runtime pytorch\nswcli dataset build --runtime pytorch\n```\n\n### 🐄 Starwhale Evaluation\n\nStarwhale Evaluation enables users to evaluate sophisticated, production-ready distributed models by writing just a few lines of code with Starwhale Python SDK.\n\n```python\nimport typing as t\nimport gradio\nfrom starwhale import evaluation\nfrom starwhale.api.service import api\n\ndef model_generate(image):\n    ...\n    return predict_value, probability_matrix\n\n@evaluation.predict(\n    resources={\"nvidia.com/gpu\": 1},\n    replicas=4,\n)\ndef predict_image(data: dict, external: dict) -\u003e None:\n    return model_generate(data[\"image\"])\n\n@evaluation.evaluate(use_predict_auto_log=True, needs=[predict_image])\ndef evaluate_results(predict_result_iter: t.Iterator):\n    for _data in predict_result_iter:\n        ...\n    evaluation.log_summary({\"accuracy\": 0.95, \"benchmark\": \"test\"})\n\n@api(gradio.File(), gradio.Label())\ndef predict_view(file: t.Any) -\u003e t.Any:\n    with open(file.name, \"rb\") as f:\n        data = Image(f.read(), shape=(28, 28, 1))\n    _, prob = predict_image({\"image\": data})\n    return {i: p for i, p in enumerate(prob)}\n```\n\n### 🦍 Starwhale Fine-tuning\n\nStarwhale 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.\n\n```python\nimport typing as t\nfrom starwhale import finetune, Dataset\nfrom transformers import Trainer\n\n@finetune(\n    resources={\"nvidia.com/gpu\":4, \"memory\": \"32G\"},\n    require_train_datasets=True,\n    require_validation_datasets=True,\n    model_modules=[\"evaluation\", \"finetune\"],\n)\ndef lora_finetune(train_datasets: t.List[Dataset], val_datasets: t.List[Dataset]) -\u003e None:\n    # init model and tokenizer\n    trainer = Trainer(\n        model=model, tokenizer=tokenizer,\n        train_dataset=train_datasets[0].to_pytorch(), # convert Starwhale Dataset into Pytorch Dataset\n        eval_dataset=val_datasets[0].to_pytorch())\n    trainer.train()\n    trainer.save_state()\n    trainer.save_model()\n    # save weights, then Starwhale SDK will package them into Starwhale Model\n```\n\n## Installation\n\n### 🍉 Starwhale Standalone\n\nRequirements: Python 3.7~3.11 in the Linux or macOS os.\n\n```bash\npython3 -m pip install starwhale\n```\n\n### 🥭 Starwhale Server\n\nStarwhale 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.\n\n```bash\nswcli server start\n```\n\n## Quick Tour\n\nWe use [MNIST](https://paperswithcode.com/dataset/mnist) as the hello world example to show the basic Starwhale Model workflow.\n\n### 🪅 MNIST Evaluation in Starwhale Standalone\n\n- Use your own Python environment, follow the [Standalone quickstart doc](https://starwhale.cn/docs/en/next/getting-started/standalone/).\n- Use Google Colab environment, follow the [Jupyter notebook example](https://colab.research.google.com/github/star-whale/starwhale/blob/main/example/notebooks/quickstart-standalone.ipynb).\n\n### 🪆 MNIST Evaluation in Starwhale Server\n\n- Run it in the your private Starwhale Server instance, please read [Server installation(minikube)](https://starwhale.cn/docs/en/next/server/installation/minikube) and [Server quickstart](https://starwhale.cn/docs/en/next/getting-started/server) docs.\n- Run it in the [Starwhale Cloud](https://cloud.starwhale.cn), please read [Cloud quickstart doc](https://starwhale.cn/docs/en/next/getting-started/cloud).\n\n## Examples\n\n- 🔥 Helloworld: [Cloud](https://cloud.starwhale.cn/projects/15/evaluations), [Code](https://github.com/star-whale/starwhale/tree/main/example/helloworld).\n- 🚀 LLM:\n  - 🐊 OpenSource LLMs Leaderboard: [Evaluation](https://cloud.starwhale.cn/projects/349/evaluations), [Code](https://github.com/star-whale/starwhale/tree/main/example/llm-leaderboard)\n  - 🐢 Llama2: [Run llama2 chat in five minutes](https://starwhale.cn/docs/en/blog/run-llama2-chat-in-five-minutes/), [Code](https://github.com/star-whale/starwhale/tree/main/example/LLM/llama2)\n  - 🦎 Stable Diffusion: [Cloud Demo](https://cloud.starwhale.cn/projects/374/models), [Code](https://github.com/star-whale/stable-diffusion-webui)\n  - 🦙 LLAMA [evaluation and fine-tune](https://github.com/star-whale/starwhale/tree/main/example/LLM/llama)\n  - 🎹 Text-to-Music: [Cloud Demo](https://cloud.starwhale.cn/projects/400/overview), [Code](https://github.com/star-whale/starwhale/tree/main/example/LLM/musicgen)\n  - 🍏 Code Generation: [Cloud Demo](https://cloud.starwhale.cn/projects/404/overview), [Code](https://github.com/star-whale/starwhale/tree/main/example/code-generation/code-llama)\n\n- 🌋 Fine-tuning:\n  - 🐏 Baichuan2: [Cloud Demo](https://cloud.starwhale.cn/projects/401/overview), [Code](https://github.com/star-whale/starwhale/tree/main/example/llm-finetune/models/baichuan2)\n  - 🐫 ChatGLM3: [Cloud Demo](https://cloud.starwhale.cn/projects/401/overview), [Code](https://github.com/star-whale/starwhale/tree/main/example/llm-finetune/models/chatglm3)\n  - 🦏 Stable Diffusion: [Cloud Demo](https://cloud.starwhale.cn/projects/374/spaces/3/fine-tune-runs), [Code](https://github.com/star-whale/starwhale/tree/main/example/stable-diffusion/txt2img-ft)\n\n- 🦦 Image Classification:\n  - 🐻‍❄️ MNIST: [Cloud Demo](https://cloud.starwhale.cn/projects/392/evaluations), [Code](https://github.com/star-whale/starwhale/tree/main/example/mnist).\n  - 🦫 [CIFAR10](https://github.com/star-whale/starwhale/tree/main/example/cifar10)\n  - 🦓 Vision Transformer(ViT): [Cloud Demo](https://cloud.starwhale.cn/projects/399/overview), [Code](https://github.com/star-whale/starwhale/tree/main/example/image-classification)\n- 🐃 Image Segmentation:\n  - Segment Anything(SAM): [Cloud Demo](https://cloud.starwhale.cn/projects/398/overview), [Code](https://github.com/star-whale/starwhale/tree/main/example/image-segmentation)\n- 🐦 Object Detection:\n  - 🦊 YOLO: [Cloud Demo](https://cloud.starwhale.cn/projects/397/overview), [Code](https://github.com/star-whale/starwhale/tree/main/example/object-detection)\n  - 🐯 [Pedestrian Detection](https://github.com/star-whale/starwhale/tree/main/example/PennFudanPed)\n- 📽️ Video Recognition: [UCF101](https://github.com/star-whale/starwhale/tree/main/example/ucf101)\n- 🦋 Machine Translation: [Neural machine translation](https://github.com/star-whale/starwhale/tree/main/example/nmt)\n- 🐜 Text Classification: [AG News](https://github.com/star-whale/starwhale/tree/main/example/text_cls_AG_NEWS)\n- 🎙️ Speech Recognition: [Speech Command](https://github.com/star-whale/starwhale/tree/main/example/speech_command)\n\n## Documentation, Community, and Support\n\n- Visit [Starwhale HomePage](https://starwhale.ai).\n- More information in the [official documentation](https://doc.starwhale.ai).\n- For general questions and support, join the [Slack](https://starwhale.slack.com/).\n- For bug reports and feature requests, please use [Github Issue](https://github.com/star-whale/starwhale/issues).\n- To get community updates, follow [@starwhaleai](https://twitter.com/starwhaleai) on Twitter.\n- For Starwhale artifacts, please visit:\n\n  - Python Package on [Pypi](https://pypi.org/project/starwhale/).\n  - Helm Charts on [Artifacthub](https://artifacthub.io/packages/helm/starwhale/starwhale).\n  - Docker Images on [Docker Hub](https://hub.docker.com/u/starwhaleai), [Github Packages](https://github.com/orgs/star-whale/packages) and [Starwhale Registry](https://docker-registry.starwhale.cn/).\n\n- Additionally, you can always find us at *developer@starwhale.ai*.\n\n## Contributing\n\n🌼👏**PRs are always welcomed** 👍🍺. See [Contribution to Starwhale](https://doc.starwhale.ai/community/contribute) for more details.\n\n## License\n\nStarwhale is licensed under the [Apache License 2.0](https://github.com/star-whale/starwhale/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstar-whale%2Fstarwhale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstar-whale%2Fstarwhale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstar-whale%2Fstarwhale/lists"}