Skip to content

Commit 5a3595b

Browse files
committed
Add comprehensive Field descriptions to HuggingFace deployer config
Added detailed descriptions to all config fields following ZenML standards: - Minimum 30 characters - Action-oriented language - Concrete examples with realistic values - Clear format specifications and constraints Field descriptions added: - token: Authentication, secret syntax, permissions, example - organization: Purpose, example URL, permission requirements - space_hardware: Options with specs, GPU tiers, documentation link - space_storage: Tiers with sizes, persistence behavior - space_prefix: Purpose, naming example, length constraint All descriptions include practical examples and relevant documentation links to help users configure the deployer correctly.
1 parent f08d8cc commit 5a3595b

File tree

1 file changed

+42
-16
lines changed

1 file changed

+42
-16
lines changed

src/zenml/integrations/huggingface/flavors/huggingface_deployer_flavor.py

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
from typing import TYPE_CHECKING, Optional, Type
1717

18+
from pydantic import Field
19+
1820
from zenml.deployers.base_deployer import (
1921
BaseDeployerConfig,
2022
BaseDeployerFlavor,
@@ -28,22 +30,46 @@
2830

2931

3032
class HuggingFaceDeployerConfig(BaseDeployerConfig):
31-
"""Configuration for the Hugging Face deployer.
32-
33-
Attributes:
34-
token: Hugging Face API token for authentication. Can be a direct token
35-
value or a reference to a ZenML secret using {{secret_name.key}}
36-
organization: HF organization to deploy to (uses username if not set)
37-
space_hardware: Hardware tier (e.g., 'cpu-basic', 't4-small')
38-
space_storage: Persistent storage tier (e.g., 'small', 'medium', 'large')
39-
space_prefix: Prefix for Space names to organize deployments
40-
"""
41-
42-
token: Optional[str] = SecretField(default=None)
43-
organization: Optional[str] = None
44-
space_hardware: Optional[str] = None
45-
space_storage: Optional[str] = None
46-
space_prefix: str = "zenml"
33+
"""Configuration for the Hugging Face deployer."""
34+
35+
token: Optional[str] = SecretField(
36+
default=None,
37+
description="Hugging Face API token for authentication with write permissions. "
38+
"Can reference a ZenML secret using {{secret_name.key}} syntax or provide "
39+
"the token directly. Create tokens at https://huggingface.co/settings/tokens "
40+
"with 'write' access enabled. Example: '{{hf_token.token}}' references the "
41+
"'token' key in the 'hf_token' secret",
42+
)
43+
organization: Optional[str] = Field(
44+
default=None,
45+
description="Hugging Face organization name to deploy Spaces under. If not "
46+
"specified, Spaces are created under the authenticated user's account. "
47+
"Example: 'zenml' deploys to https://huggingface.co/spaces/zenml/. "
48+
"Requires organization membership with appropriate permissions",
49+
)
50+
space_hardware: Optional[str] = Field(
51+
default=None,
52+
description="Hardware tier for Space execution. Controls compute resources "
53+
"available to the deployed pipeline. Options: 'cpu-basic' (2 vCPU, 16GB RAM), "
54+
"'cpu-upgrade' (8 vCPU, 32GB RAM), 't4-small' (4 vCPU, 15GB RAM, NVIDIA T4), "
55+
"'t4-medium' (8 vCPU, 30GB RAM, NVIDIA T4). See "
56+
"https://huggingface.co/docs/hub/spaces-gpus for full list. Defaults to "
57+
"cpu-basic if not specified",
58+
)
59+
space_storage: Optional[str] = Field(
60+
default=None,
61+
description="Persistent storage tier for Space data. Determines available disk "
62+
"space for artifacts and logs. Options: 'small' (20GB), 'medium' (150GB), "
63+
"'large' (1TB). Storage persists across Space restarts. If not specified, "
64+
"uses ephemeral storage that resets on restart",
65+
)
66+
space_prefix: str = Field(
67+
default="zenml",
68+
description="Prefix for Space names to organize deployments and avoid naming "
69+
"conflicts. Combined with deployment name to form the full Space ID. "
70+
"Example: prefix 'zenml' with deployment 'my-pipeline' creates Space "
71+
"'zenml-my-pipeline'. Maximum combined length is 96 characters",
72+
)
4773

4874

4975
class HuggingFaceDeployerFlavor(BaseDeployerFlavor):

0 commit comments

Comments
 (0)