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 正在首次構建中,則可能為 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
  • 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.