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.
This commit is contained in:
Praz 2024-08-08 13:50:02 +05:30 committed by GitHub
parent bd4b23d0ba
commit d7c5ef6cd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -492,13 +492,7 @@ def get_model(
)
sliding_window = config_dict.get("sliding_window", -1)
if max_input_tokens is None:
max_input_tokens = 1024 # Set a default value if not provided
if sliding_window is None:
sliding_window = 2048 # Set a default value if not provided
if max_input_tokens <= sliding_window:
if max_input_tokens is not None and (sliding_window is None or max_input_tokens <= sliding_window):
sliding_window = -1
if (