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

View File

@ -492,7 +492,13 @@ def get_model(
) )
sliding_window = config_dict.get("sliding_window", -1) sliding_window = config_dict.get("sliding_window", -1)
if max_input_tokens is not None and max_input_tokens <= sliding_window: 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:
sliding_window = -1 sliding_window = -1
if ( if (