Skip to content

[Feature]: refine hardmard code #2036

Description

@wenhuach21

Feature Description

I dont' know why code this init func like this

class RotationConfig(BaseModel, BaseRotationConfig):
"""Unified configuration for Hadamard rotation/transform applied to a model.

See the module docstring for a description of the three backends.

Notes:
    * ``block_size`` is the group/block size for grouped Hadamard.
      For ``backend="inplace"`` it is forwarded as ``group_size``
      (``None`` / ``-1`` means full-dimension Hadamard).
"""

# Registry key consumed by BaseRotation.from_config (kept for API parity
# with other BaseRotationConfig subclasses).
algorithm: str = Field(default="hadamard", frozen=True)

# ---- shared ----
backend: str = Field(default="auto")
block_size: Optional[int] = Field(default=None)
hadamard_type: str = Field(default="hadamard")

# ---- inplace-only ----
fuse_online_to_weight: Optional[bool] = Field(default=None)
allow_online_rotation: bool = Field(default=True)

# for random hadamard (transform path)
random_seed: bool = Field(default=False, exclude=True)

model_config = {"arbitrary_types_allowed": True}

def __init__(self, **data: Any) -> None:

Motivation and Use Case

~

Alternatives Considered

~

Definition of Done

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions