Pr 2374 ci branch (#2378)

* 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>
This commit is contained in:
drbh 2024-08-08 11:14:06 -04:00 committed by GitHub
parent a379d5536b
commit 82d19d7723
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -490,7 +490,12 @@ def get_model(
raise RuntimeError( raise RuntimeError(
"Sharding is currently not supported with `exl2` quantization" "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: if max_input_tokens is not None and max_input_tokens <= sliding_window:
sliding_window = -1 sliding_window = -1