Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deepspeed/runtime/zenflow/zenflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
class ZenFlowConfig(DeepSpeedConfigModel):
"""Configuration options for ZenFlow optimization module."""

topk_ratio: float = Field(0.1, ge=0.0, le=1.0)
"""Ratio of top-k important gradient columns to retain (range: 0.0 to 1.0)."""
topk_ratio: float = Field(0.1, gt=0.0, lt=1.0)
"""Ratio of top-k important gradient columns to retain (must be greater than 0.0 and less than 1.0)."""

select_strategy: str = "auto"
"""Strategy for selecting important gradient indices.
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/runtime/zenflow/test_zf_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def test_invalid_zenflow_type_raises():
DeepSpeedZeroConfig(zenflow=123)


@pytest.mark.parametrize("topk_ratio", [0.0, 1.0])
def test_topk_ratio_excludes_endpoints(topk_ratio):
with pytest.raises(ValidationError):
ZenFlowConfig(topk_ratio=topk_ratio)


def test_offload_and_zenflow_combined():
"""
offload_optimizer and zenflow can be used together under stage 2
Expand Down
Loading