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 都是一個 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) — 變數描述。範例:"Model Repo ID of the implemented model"
  • updatedAt (datetime 或 None) — 變數上次更新的日期時間(如果變數至少更新過一次)。

包含關於 Space 當前變數的資訊。

在 GitHub 上更新

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