(model_plus: ModelPlus)
| 313 | |
| 314 | @staticmethod |
| 315 | def load(model_plus: ModelPlus) -> Params: |
| 316 | hf_config_path = model_plus.paths[0].parent / "config.json" |
| 317 | orig_config_path = model_plus.paths[0].parent / "params.json" |
| 318 | |
| 319 | if hf_config_path.exists(): |
| 320 | params = Params.loadHFTransformerJson(model_plus.model, hf_config_path) |
| 321 | elif orig_config_path.exists(): |
| 322 | params = Params.loadOriginalParamsJson(model_plus.model, orig_config_path) |
| 323 | elif model_plus.format != 'none': |
| 324 | params = Params.guessed(model_plus.model) |
| 325 | else: |
| 326 | raise ValueError('Cannot guess params when model format is none') |
| 327 | |
| 328 | params.path_model = model_plus.paths[0].parent |
| 329 | |
| 330 | return params |
| 331 | |
| 332 | |
| 333 | # |
no test coverage detected