Hub Python 库文档

管理您的 Space 运行时

Hugging Face's logo
加入 Hugging Face 社区

并获得增强的文档体验

开始使用

管理您的 Space 运行时

请查看 HfApi 文档页面,了解在 Hub 上管理您的 Space 的方法参考。

数据结构

SpaceRuntime

class huggingface_hub.SpaceRuntime

< >

( data: dict )

参数

  • stage (str) — Space 的当前阶段。例如:RUNNING。
  • hardware (strNone) — Space 的当前硬件。例如:“cpu-basic”。如果 Space 是第一次 BUILDING(构建),则可能为 None
  • requested_hardware (strNone) — 已请求的硬件。可能与 hardware 不同,特别是如果请求刚刚发出。例如:“t4-medium”。如果尚未请求任何硬件,则可能为 None
  • sleep_time (intNone) — Space 在最后一次请求后将保持活动状态的秒数。默认情况下(如果值为 None),如果 Space 在升级后的硬件上运行,则永远不会进入休眠状态;而在免费的 “cpu-basic” 硬件上运行,则会在 48 小时后进入休眠状态。更多详情请参阅 https://huggingface.co/docs/hub/spaces-gpus#sleep-time
  • volumes (list[Volume]None) — 挂载在 Space 中的卷列表。每个卷都是一个 Volume 对象,描述其类型、来源、挂载路径和可选设置。如果没有挂载任何卷,则为 None
  • raw (dict) — 来自服务器的原始响应。包含有关 Space 运行时的更多信息,如副本数量、CPU 数量、内存大小等...

包含有关 Space 当前运行时的信息。

SpaceHardware

class huggingface_hub.SpaceHardware

< >

( value names = None module = None qualname = None type = None start = 1 )

在 Hub 上运行您的 Space 时可用的硬件枚举。

值可以与字符串进行比较

assert SpaceHardware.CPU_BASIC == "cpu-basic"

取自 https://github.com/huggingface-internal/moon-landing/blob/main/server/repo_types/SpaceHardwareFlavor.ts (私有链接)。

SpaceStage

class huggingface_hub.SpaceStage

< >

( value names = None module = None qualname = None type = None start = 1 )

Hub 上 Space 可能阶段的枚举。

值可以与字符串进行比较

assert SpaceStage.BUILDING == "BUILDING"

取自 https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceInfo.ts#L61 (私有链接)。

SpaceStorage

class huggingface_hub.SpaceStorage

< >

( value names = None module = None qualname = None type = None start = 1 )

Hub 上可用于您的 Space 的持久化存储枚举。

值可以与字符串进行比较

assert SpaceStorage.SMALL == "small"

取自 https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceHardwareFlavor.ts#L24 (私有链接)。

SpaceVariable

class huggingface_hub.SpaceVariable

< >

( key: str values: dict )

参数

  • key (str) — 变量键。例如: "MODEL_REPO_ID"
  • value (str) — 变量值。例如: "the_model_repo_id"
  • description (str 或 None) — 变量的描述。例如: "已实现模型的模型仓库 ID"
  • updatedAt (datetime 或 None) — 变量最后一次更新的日期时间(如果变量已至少更新过一次)。

包含有关 Space 当前变量的信息。

在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.