Skip to content

Commit 5f5cfcc

Browse files
committed
Fix top_p and top_k args in sglang for shortfin
1 parent f0ff4bc commit 5f5cfcc

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

python/sglang/lang/ir.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,11 @@ def to_shortfin_kwargs(self):
132132
"temperature": self.temperature,
133133
}
134134

135-
top_p = self.top_p
136-
if top_p == 1.0:
137-
top_p = None
138-
139-
top_k = self.top_k
140-
if top_k == -1:
141-
top_k = None
142-
143-
kwargs["sampling_params"]["top_p"] = top_p
144-
kwargs["sampling_params"]["top_k"] = top_k
135+
top_p, top_k = self.top_p, self.top_k
136+
if top_p != 1.0:
137+
kwargs["sampling_params"]["top_p"] = top_p
138+
if top_k != -1:
139+
kwargs["sampling_params"]["top_k"] = top_k
145140

146141
return kwargs
147142

0 commit comments

Comments
 (0)