(cls, config_file: str)
| 503 | |
| 504 | @classmethod |
| 505 | def from_json_file(cls, config_file: str): |
| 506 | with open(config_file) as f: |
| 507 | config = json.load(f) |
| 508 | obj = cls.from_dict(config) |
| 509 | if obj.quantization.quant_algo == QuantAlgo.MIXED_PRECISION: |
| 510 | try: |
| 511 | layer_config_path = str(config_file).replace( |
| 512 | 'config.json', 'quant_cfg.json') |
| 513 | obj.to_layer_quant_config(layer_config_path) |
| 514 | except Exception as e: |
| 515 | raise RuntimeError( |
| 516 | f"Encounter error '{e}' for read quantization config '{layer_config_path}'" |
| 517 | ) |
| 518 | return obj |
| 519 | |
| 520 | @classmethod |
| 521 | def from_checkpoint(cls, ckpt_dir: str): |
no test coverage detected