@@ -35,22 +35,33 @@ def parse_and_substitute(
3535 triton_model_dir , bls_model_name , engine_dir , token_dir , token_type , dry_run
3636):
3737 json_path = engine_dir + "/config.json"
38- with open (json_path ) as j :
39- config_file = json .load (j )
38+
39+ # Try to read config.json if it exists, otherwise use defaults
40+ config_file = None
41+ try :
42+ with open (json_path ) as j :
43+ config_file = json .load (j )
44+ except FileNotFoundError :
45+ print (f"Warning: { json_path } not found, using default configuration" )
4046
4147 config_dict = {}
4248 # These fields will cause parsing issues when parsing model config if not
4349 # replaced, so replace with sensible defaults.
4450
45- # FIXME: Revert handling using 'build_config' as the key when gpt migrates to using unified builder
46- build_config_key = (
47- "builder_config"
48- if config_file .get ("builder_config" ) is not None
49- else "build_config"
50- )
51- config_dict ["triton_max_batch_size" ] = config_file [build_config_key ][
52- "max_batch_size"
53- ]
51+ # Get max_batch_size from config.json if available, otherwise use default
52+ if config_file :
53+ # FIXME: Revert handling using 'build_config' as the key when gpt migrates to using unified builder
54+ build_config_key = (
55+ "builder_config"
56+ if config_file .get ("builder_config" ) is not None
57+ else "build_config"
58+ )
59+ config_dict ["triton_max_batch_size" ] = config_file [build_config_key ][
60+ "max_batch_size"
61+ ]
62+ else :
63+ # Default max_batch_size when config.json is not available
64+ config_dict ["triton_max_batch_size" ] = 256
5465
5566 config_dict ["logits_datatype" ] = "TYPE_FP32"
5667 config_dict ["triton_backend" ] = "tensorrtllm" # or python
0 commit comments