Commit defd4da 1 parent 2550f4f commit defd4da Copy full SHA for defd4da
File tree 2 files changed +51
-4
lines changed
benchmark_tests/llm/sglang_benchmarks
integration_tests/llm/shortfin
2 files changed +51
-4
lines changed Original file line number Diff line number Diff line change @@ -64,17 +64,39 @@ def pre_process_model(request, tmp_path_factory):
64
64
65
65
66
66
@pytest .fixture (scope = "module" )
67
- def write_config (request , pre_process_model ):
67
+ def write_config (request , model_test_dir ):
68
68
batch_sizes = request .param ["batch_sizes" ]
69
69
prefix_sharing_algorithm = request .param ["prefix_sharing_algorithm" ]
70
70
71
- logger .info ("Writing config file..." + start_log_group ("Writing config file" ))
72
-
71
+ # Construct the new config filename
73
72
config_path = (
74
- pre_process_model
73
+ model_test_dir
75
74
/ f"{ '_' .join (str (bs ) for bs in batch_sizes )} _{ prefix_sharing_algorithm } .json"
76
75
)
77
76
77
+ # Read the base config file
78
+ base_config_path = model_test_dir / "config.json"
79
+ with open (base_config_path , "r" ) as f :
80
+ config = json .load (f )
81
+
82
+ # Override specific fields
83
+ config .update (
84
+ {
85
+ "prefill_batch_sizes" : batch_sizes ,
86
+ "decode_batch_sizes" : batch_sizes ,
87
+ "paged_kv_cache" : {
88
+ ** config .get (
89
+ "paged_kv_cache" , {}
90
+ ), # Preserve other paged_kv_cache settings
91
+ "prefix_sharing_algorithm" : prefix_sharing_algorithm ,
92
+ },
93
+ }
94
+ )
95
+
96
+ logger .info (f"Saving edited config to: { config_path } \n " )
97
+ logger .info (f"Config: { json .dumps (config , indent = 2 )} " )
98
+ with open (config_path , "w" ) as f :
99
+ json .dump (config , f )
78
100
yield config_path
79
101
80
102
Original file line number Diff line number Diff line change @@ -87,10 +87,35 @@ def write_config(request, model_test_dir):
87
87
batch_sizes = request .param ["batch_sizes" ]
88
88
prefix_sharing_algorithm = request .param ["prefix_sharing_algorithm" ]
89
89
90
+ # Construct the new config filename
90
91
config_path = (
91
92
model_test_dir
92
93
/ f"{ '_' .join (str (bs ) for bs in batch_sizes )} _{ prefix_sharing_algorithm } .json"
93
94
)
95
+
96
+ # Read the base config file
97
+ base_config_path = model_test_dir / "config.json"
98
+ with open (base_config_path , "r" ) as f :
99
+ config = json .load (f )
100
+
101
+ # Override specific fields
102
+ config .update (
103
+ {
104
+ "prefill_batch_sizes" : batch_sizes ,
105
+ "decode_batch_sizes" : batch_sizes ,
106
+ "paged_kv_cache" : {
107
+ ** config .get (
108
+ "paged_kv_cache" , {}
109
+ ), # Preserve other paged_kv_cache settings
110
+ "prefix_sharing_algorithm" : prefix_sharing_algorithm ,
111
+ },
112
+ }
113
+ )
114
+ logger .info (f"Saving edited config to: { config_path } \n " )
115
+ logger .info (f"Config: { json .dumps (config , indent = 2 )} " )
116
+ with open (config_path , "w" ) as f :
117
+ json .dump (config , f )
118
+
94
119
yield config_path
95
120
96
121
You can’t perform that action at this time.
0 commit comments