Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with KeyError due to missing key in states_to_token_maps #605

Closed
viktor-ferenczi opened this issue Feb 3, 2024 · 7 comments · Fixed by #628
Closed

Crash with KeyError due to missing key in states_to_token_maps #605

viktor-ferenczi opened this issue Feb 3, 2024 · 7 comments · Fixed by #628
Labels

Comments

@viktor-ferenczi
Copy link

viktor-ferenczi commented Feb 3, 2024

Describe the issue as clearly as possible:

The states_to_token_maps generated in RegexFSM.__init__ is wrong for this specific regex. It is 100% reproducible.

Notice that no key 9 exists in the FSM, which causes it to crash during generation with a KeyError.

regex_string = '```\n(Program\\.cs\n)?```\n'

self.states_to_token_maps = {
 0: {63: 1, 4686: 2, 10252: 3},
 1: {63: 2, 4686: 3},
 2: {63: 3},
 3: {185: 4},
 4: {47: 5, 63: 6, 1426: 11, 4686: 7, 5959: 10, 10252: 8, 16097: 15},
 5: {81: 10, 295: 11, 12483: 12},
 6: {63: 7, 4686: 8},
 7: {63: 8},
 8: {185: 9},
 10: {78: 11, 493: 12, 18596: 15},
 11: {70: 12, 877: 13, 1644: 15, 16795: 14},
 12: {81: 13, 401: 14, 3477: 15},
 13: {64: 14, 302: 15},
 14: {76: 15},
 15: {13: 16},
 16: {66: 17, 5494: 18},
 17: {82: 18},
 18: {185: 19},
 19: {63: 6, 4686: 7, 10252: 8},
}

Steps/code to reproduce the bug:

Use the regex as a constraint on a prompt like:

Please list the all the filenames from the code block below in the same order.
Write your answer as a code block. Do not explain, do not apologize.
Write only the code block and nothing else.

Program.cs

Expected result:

Program.cs

Error message:

Exception while running such a query with vLLM 0.3.0 serving, but the actual problem does not depend on vLLM at all:

