MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / from_json_file

Method from_json_file

tensorrt_llm/models/modeling_utils.py:505–518  ·  view source on GitHub ↗
(cls, config_file: str)

Source from the content-addressed store, hash-verified

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):

Callers 12

_build_modelMethod · 0.45
_load_model_from_ckptMethod · 0.45
get_model_formatFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
prune_and_saveFunction · 0.45
setup_engineMethod · 0.45
from_dirMethod · 0.45
from_checkpointMethod · 0.45
from_checkpointMethod · 0.45

Calls 4

replaceMethod · 0.80
to_layer_quant_configMethod · 0.80
loadMethod · 0.45
from_dictMethod · 0.45

Tested by

no test coverage detected