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

Function read_is_enc_dec

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

Source from the content-addressed store, hash-verified

83
84
85def read_is_enc_dec(engine_dir: str, is_hf: bool = False):
86 if is_hf:
87 with open(Path(engine_dir) / "config.json", 'r') as f:
88 config = json.load(f)
89 is_enc_dec = config.get('is_encoder_decoder', False)
90 else:
91 is_enc_dec = {'encoder', 'decoder'}.issubset({
92 name
93 for name in os.listdir(engine_dir)
94 if os.path.isdir(os.path.join(engine_dir, name))
95 })
96 return is_enc_dec
97
98
99def read_model_name(engine_dir: str, is_hf: bool = False):

Callers 1

mainFunction · 0.90

Calls 2

loadMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected