Update quick start examples (#120)

This commit is contained in:
Lianmin Zheng
2024-01-30 04:29:32 -08:00
committed by GitHub
parent 4ea92f8307
commit 0617528632
20 changed files with 567 additions and 237 deletions

View File

@@ -651,7 +651,7 @@ class ProgramState:
def sync(self):
return self.stream_executor.sync()
def text_iter(self, var_name=None):
def text_iter(self, var_name: Optional[str] = None):
if self.stream_executor.stream:
prev = 0
if var_name is None:
@@ -682,7 +682,9 @@ class ProgramState:
else:
yield self.get_var(name)
async def text_async_iter(self, var_name=None, return_meta_data=False):
async def text_async_iter(
self, var_name: Optional[str] = None, return_meta_data: bool = False
):
loop = asyncio.get_running_loop()
if self.stream_executor.stream:

View File

@@ -74,7 +74,9 @@ class SglSamplingParams:
)
return {
"max_tokens_to_sample": self.max_new_tokens,
"stop_sequences": self.stop,
"stop_sequences": self.stop
if isinstance(self.stop, (list, tuple))
else [self.stop],
"temperature": self.temperature,
"top_p": self.top_p,
"top_k": self.top_k,