Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
russellb committed Dec 2, 2024
1 parent 5da9100 commit 1b6e5f6
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.
import copy
import json
import time
from collections import defaultdict
from functools import lru_cache
from typing import Callable, DefaultDict, Dict, List, Union
Expand All @@ -27,6 +28,9 @@
from outlines.fsm.json_schema import build_regex_from_schema
from pydantic import BaseModel
from transformers import PreTrainedTokenizerBase
from vllm.logger import init_logger

logger = init_logger(__name__)


class BaseLogitsProcessor:
Expand Down Expand Up @@ -97,7 +101,12 @@ class RegexLogitsProcessor(BaseLogitsProcessor):
def _get_guide(cls, regex_string: str,
tokenizer: PreTrainedTokenizerBase) -> Guide:
tokenizer = _adapt_tokenizer(tokenizer)
return RegexGuide.from_regex(regex_string, tokenizer)
start_time = time.time()
guide = RegexGuide.from_regex(regex_string, tokenizer)
end_time = time.time()
elapsed_time_ms = (end_time - start_time) * 1000
logger.info(f"from_regex() took {elapsed_time_ms:.2f} milliseconds")

Check failure on line 108 in vllm/model_executor/guided_decoding/outlines_logits_processors.py

View workflow job for this annotation

GitHub Actions / ruff (3.12)

Ruff (G004)

vllm/model_executor/guided_decoding/outlines_logits_processors.py:108:21: G004 Logging statement uses f-string
return guide

def __init__(self, regex_string: str, tokenizer: PreTrainedTokenizerBase):
"""Compile the FSM that drives the regex-structured generation.
Expand Down

0 comments on commit 1b6e5f6

Please sign in to comment.