MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / to_dict

Method to_dict

examples/simple_trainer_old.py:125–144  ·  view source on GitHub ↗

Convert the CompressionConfig instance to a dictionary. If attribute_codec_registry is not None, it will be converted to a dictionary using its to_dict method. Fields with None values (use_sort, verbose) will be excluded from the resulting dictionary.

(self)

Source from the content-addressed store, hash-verified

123 attribute_codec_registry: Optional[AttributeCodecs] = field(default_factory=lambda: AttributeCodecs())
124
125 def to_dict(self) -> Dict[str, Any]:
126 """
127 Convert the CompressionConfig instance to a dictionary.
128 If attribute_codec_registry is not None, it will be converted to a dictionary using its to_dict method.
129 Fields with None values (use_sort, verbose) will be excluded from the resulting dictionary.
130 """
131 result = {
132 "use_sort": self.use_sort,
133 "verbose": self.verbose,
134 "n_clusters": self.n_clusters,
135 }
136
137 if self.qp is not None:
138 result["qp"] = self.qp
139
140 # handle attribute_codec_registry
141 if self.attribute_codec_registry is not None:
142 result["attribute_codec_registry"] = self.attribute_codec_registry.to_dict()
143
144 return result
145
146@dataclass
147class Config:

Callers

nothing calls this directly

Calls 1

to_dictMethod · 0.45

Tested by

no test coverage detected