(model_plus: ModelPlus)
| 370 | |
| 371 | @staticmethod |
| 372 | def load(model_plus: ModelPlus) -> Params: |
| 373 | hf_config_path = model_plus.paths[0].parent / "config.json" |
| 374 | orig_config_path = model_plus.paths[0].parent / "params.json" |
| 375 | |
| 376 | if hf_config_path.exists(): |
| 377 | params = Params.loadHFTransformerJson(model_plus.model, hf_config_path) |
| 378 | elif orig_config_path.exists(): |
| 379 | params = Params.loadOriginalParamsJson(model_plus.model, orig_config_path) |
| 380 | elif model_plus.format != 'none': |
| 381 | params = Params.guessed(model_plus.model) |
| 382 | else: |
| 383 | raise ValueError('Cannot guess params when model format is none') |
| 384 | |
| 385 | params.path_model = model_plus.paths[0].parent |
| 386 | |
| 387 | return params |
| 388 | |
| 389 | |
| 390 | # |
no test coverage detected