Skip to content

Commit adef8b6

Browse files
averyhNVclaude
andcommitted
fmt: ruff fixes for example_sglang.py
- Add strict=True to the zip() in the output-printing loop (B905). - Drop the unused 'import sglang as sgl' import (F401); the Engine import is sufficient. Missed in the previous commit because pre-commit was run before ``git add`` had staged the new file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7d9e3fe commit adef8b6

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tests/trace/example_sglang.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@
2626
if SAVE_DIR.exists():
2727
shutil.rmtree(SAVE_DIR)
2828

29-
import sglang as sgl # noqa: E402
3029
from sglang.srt.entrypoints.engine import Engine # noqa: E402
3130

3231

3332
def main() -> None:
34-
model = os.environ.get(
35-
"FI_TRACE_SGLANG_MODEL", "meta-llama/Llama-3.2-3B-Instruct"
36-
)
33+
model = os.environ.get("FI_TRACE_SGLANG_MODEL", "meta-llama/Llama-3.2-3B-Instruct")
3734
print(f"Loading sglang Engine with model={model} (attention_backend=flashinfer)")
3835
engine = Engine(
3936
model_path=model,
@@ -46,10 +43,15 @@ def main() -> None:
4643
)
4744

4845
prompts = ["The capital of France is"]
49-
sampling_params = {"temperature": 0.0, "max_new_tokens": 4, "top_k": 50, "top_p": 0.9}
46+
sampling_params = {
47+
"temperature": 0.0,
48+
"max_new_tokens": 4,
49+
"top_k": 50,
50+
"top_p": 0.9,
51+
}
5052
print("Running one inference pass…")
5153
outputs = engine.generate(prompts, sampling_params)
52-
for p, out in zip(prompts, outputs):
54+
for p, out in zip(prompts, outputs, strict=True):
5355
text = out.get("text") if isinstance(out, dict) else out
5456
print(f" prompt: {p!r}")
5557
print(f" output: {text!r}")

0 commit comments

Comments
 (0)