[CI][RFC] Replace black-jupyter with ruff-format (#37210)

Co-authored-by: Alison Shao <a.shao@wustl.edu>
This commit is contained in:
Alex Nails
2026-09-02 19:46:08 -07:00
committed by GitHub
co-authored by Alison Shao
parent 2641e427be
commit 28262c20df
1411 changed files with 7766 additions and 8176 deletions
+9 -9
View File
@@ -129,9 +129,9 @@ class OpenAI(BaseBackend):
if key not in self.spec_kwargs:
self.spec_kwargs[key] = value
else:
assert (
value == self.spec_kwargs[key]
), "sampling parameters should be consistent if turn on api speculative execution."
assert value == self.spec_kwargs[key], (
"sampling parameters should be consistent if turn on api speculative execution."
)
self.spec_format.append(
{"text": "", "stop": params["stop"], "name": spec_var_name}
)
@@ -180,9 +180,9 @@ class OpenAI(BaseBackend):
)
# Keep the returned list (or string) as is.
elif sampling_params.dtype in [str, "str", "string"]:
assert (
not self.is_chat_model
), "constrained type not supported on chat model"
assert not self.is_chat_model, (
"constrained type not supported on chat model"
)
kwargs = sampling_params.to_openai_kwargs()
kwargs.pop("stop")
comp = openai_completion(
@@ -200,9 +200,9 @@ class OpenAI(BaseBackend):
else:
comp = '"' + comp + '"'
elif sampling_params.dtype in [int, "int"]:
assert (
not self.is_chat_model
), "constrained type not supported on chat model"
assert not self.is_chat_model, (
"constrained type not supported on chat model"
)
kwargs = sampling_params.to_openai_kwargs()
kwargs.pop("stop")
comp = openai_completion(
@@ -133,18 +133,14 @@ class RuntimeEndpoint(BaseBackend):
dtype_regex = None
if sampling_params.dtype in ["int", int]:
dtype_regex = REGEX_INT
sampling_params.stop.extend([" ", "\n"])
elif sampling_params.dtype in ["float", float]:
dtype_regex = REGEX_FLOAT
sampling_params.stop.extend([" ", "\n"])
elif sampling_params.dtype in ["str", str]:
dtype_regex = REGEX_STR
elif sampling_params.dtype in ["bool", bool]:
dtype_regex = REGEX_BOOL
else:
raise RuntimeError(f"Invalid dtype: {sampling_params.dtype}")
-4
View File
@@ -12,7 +12,6 @@ class ChoicesDecision:
class ChoicesSamplingMethod(ABC):
@property
def requires_unconditional_logprobs(self) -> bool:
return False
@@ -30,7 +29,6 @@ class ChoicesSamplingMethod(ABC):
class TokenLengthNormalized(ChoicesSamplingMethod):
def __call__(
self,
*,
@@ -54,7 +52,6 @@ token_length_normalized = TokenLengthNormalized()
class GreedyTokenSelection(ChoicesSamplingMethod):
def __call__(
self,
*,
@@ -108,7 +105,6 @@ greedy_token_selection = GreedyTokenSelection()
class UnconditionalLikelihoodNormalized(ChoicesSamplingMethod):
@property
def requires_unconditional_logprobs(self) -> bool:
return True
+3 -3
View File
@@ -624,9 +624,9 @@ class StreamExecutor:
self.meta_info[name] = meta_info
self.variable_event[name].set()
else:
assert (
self.num_api_spec_tokens is None
), "stream is not supported with api speculative execution"
assert self.num_api_spec_tokens is None, (
"stream is not supported with api speculative execution"
)
generator = self.backend.generate_stream(
self, sampling_params=sampling_params
)
-1
View File
@@ -531,7 +531,6 @@ class SglRoleEnd(SglExpr):
class SglSelect(SglExpr):
def __init__(
self,
name: str,