Skip to content

Commit

Permalink
Pr 2374 ci branch (#2378)
Browse files Browse the repository at this point in the history
* Update __init__.py

Fix issue with NoneType comparison for max_input_tokens and sliding_window

- Add default values for max_input_tokens and sliding_window to handle None cases.
- Ensure the comparison between max_input_tokens and sliding_window is handled correctly to prevent TypeError.
- This change addresses the error: TypeError: '<=' not supported between instances of 'int' and 'NoneType'.

* Update __init__.py

Handle NoneType in sliding_window comparison to fix TypeError in __init__.py by ensuring the comparison logic accounts for NoneType values, preventing errors and improving code robustness.

* fix: syntax/style tweak

---------

Co-authored-by: Praz <prazanth2006@gmail.com>
  • Loading branch information
drbh and praz88 authored Aug 8, 2024
1 parent a379d55 commit 82d19d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/text_generation_server/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,12 @@ def get_model(
raise RuntimeError(
"Sharding is currently not supported with `exl2` quantization"
)
sliding_window = config_dict.get("sliding_window", -1)

sliding_window = (
config_dict.get("sliding_window")
if config_dict.get("sliding_window") is not None
else -1
)

if max_input_tokens is not None and max_input_tokens <= sliding_window:
sliding_window = -1
Expand Down

0 comments on commit 82d19d7

Please sign in to comment.