发布

  • treat stop as stop sequences, not exact tokens (#442)

    frostbyte_neo 发布于 2023-08-30 15:53:42 +00:00

    The stop option to the generate API is a list of sequences that should cause generation to stop. Although these are commonly called "stop tokens", they do not necessarily correspond to LLM tokens (per the LLM's tokenizer). For example, if the caller sends a generate request with "stop":["\n"], then generation should stop on any token containing \n (and trim \n from the output), not just if the token exactly matches \n. If stop were interpreted strictly as LLM tokens, then it would require callers of the generate API to know the LLM's tokenizer and enumerate many tokens in the stop list.

    Fixes https://github.com/jmorganca/ollama/issues/295.

    下载附件