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

Function read_model_name

examples/utils.py:99–118  ·  view source on GitHub ↗
(engine_dir: str, is_hf: bool = False)

Source from the content-addressed store, hash-verified

97
98
99def read_model_name(engine_dir: str, is_hf: bool = False):
100 with open(Path(engine_dir) / "config.json", 'r') as f:
101 config = json.load(f)
102
103 if is_hf:
104 model_arch = config['architectures'][0]
105 model_version = config.get('model_type', None)
106 return model_arch, model_version
107
108 engine_version = get_engine_version(engine_dir)
109 if engine_version is None:
110 return config['builder_config']['name'], None
111
112 model_arch = config['pretrained_config']['architecture']
113 model_version = None
114 if 'GLM' in model_arch:
115 model_version = config['pretrained_config']['chatglm_version']
116 if 'qwen' in model_arch.lower():
117 model_version = config['pretrained_config']['qwen_type']
118 return model_arch, model_version
119
120
121def throttle_generator(generator, stream_interval):

Callers 4

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 3

get_engine_versionFunction · 0.90
loadMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected