(model_plus: ModelPlus)
| 300 | |
| 301 | @staticmethod |
| 302 | def load(model_plus: ModelPlus) -> Params: |
| 303 | hf_config_path = model_plus.paths[0].parent / "config.json" |
| 304 | orig_config_path = model_plus.paths[0].parent / "params.json" |
| 305 | |
| 306 | if hf_config_path.exists(): |
| 307 | params = Params.loadHFTransformerJson(model_plus.model, hf_config_path) |
| 308 | elif orig_config_path.exists(): |
| 309 | params = Params.loadOriginalParamsJson(model_plus.model, orig_config_path) |
| 310 | elif model_plus.format != 'none': |
| 311 | params = Params.guessed(model_plus.model) |
| 312 | else: |
| 313 | raise ValueError('Cannot guess params when model format is none') |
| 314 | |
| 315 | params.path_model = model_plus.paths[0].parent |
| 316 | |
| 317 | return params |
| 318 | |
| 319 | |
| 320 | # |
no test coverage detected