1212
1313
1414def test_shard_spec_objects_match_string_parsing ():
15- objs = [InferenceShardSpec (tp = 2 , role = "prefill" ),
16- InferenceShardSpec (tp = 1 , dp = 2 , role = "decode" )]
15+ objs = [InferenceShardSpec (tp = 2 , role = "prefill" ), InferenceShardSpec (tp = 1 , dp = 2 , role = "decode" )]
1716 assert normalize_shard_specs (objs , 4 ) == parse_inference_shards_spec (
1817 "tp=2,role=prefill+tp=1,dp=2,role=decode" , 4
1918 )
@@ -34,7 +33,14 @@ def test_parse_defaults_and_dp_and_role():
3433 assert specs [0 ] == InferenceShardSpec (tp = 2 , role = "prefill" )
3534 assert specs [1 ] == InferenceShardSpec (tp = 1 , dp = 2 , role = "decode" )
3635 # dict form (serialization / external consumers) carries the resolved keys.
37- assert specs [0 ].to_dict () == {"tp" : 2 , "pp" : 1 , "ep" : 1 , "dp" : 1 , "expt_tp" : 2 , "role" : "prefill" }
36+ assert specs [0 ].to_dict () == {
37+ "tp" : 2 ,
38+ "pp" : 1 ,
39+ "ep" : 1 ,
40+ "dp" : 1 ,
41+ "expt_tp" : 2 ,
42+ "role" : "prefill" ,
43+ }
3844
3945
4046def test_parse_partitions_world_with_dp ():
@@ -60,7 +66,9 @@ def test_plus_and_semicolon_separators_equivalent():
6066def test_cp_accepted_only_when_one ():
6167 # cp is a recognized key (clear error, not "unknown key") but must be 1:
6268 # inference shards don't context-parallelize.
63- assert parse_inference_shards_spec ("tp=2,cp=1" , world_size = 2 ) == [InferenceShardSpec (tp = 2 , cp = 1 )]
69+ assert parse_inference_shards_spec ("tp=2,cp=1" , world_size = 2 ) == [
70+ InferenceShardSpec (tp = 2 , cp = 1 )
71+ ]
6472 with pytest .raises (ValueError ):
6573 InferenceShardSpec (tp = 1 , cp = 2 )
6674 with pytest .raises (ValueError ):
0 commit comments