INFO:     192.168.1.70:61435 - "POST /generate HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/engine/async_llm_engine.py", line 29, in _raise_exception_on_finish
    task.result()
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/engine/async_llm_engine.py", line 409, in run_engine_loop
    has_requests_in_progress = await self.engine_step()
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/engine/async_llm_engine.py", line 388, in engine_step
    request_outputs = await self.engine.step_async()
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/engine/async_llm_engine.py", line 189, in step_async
    all_outputs = await self._run_workers_async(
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/engine/async_llm_engine.py", line 276, in _run_workers_async
    all_outputs = await asyncio.gather(*coros)
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/worker/worker.py", line 213, in execute_model
    output = self.model_runner.execute_model(seq_group_metadata_list,
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/worker/model_runner.py", line 542, in execute_model
    output = self.model.sample(
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/model_executor/models/llama.py", line 314, in sample
    next_tokens = self.sampler(self.lm_head.weight, hidden_states,
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/viktor/env/outlines/lib/python3.10/site-packages/vllm/model_executor/layers/sampler.py", line 74, in forward
    logits = _apply_logits_processors(logits, sampling_metadata)
  File "/home/viktor/dep/outlines-contrib/outlines/serve/vllm.py", line 35, in _patched_apply_logits_processors
    logits_row = logits_processor(token_ids, logits_row)
  File "/home/viktor/dep/outlines-contrib/outlines/serve/vllm.py", line 140, in __call__
    state = self.fsm.get_state_by_token_ids(tuple(input_ids))
  File "/home/viktor/dep/outlines-contrib/outlines/serve/vllm.py", line 93, in get_state_by_token_ids
    new_state = self.next_state(prev_state, last_token)
  File "/home/viktor/dep/outlines-contrib/outlines/fsm/fsm.py", line 178, in next_state
    last_token_to_end_state = self.states_to_token_maps[state]
KeyError: 9

Outlines/Python version information:

Version information

``` Package Version ------------------------- ---------- aiohttp 3.9.1 aiosignal 1.3.1 annotated-types 0.6.0 anyio 4.2.0 async-timeout 4.0.3 attrs 23.1.0 certifi 2023.11.17 charset-normalizer 3.3.2 cloudpickle 3.0.0 colorama 0.4.6 coverage 7.4.0 diskcache 5.6.3 distro 1.8.0 exceptiongroup 1.2.0 filelock 3.13.1 frozenlist 1.4.1 fsspec 2023.12.2 h11 0.14.0 httpcore 1.0.2 httpx 0.25.2 huggingface-hub 0.20.2 idna 3.6 interegular 0.3.3 Jinja2 3.1.3 joblib 1.3.2 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 lark 1.1.9 llvmlite 0.42.0 lxml 5.0.0 MarkupSafe 2.1.3 mpmath 1.3.0 multidict 6.0.4 nest-asyncio 1.6.0 networkx 3.2.1 numba 0.59.0 numpy 1.26.2 openai 1.5.0 outlines 0.0.25 packaging 23.2 pip 23.3.2 protobuf 4.25.1 pydantic 2.5.2 pydantic_core 2.14.5 PyYAML 6.0.1 referencing 0.33.0 regex 2023.10.3 requests 2.31.0 rpds-py 0.17.1 safetensors 0.4.1 scipy 1.12.0 sentencepiece 0.1.99 setuptools 68.2.0 sniffio 1.3.0 sympy 1.12 tokenizers 0.15.0 toml 0.10.2 torch 2.2.0 tqdm 4.66.1 transformers 4.36.2 typing_extensions 4.9.0 urllib3 2.1.0 vllm-client 0.2.7.2 wheel 0.41.2 yarl 1.9.4 ```

Context for the issue:

I've just started using constrained generation with vLLM based on outlines.serve.vllm. Found this issue while working on #539, but this issue is unrelated to the vLLM adapter, therefore created this new ticket.

@viktor-ferenczi
Copy link
Author

viktor-ferenczi commented Feb 3, 2024

Minimal reproduction with a separate script, which produces the same situation as my vLLM run:

from pprint import pprint

import interegular
from outlines.fsm.regex import make_deterministic_fsm, create_fsm_index_tokenizer

from transformers import AutoTokenizer

DEEPSEEK_CODER_TOKENIZER = AutoTokenizer.from_pretrained('TheBloke/deepseek-coder-1.3b-base-AWQ')
DEEPSEEK_CODER_TOKENIZER.vocabulary = DEEPSEEK_CODER_TOKENIZER.vocab
DEEPSEEK_CODER_TOKENIZER.special_tokens = DEEPSEEK_CODER_TOKENIZER.special_tokens_map
DEEPSEEK_CODER_TOKENIZER.convert_token_to_string = lambda x: DEEPSEEK_CODER_TOKENIZER.convert_tokens_to_string([x])

regex_string = '```\n(Program\\.cs\n)?```\n'
regex_pattern = interegular.parse_pattern(regex_string)
regex_fsm, _ = make_deterministic_fsm(regex_pattern.to_fsm().reduce())
states_to_token_maps, empty_token_ids = create_fsm_index_tokenizer(regex_fsm, DEEPSEEK_CODER_TOKENIZER)

pprint(states_to_token_maps)

Output:

{0: {63: 1, 4686: 2, 10252: 3},
 1: {63: 2, 4686: 3},
 2: {63: 3},
 3: {185: 4},
 4: {47: 5, 63: 6, 1426: 11, 4686: 7, 5959: 10, 10252: 8, 16097: 15},
 5: {81: 10, 295: 11, 12483: 12},
 6: {63: 7, 4686: 8},
 7: {63: 8},
 8: {185: 9},
 10: {78: 11, 493: 12, 18596: 15},
 11: {70: 12, 877: 13, 1644: 15, 16795: 14},
 12: {81: 13, 401: 14, 3477: 15},
 13: {64: 14, 302: 15},
 14: {76: 15},
 15: {13: 16},
 16: {66: 17, 5494: 18},
 17: {82: 18},
 18: {185: 19},
 19: {63: 6, 4686: 7, 10252: 8}}

Notice the missing key: 9

Exact same result if I write the regex like this:

regex_string = r'```\n(Program\.cs\n)?```\n'

@viktor-ferenczi
Copy link
Author

viktor-ferenczi commented Feb 3, 2024

Analysis:

In create_fsm_index_tokenizer:

fsm.fsm_info.finals = {9}

states_to_token_subsets has no key 9

In create_fsm_index_end_to_end inside the while next_states: when start_state == 9 the state_scan_tokens function returns an empty set into token_ids_end_states, which causes the for loop below to be skipped and the 9 key is not stored at all into states_to_token_subsets (not even with an empty set value).

Also, it turns out we need the code in create_fsm_index_tokenizer to add the terminals, state 9 here is such an example.

viktor-ferenczi added a commit to viktor-ferenczi/outlines that referenced this issue Feb 3, 2024
viktor-ferenczi added a commit to viktor-ferenczi/outlines that referenced this issue Feb 4, 2024
@viktor-ferenczi viktor-ferenczi changed the title Missing key in states_to_token_maps for a specific regex Crash with KeyError due to missing key in states_to_token_maps Feb 4, 2024
viktor-ferenczi added a commit to viktor-ferenczi/outlines that referenced this issue Feb 4, 2024
@viktor-ferenczi
Copy link
Author

After fixing this issue (PR #606 branch) it works much more stable.

But now I see an unrelated issue with long/complex regex constraints. It looks like vLLM is just running out of memory and crashes outlines as a side-effect (victim).

Added a new ticket anyway: #610

viktor-ferenczi added a commit to viktor-ferenczi/outlines that referenced this issue Feb 5, 2024
viktor-ferenczi added a commit to viktor-ferenczi/outlines that referenced this issue Feb 5, 2024
viktor-ferenczi added a commit to viktor-ferenczi/outlines that referenced this issue Feb 5, 2024
…viktor-ferenczi/issue-605

Fixed test_regex to expect the final state

This test case fails now, which is expected until the fix is applied.

Regression test case

It reproduces the case where state 5 is missing from the generated `fsm.states_to_token_maps`.
viktor-ferenczi added a commit to viktor-ferenczi/outlines that referenced this issue Feb 5, 2024
…viktor-ferenczi/issue-605

Fixed test_regex to expect the final state

This test case fails now, which is expected until the fix is applied.

Regression test case

It reproduces the case where state 5 is missing from the generated `fsm.states_to_token_maps`.
@rlouf
Copy link
Member

rlouf commented Feb 6, 2024

If 9 is in the final states of the FSM it is expected that it wouldn't be present in states_to_tokens_map, since that's the definition of a final state. What I don't understand is why this is not solved by the code in this function, which is supposed to output an EOS token when a final state has been reached.

@viktor-ferenczi
Copy link
Author

Why do we special-case final states? They can map to the EOS token naturally.

Also, will we ever have more than a single final state?

@rlouf
Copy link
Member

rlouf commented Feb 12, 2024

Why do we special-case final states? They can map to the EOS token naturally.

We don't special-case them, final states do not transition to anything else by definition.

Also, will we ever have more than a single final state?

Yes:

import interegular

regex_str = "(a|b|c)"
print(interegular.parse_pattern(regex_str).to_fsm())
#   name final? a b c anything_else 
# ----------------------------------
# ,* 0    False  1 2 3               
#   1    True                       
#   2    True                       
#   3    True                       

rlouf pushed a commit that referenced this issue Feb 14, 2024
For `outlines/vllm` previously FSM-sequence correspondence was broken,
resulting FSM state being mixed between sequences, corrupting output. To
alleviate this, we have `_patched_apply_logits_processor` which passes a
stable sequence ID to the logits processor.

In this PR we eliminate `_patched_apply_logits_processor` and cache FSM
state based on the states input IDs.

Continuation of #539 but
much simpler because vllm upgrade fixed a lot of the issues being
addressed there.

Related discussions:
- #624

Fixes:
- Fixes #605 
- Fixes #610

Already fixed:
- #524 (this one can be
closed, as it's was addressed previously by upgrading vllm)


@viktor-ferenczi can you please confirm whether this branch fixes either
#610 or
#605

# Smoke tests

### basic parallel

passed

<details>

```
import json
import vllm
from pydantic import BaseModel
from typing import List
import torch
import pandas as pd
from outlines.serve.vllm import JSONLogitsProcessor

class ConceptsList(BaseModel):
    concepts: List[str]

BASE_MODEL = "microsoft/phi-2"
llm = vllm.LLM(model=BASE_MODEL, tensor_parallel_size=1, dtype=torch.float16, max_model_len=2048)

logits_processor = JSONLogitsProcessor(ConceptsList, llm.llm_engine)

full_prompts = [
    f"Provide me a list of {i} strings with key 'concepts'"
    for i in range(20)
]

batch_results = llm.generate(
    full_prompts,
    sampling_params=vllm.SamplingParams(
        max_tokens=2048, logits_processors=[logits_processor]
    ),
)


for result in batch_results:
    for output in result.outputs:
            json.loads(output.text)
```

</details>


### never ending regex

passed

<details>

`python3 -m outlines.serve.serve --model="microsoft/phi-2"`

```
curl http://127.0.0.1:8000/generate \
    -d '{
        "prompt": "Sequence of numbers and letters:",
        "regex": "([123]-[abc]-([def]-)?)*",
        "n": 7
}'
{"text":["Sequence of numbers and letters:1-a-1-b-1-c-1-a-","Sequence of numbers and letters:1-a-2-b-3-c-1-a-","Sequence of numbers and letters:1-a-2-b-3-c-d-1-","Sequence of numbers and letters:2-a-1-b-2-c-1-b-","Sequence of numbers and letters:2-b-3-c-d-2-b-3-","Sequence of numbers and letters:2-a-3-b-2-b-1-c-","Sequence of numbers and letters:2-a-3-b-d-2-a-3-"]}


# rules for the above to validate correct FSM-sequence correspondence:
# [123] always followed by [abc], [def] only ever preceded by [abc]

# 1-a-1-b-1-c-1-a-
# 1-a-2-b-3-c-1-a-
# 1-a-2-b-3-c-d-1-
# 2-a-1-b-2-c-1-b-
# 2-b-3-c-d-2-b-3-
# 2-a-3-b-2-b-1-c-
# 2-a-3-b-d-2-a-3-
```

</details>


### sometimes ending early regex

passed

<details>

`python3 -m outlines.serve.serve --model="microsoft/phi-2"`

```
curl http://127.0.0.1:8000/generate \
    -d '{
        "prompt": "Sequence of numbers and letters:",
        "regex": "([123]-[abc]-([def]-)?){3}",
        "n": 16
}'
```

output

```
{"text":["Sequence of numbers and letters:1-a-2-b-3-c-d-","Sequence of numbers and letters:1-a-2-b-3-c-d-","Sequence of numbers and letters:1-a-2-b-3-c-d-","Sequence of numbers and letters:1-a-2-b-3-c-d-","Sequence of numbers and letters:1-a-2-b-3-c-d-","Sequence of numbers and letters:3-a-1-b-2-c-d-","Sequence of numbers and letters:2-a-1-b-3-c-d-","Sequence of numbers and letters:1-a-1-b-1-c-d-","Sequence of numbers and letters:2-a-3-b-d-1-c-e-","Sequence of numbers and letters:1-b-3-a-2-c-d-","Sequence of numbers and letters:3-a-d-1-b-e-2-c-","Sequence of numbers and letters:1-a-3-b-1-b-d-","Sequence of numbers and letters:3-a-f-2-b-d-1-c-","Sequence of numbers and letters:1-b-d-3-a-e-2-c-","Sequence of numbers and letters:3-c-1-b-d-1-a-e-","Sequence of numbers and letters:1-c-1-c-e-1-b-e-"]}
```

analysis:

```
1-a-2-b-3-c-d-
1-a-2-b-3-c-d-
1-a-2-b-3-c-d-
1-a-2-b-3-c-d-
1-a-2-b-3-c-d-
1-a-2-b-3-c-d-
3-a-1-b-2-c-d-
2-a-1-b-3-c-d-
1-a-1-b-1-c-d-
2-a-3-b-d-1-c-e-
1-b-3-a-2-c-d-
3-a-d-1-b-e-2-c-
1-a-3-b-1-b-d-
3-a-f-2-b-d-1-c-
1-b-d-3-a-e-2-c-
3-c-1-b-d-1-a-e-
1-c-1-c-e-1-b-e-
```

Observations:
- All patterns are correct
- Patterns don't "borrow" FSM state from one-another, they retain their
own independent state
- Some patterns produced more tokens than others successfully


</details>

### Viktor's regex

passed

<details>

`python3 -m outlines.serve.serve --model="microsoft/phi-2"`

```
curl http://127.0.0.1:8000/generate \
    -d '{
  "prompt": "You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite down the first 10 prime numbers as a comma separated list, starting with 2.\n\n### Response:\n",
  "n": 1,
  "best_of": 1,
  "presence_penalty": 0.0,
  "frequency_penalty": 0.0,
  "repetition_penalty": 1.0,
  "temperature": 0.0,
  "top_p": 1.0,
  "top_k": -1,
  "min_p": 0.0,
  "use_beam_search": false,
  "length_penalty": 1.0,
  "early_stopping": false,
  "stop": [],
  "stop_token_ids": [],
  "include_stop_str_in_output": false,
  "ignore_eos": false,
  "max_tokens": 50,
  "logprobs": null,
  "prompt_logprobs": null,
  "skip_special_tokens": true,
  "spaces_between_special_tokens": true,
  "regex": "\\d+(\\s*,\\s*\\d+)*\\s*"
}'
```

output:

```
{"text":["You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite down the first 10 prime numbers as a comma separated list, starting with 2.\n\n### Response:\n2, 3, 5, 7, 11, 13, 17, 19, 23, 29\n"]}
```

</details>

### Viktors schema

passed

<details>

`python3 -m outlines.serve.serve --model="microsoft/phi-2"`

```
curl http://127.0.0.1:8000/generate \
    -d '{
  "prompt": "You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite a JSON describing a random fruit. It must conform to the following JSON schema: {\"properties\": {\"kind\": {\"title\": \"Kind\", \"type\": \"string\"}, \"color\": {\"title\": \"Color\", \"type\": \"string\"}, \"count\": {\"title\": \"Count\", \"type\": \"integer\"}, \"weight\": {\"title\": \"Weight\", \"type\": \"number\"}, \"sweet\": {\"title\": \"Sweet\", \"type\": \"boolean\"}}, \"required\": [\"kind\", \"color\", \"count\", \"weight\", \"sweet\"], \"title\": \"Fruit\", \"type\": \"object\"}\n\n### Response:\n",
  "n": 5,
  "best_of": 5,
  "presence_penalty": 0.0,
  "frequency_penalty": 0.0,
  "repetition_penalty": 1.0,
  "temperature": 1.0,
  "top_p": 1.0,
  "top_k": -1,
  "min_p": 0.0,
  "use_beam_search": false,
  "length_penalty": 1.0,
  "early_stopping": false,
  "stop": [],
  "stop_token_ids": [],
  "include_stop_str_in_output": false,
  "ignore_eos": false,
  "max_tokens": 200,
  "logprobs": null,
  "prompt_logprobs": null,
  "skip_special_tokens": true,
  "spaces_between_special_tokens": true,
  "schema": {
    "properties": {
      "kind": {
        "title": "Kind",
        "type": "string"
      },
      "color": {
        "title": "Color",
        "type": "string"
      },
      "count": {
        "title": "Count",
        "type": "integer"
      },
      "weight": {
        "title": "Weight",
        "type": "number"
      },
      "sweet": {
        "title": "Sweet",
        "type": "boolean"
      }
    },
    "required": [
      "kind",
      "color",
      "count",
      "weight",
      "sweet"
    ],
    "title": "Fruit",
    "type": "object"
  }
}'
```

output:

```
{"text":["You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite a JSON describing a random fruit. It must conform to the following JSON schema: {\"properties\": {\"kind\": {\"title\": \"Kind\", \"type\": \"string\"}, \"color\": {\"title\": \"Color\", \"type\": \"string\"}, \"count\": {\"title\": \"Count\", \"type\": \"integer\"}, \"weight\": {\"title\": \"Weight\", \"type\": \"number\"}, \"sweet\": {\"title\": \"Sweet\", \"type\": \"boolean\"}}, \"required\": [\"kind\", \"color\", \"count\", \"weight\", \"sweet\"], \"title\": \"Fruit\", \"type\": \"object\"}\n\n### Response:\n{\n\"kind\": \"Apple\",\n\"color\": \"Red\",\n\"count\": 10,\n\"weight\": 0.2,\n\"sweet\": true\n}","You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite a JSON describing a random fruit. It must conform to the following JSON schema: {\"properties\": {\"kind\": {\"title\": \"Kind\", \"type\": \"string\"}, \"color\": {\"title\": \"Color\", \"type\": \"string\"}, \"count\": {\"title\": \"Count\", \"type\": \"integer\"}, \"weight\": {\"title\": \"Weight\", \"type\": \"number\"}, \"sweet\": {\"title\": \"Sweet\", \"type\": \"boolean\"}}, \"required\": [\"kind\", \"color\", \"count\", \"weight\", \"sweet\"], \"title\": \"Fruit\", \"type\": \"object\"}\n\n### Response:\n{\n    \"kind\": \"Apple\",\n    \"color\": \"Red\",\n    \"count\": 10,\n    \"weight\": 0.2,\n    \"sweet\": true\n}","You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite a JSON describing a random fruit. It must conform to the following JSON schema: {\"properties\": {\"kind\": {\"title\": \"Kind\", \"type\": \"string\"}, \"color\": {\"title\": \"Color\", \"type\": \"string\"}, \"count\": {\"title\": \"Count\", \"type\": \"integer\"}, \"weight\": {\"title\": \"Weight\", \"type\": \"number\"}, \"sweet\": {\"title\": \"Sweet\", \"type\": \"boolean\"}}, \"required\": [\"kind\", \"color\", \"count\", \"weight\", \"sweet\"], \"title\": \"Fruit\", \"type\": \"object\"}\n\n### Response:\n{\n  \"kind\": \"apple\",\n  \"color\": \"red\",\n  \"count\": 5,\n  \"weight\": 0.1,\n  \"sweet\": true\n}","You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite a JSON describing a random fruit. It must conform to the following JSON schema: {\"properties\": {\"kind\": {\"title\": \"Kind\", \"type\": \"string\"}, \"color\": {\"title\": \"Color\", \"type\": \"string\"}, \"count\": {\"title\": \"Count\", \"type\": \"integer\"}, \"weight\": {\"title\": \"Weight\", \"type\": \"number\"}, \"sweet\": {\"title\": \"Sweet\", \"type\": \"boolean\"}}, \"required\": [\"kind\", \"color\", \"count\", \"weight\", \"sweet\"], \"title\": \"Fruit\", \"type\": \"object\"}\n\n### Response:\n{\n\"kind\": \"Apple\",\n\"color\": \"Red\",\n\"count\": 10,\n\"weight\": 0.24,\n\"sweet\": true\n}","You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n\nYou are a helpful AI assistant. You give concise answers. If you do not know something, then say so.\n### Instruction:\nWrite a JSON describing a random fruit. It must conform to the following JSON schema: {\"properties\": {\"kind\": {\"title\": \"Kind\", \"type\": \"string\"}, \"color\": {\"title\": \"Color\", \"type\": \"string\"}, \"count\": {\"title\": \"Count\", \"type\": \"integer\"}, \"weight\": {\"title\": \"Weight\", \"type\": \"number\"}, \"sweet\": {\"title\": \"Sweet\", \"type\": \"boolean\"}}, \"required\": [\"kind\", \"color\", \"count\", \"weight\", \"sweet\"], \"title\": \"Fruit\", \"type\": \"object\"}\n\n### Response:\n{\n  \"kind\": \"Apple\",\n  \"color\": \"red\",\n  \"count\": 5,\n  \"weight\": 0.3,\n  \"sweet\": true\n}"]}
```

</details>

---------

Co-authored-by: Andrew Lapp <[email protected]>
rlouf added a commit that referenced this issue Mar 6, 2024
A recent change replaced the set of FSM final states with the state -1
that is used to represent an EOS token being generated. This could
explain the issue reported in #605.
rlouf added a commit that referenced this issue Mar 6, 2024
A recent change replaced the set of FSM final states with the state -1
that is used to represent an EOS token being generated. This could
explain the issue reported in #605.
rlouf added a commit that referenced this issue Mar 7, 2024
A recent change replaced the set of FSM final states with the state -1
that is used to represent an EOS token being generated. This could
explain the issue reported in #605.
@rlouf
Copy link
Member

rlouf commented Mar 7, 2024

Should be fixed by #734. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants