From e9157f617610a294b0065ddc67d7953df1415596 Mon Sep 17 00:00:00 2001 From: Scott Lundberg Date: Wed, 29 Nov 2023 23:37:19 +0000 Subject: [PATCH] Fix #481, remove token limit --- guidance/__init__.py | 2 +- guidance/models/_model.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/guidance/__init__.py b/guidance/__init__.py index 5a28a48c5..a1af2edfa 100644 --- a/guidance/__init__.py +++ b/guidance/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.4" +__version__ = "0.1.5" import nest_asyncio nest_asyncio.apply() diff --git a/guidance/models/_model.py b/guidance/models/_model.py index 4cb897224..c8b17901b 100644 --- a/guidance/models/_model.py +++ b/guidance/models/_model.py @@ -375,7 +375,7 @@ def tool_def(self, functions): return self - def _run_stateless(lm, stateless_function, max_tokens=1000, temperature=0.0, top_p=1.0, n=1): + def _run_stateless(lm, stateless_function, temperature=0.0, top_p=1.0, n=1): assert Model._grammar_only == 0, "We can't run grammar parsing while in context free mode! (for example inside a block closer)" logger.debug("start Model._run_stateless") @@ -389,10 +389,7 @@ def _run_stateless(lm, stateless_function, max_tokens=1000, temperature=0.0, top replacements = replace_model_variables(stateless_function, lm) # start the generation stream - gen_obj = lm( - grammar=stateless_function, max_tokens=max_tokens, n=n, - temperature=temperature, top_p=top_p - ) + gen_obj = lm(grammar=stateless_function, n=n, temperature=temperature, top_p=top_p) # single generation if n == 1: @@ -539,7 +536,7 @@ def _cleanup_tokens(self, token_ids, token_byte_positions): return token_ids, token_byte_positions - def __call__(self, grammar, max_tokens=100, n=1, top_p=1, temperature=0.0, ensure_bos_token=True, log_probs=False): + def __call__(self, grammar, max_tokens=1000000, n=1, top_p=1, temperature=0.0, ensure_bos_token=True, log_probs=False): assert n == 1, "Still need to add support for n > 1!" # get our current context in bytes