Model: Remove Exllamav2 patches

These classes are in the newest version now.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-02-24 01:19:57 -05:00 committed by Brian Dashore
parent 73a1d9ef78
commit fc857893ee

View file

@ -1,19 +1,10 @@
import traceback import traceback
from exllamav2 import ExLlamaV2, ExLlamaV2Tokenizer from exllamav2 import ExLlamaV2, ExLlamaV2Tokenizer
from exllamav2.generator import ExLlamaV2Sampler from exllamav2.generator import ExLlamaV2Sampler
from exllamav2.generator.filters import ExLlamaV2Filter from exllamav2.generator.filters import ExLlamaV2Filter, ExLlamaV2PrefixFilter
from common.logger import init_logger 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__) logger = init_logger(__name__)
@ -73,15 +64,6 @@ class ExLlamaV2Grammar:
): ):
"""Adds an ExllamaV2 filter based on a JSON schema.""" """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 # Import optional dependencies
try: try:
from lmformatenforcer import JsonSchemaParser from lmformatenforcer import JsonSchemaParser
@ -129,15 +111,6 @@ class ExLlamaV2Grammar:
Possibly replace outlines with an in-house solution in the future. 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: try:
ebnf_filter = ExLlamaV2EbnfFilter(model, tokenizer, ebnf_string) ebnf_filter = ExLlamaV2EbnfFilter(model, tokenizer, ebnf_string)
except ImportError: except ImportError: