diff --git a/backends/exllamav2/grammar.py b/backends/exllamav2/grammar.py index df2ba8ce..3834c5ff 100644 --- a/backends/exllamav2/grammar.py +++ b/backends/exllamav2/grammar.py @@ -1,19 +1,10 @@ import traceback from exllamav2 import ExLlamaV2, ExLlamaV2Tokenizer from exllamav2.generator import ExLlamaV2Sampler -from exllamav2.generator.filters import ExLlamaV2Filter +from exllamav2.generator.filters import ExLlamaV2Filter, ExLlamaV2PrefixFilter from common.logger import init_logger -# TODO: Remove after new exllama version is released -try: - from exllamav2.generator.filters import ExLlamaV2PrefixFilter - - _exllama_filter_available = True -except ImportError: - _exllama_filter_available = False - - logger = init_logger(__name__) @@ -73,15 +64,6 @@ def add_json_schema_filter( ): """Adds an ExllamaV2 filter based on a JSON schema.""" - if not _exllama_filter_available: - logger.warning( - "ExllamaV2PrefixFilter is not available " - "in the currently installed ExllamaV2 version. " - "Skipping JSON schema parsing." - ) - - return - # Import optional dependencies try: from lmformatenforcer import JsonSchemaParser @@ -129,15 +111,6 @@ def add_ebnf_filter( Possibly replace outlines with an in-house solution in the future. """ - if not _exllama_filter_available: - logger.warning( - "filter_prefer_eos is not available " - "in the currently installed ExllamaV2 version. " - "Skipping EBNF parsing." - ) - - return - try: ebnf_filter = ExLlamaV2EbnfFilter(model, tokenizer, ebnf_string) except ImportError: