Skip to content

Commit

Permalink
Model: Remove Exllamav2 patches
Browse files Browse the repository at this point in the history
These classes are in the newest version now.

Signed-off-by: kingbri <[email protected]>
  • Loading branch information
bdashore3 committed Feb 24, 2024
1 parent 6696776 commit 48d7290
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions backends/exllamav2/grammar.py
Original file line number Diff line number Diff line change
@@ -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__)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 48d7290

Please sign in to comment.