(model_plus: ModelPlus)
| 279 | |
| 280 | @staticmethod |
| 281 | def load(model_plus: ModelPlus) -> Params: |
| 282 | hf_config_path = model_plus.paths[0].parent / "config.json" |
| 283 | orig_config_path = model_plus.paths[0].parent / "params.json" |
| 284 | |
| 285 | if hf_config_path.exists(): |
| 286 | params = Params.loadHFTransformerJson(model_plus.model, hf_config_path) |
| 287 | elif orig_config_path.exists(): |
| 288 | params = Params.loadOriginalParamsJson(model_plus.model, orig_config_path) |
| 289 | elif model_plus.format != 'none': |
| 290 | params = Params.guessed(model_plus.model) |
| 291 | else: |
| 292 | raise ValueError('Cannot guess params when model format is none') |
| 293 | |
| 294 | params.path_model = model_plus.paths[0].parent |
| 295 | |
| 296 | return params |
| 297 | |
| 298 | |
| 299 | # |
no test coverage detected