| 140 | |
| 141 | @dataclass |
| 142 | class PredictorParams: |
| 143 | sparse_threshold: float | None = None |
| 144 | |
| 145 | @staticmethod |
| 146 | def loadPredictorJson(model: LazyModel, config_path: Path) -> PredictorParams: |
| 147 | config = json.load(open(config_path)) |
| 148 | return PredictorParams( |
| 149 | sparse_threshold = config.get("sparse_threshold"), |
| 150 | ) |
| 151 | |
| 152 | @staticmethod |
| 153 | def load(model_plus: ModelPlus) -> PredictorParams: |
| 154 | config_path = model_plus.paths[0].parent / "config.json" |
| 155 | |
| 156 | if config_path.exists(): |
| 157 | params = PredictorParams.loadPredictorJson(model_plus.model, config_path) |
| 158 | else: |
| 159 | params = PredictorParams() |
| 160 | |
| 161 | return params |
| 162 | |
| 163 | @dataclass |
| 164 | class Params: |
no outgoing calls
no test coverage detected