Skip to content

Commit 3533829

Browse files
committed
[CI] bump mypy version to 1.16.0
Signed-off-by: Andy Xie <andy.xning@gmail.com>
1 parent caa680f commit 3533829

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ repos:
5858
entry: tools/mypy.sh 0 "local"
5959
language: python
6060
types: [python]
61-
additional_dependencies: &mypy_deps [mypy==1.11.1, types-cachetools, types-setuptools, types-PyYAML, types-requests, pydantic]
61+
additional_dependencies: &mypy_deps [mypy==1.16.0, types-cachetools,
62+
types-setuptools, types-PyYAML, types-requests, pydantic]
6263
stages: [pre-commit] # Don't run in CI
6364
- id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
6465
name: Run mypy for Python 3.9

vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ def extract_tool_calls_streaming(
237237
return delta
238238

239239
try:
240-
241240
current_tool_call = partial_json_parser.loads(
242241
tool_call_portion or "{}",
243242
flags) if tool_call_portion else None
@@ -252,7 +251,7 @@ def extract_tool_calls_streaming(
252251
# case - we haven't sent the tool name yet. If it's available, send
253252
# it. otherwise, wait until it's available.
254253
if not self.current_tool_name_sent:
255-
if (current_tool_call is None):
254+
if current_tool_call is None:
256255
return None
257256
function_name: Union[str, None] = current_tool_call.get("name")
258257
if function_name:
@@ -292,6 +291,8 @@ def extract_tool_calls_streaming(
292291
# JSON to the current partially-parsed JSON
293292
prev_arguments = (
294293
self.prev_tool_call_arr[self.current_tool_id].get("arguments"))
294+
if current_tool_call is None:
295+
return None
295296
cur_arguments = current_tool_call.get("arguments")
296297

297298
logger.debug("diffing old arguments: %s", prev_arguments)
@@ -359,9 +360,13 @@ def extract_tool_calls_streaming(
359360
# handle saving the state for the current tool into
360361
# the "prev" list for use in diffing for the next iteration
361362
if self.current_tool_id == len(self.prev_tool_call_arr) - 1:
363+
if current_tool_call is None:
364+
return None
362365
self.prev_tool_call_arr[self.current_tool_id] = \
363366
current_tool_call
364367
else:
368+
if current_tool_call is None:
369+
return None
365370
self.prev_tool_call_arr.append(current_tool_call)
366371

367372
return delta

vllm/sampling_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,8 @@ def update_from_generation_config(
489489
if eos_ids:
490490
self._all_stop_token_ids.update(eos_ids)
491491
if not self.ignore_eos:
492-
eos_ids.update(self.stop_token_ids)
492+
if self.stop_token_ids is not None:
493+
eos_ids.update(self.stop_token_ids)
493494
self.stop_token_ids = list(eos_ids)
494495

495496
def update_from_tokenizer(self, tokenizer: AnyTokenizer) -> None:

0 commit comments

Comments
 (0)