Skip to content

Commit

Permalink
Upgrade outlines to 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aW3st committed Oct 16, 2024
1 parent a6a0c97 commit 721442d
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 93 deletions.
172 changes: 83 additions & 89 deletions server/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ peft = { version = "^0.10", optional = true }
torch = { version = "^2.4.0", optional = true }
scipy = "^1.11.1"
pillow = "^10.0.0"
outlines= { version = "^0.0.34", optional = true }
outlines= { version = "^0.1.1", optional = true }
prometheus-client = "^0.20.0"
py-cpuinfo = "^9.0.0"
# Remove later, temporary workaround for outlines.
Expand Down
6 changes: 3 additions & 3 deletions server/text_generation_server/utils/logits_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Dict, Union
from text_generation_server.pb.generate_pb2 import GrammarType

from outlines.fsm.fsm import RegexFSM
from outlines.fsm.guide import RegexGuide
from outlines.fsm.json_schema import build_regex_from_schema
from functools import lru_cache
from typing import List, Optional, DefaultDict
Expand Down Expand Up @@ -482,7 +482,7 @@ def filter(self, indices):

class GrammarLogitProcessor(LogitsProcessor):
fsm_state: DefaultDict[int, int]
fsm: RegexFSM
fsm: RegexGuide

def __init__(self, tokenizer, device, grammar, grammar_type):
self.device = device
Expand Down Expand Up @@ -530,7 +530,7 @@ def _cached_compile_fsm(grammar_type, schema, tokenizer):
schema = "(.*?)"
elif grammar_type == GrammarType.GRAMMAR_TYPE_REGEX:
pass # schema is already a regex just here for clarity
fsm = RegexFSM(schema, tokenizer)
fsm = RegexGuide.from_regex(schema, tokenizer)
logger.debug(f"Compiled FSM in {time.time() - start_time:.2f}s")
return fsm

Expand Down

0 comments on commit 721442d

Please sign in to comment.