beta9 README

The project's README from github.com/beam-cloud/beta9. As one markdown file: README.md.

Logo Logo

Run AI Workloads at Scale

Colab ⭐ Star the Repo Documentation Join Slack Twitter AGPL

Beam is a fast, open-source runtime for serverless AI workloads. It gives you a Pythonic interface to deploy and scale AI applications with zero infrastructure overhead.

Watch the demo

✨ Features

📦 Installation

pip install beam-client

⚡️ Quickstart

  1. Create an account here
  2. Follow our Getting Started Guide

Creating a sandbox

Spin up isolated containers to run LLM-generated code:

from beam import Image, Sandbox


sandbox = Sandbox(image=Image()).create()
response = sandbox.process.run_code("print('I am running remotely')")

print(response.result)

Deploy a serverless inference endpoint

Create an autoscaling endpoint for your custom model:

from beam import Image, endpoint
from beam import QueueDepthAutoscaler

@endpoint(
    image=Image(python_version="python3.11"),
    gpu="A10G",
    cpu=2,
    memory="16Gi",
    autoscaler=QueueDepthAutoscaler(max_containers=5, tasks_per_container=30)
)
def handler():
    return {"label": "cat", "confidence": 0.97}

Run background tasks

Schedule resilient background tasks (or replace your Celery queue) by adding a simple decorator:

from beam import Image, TaskPolicy, schema, task_queue


class Input(schema.Schema):
    image_url = schema.String()


@task_queue(
    name="image-processor",
    image=Image(python_version="python3.11"),
    cpu=1,
    memory=1024,
    inputs=Input,
    task_policy=TaskPolicy(max_retries=3),
)
def my_background_task(input: Input, *, context):
    image_url = input.image_url
    print(f"Processing image: {image_url}")
    return {"image_url": image_url}


if __name__ == "__main__":
    # Invoke a background task from your app (without deploying it)
    my_background_task.put(image_url="https://example.com/image.jpg")

    # You can also deploy this behind a versioned endpoint with:
    # beam deploy app.py:my_background_task --name image-processor

Self-Hosting vs Cloud

Beta9 is the open-source engine powering Beam, our fully-managed cloud platform. You can self-host Beta9 for free or choose managed cloud hosting through Beam.

👋 Contributing

We welcome contributions big or small. These are the most helpful things for us:

❤️ Thanks to Our Contributors

beta9 (beam-cloud/beta9)

Searching Database…

1.8K ·GitHub
这是做什么的?一个面向无服务器 AI 工作负载的开源运行时——它把 Python 代码跑在可自动扩缩容的 GPU 容器里,空闲时可以缩容到零。它也是 Beam(一个全托管的云服务)背后的引擎。
这是云服务,还是需要我自己部署运行?两者都可以。Beta9 是开源引擎,你可以免费自行部署;Beam 则是构建在其上的全托管云服务,如果你不想自己维护基础设施,用它就行。
最快让它跑起来的方法是什么?最快的方式是用托管云:注册账号,然后跟着 Getting Started 指南走。想自己运行引擎的话,可以按照代码仓库中 Installation 部分的说明自行部署 Beta9。
用它要写 Python 吗,还是需要懂 Go?你只需要写 Python:加上装饰器的 Python 函数会被部署成容器并自动扩缩容。Go 只是引擎本身用的开发语言,和你无关。
自己部署真的免费吗——有什么限制?自行部署是免费的,但许可证是 AGPL-3.0:如果你修改了 Beta9 并把它作为服务对外提供,就必须开源你的代码。通过 Beam 使用托管服务就不用操心这些。
我的工作负载可以用哪些 GPU?在 Beam 的托管云上可以用 4090、H100 等显卡,也可以接入你自己的 GPU。
我到底能用它做什么?主要有三类工作负载:为自定义模型搭建可自动扩缩容的推理接口,运行大模型生成代码的隔离沙箱,以及定时执行的后台任务——README 把它定位为 Celery 队列的替代品。
容器启动有多快?工作负载最多能扩展到多大规模?得益于自定义的容器运行时、调度器和内置缓存,容器可以在一秒内启动。工作负载可以并行扩展到数百个容器,空闲时自动缩容到零。
日常开发有哪些内置功能?热重载、Webhook 和定时任务都是一等公民功能,还可以挂载分布式存储卷,实现跨容器的持久化或共享状态。
Creator
beam-cloud
Size
35.5 MB
Stars
1.8K
Age
2y
Commits · 90 Days