chat-ui icon indicating copy to clipboard operation
chat-ui copied to clipboard

Errors when trying to run local model

Open Diotrihhi opened this issue 3 years ago • 8 comments

I tried 3 models with https://github.com/huggingface And also with API from oobabooga

Every time I will get the same error:

...

addIssue: [Function (anonymous)], addIssues: [Function (anonymous)], errors: [ { code: 'invalid_type', expected: 'string', received: 'undefined', path: [Array], message: 'Required' }, { code: 'invalid_type', expected: 'string', received: 'undefined', path: [Array], message: 'Required' }, { validation: 'url', code: 'invalid_string', message: 'Invalid url', path: [Array] }, { code: 'invalid_type', expected: 'object', received: 'undefined', path: [Array], message: 'Required' } ] }

Diotrihhi avatar May 13 '23 03:05 Diotrihhi

Can you give the value of your MODELS environment variable?

coyotte508 avatar May 13 '23 07:05 coyotte508

Can you give the value of your MODELS environment variable?

Can you please give me some examples? I'm not sure what exactly you mean. Thanks.

Diotrihhi avatar May 13 '23 10:05 Diotrihhi

How are you changing the models?

# 'name', 'userMessageToken', 'assistantMessageToken' are required
MODELS=`[
  {
    "name": "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
    "datasetName": "OpenAssistant/oasst1",
    "description": "A good alternative to ChatGPT",
    "websiteUrl": "https://open-assistant.io",
    "userMessageToken": "<|prompter|>",
    "assistantMessageToken": "<|assistant|>",
    "messageEndToken": "</s>",
    "preprompt": "Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful.\n-----\n",
    "promptExamples": [
      {
        "title": "Write an email from bullet list",
        "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
      }, {
        "title": "Code a snake game",
        "prompt": "Code a basic snake game in python, give explanations for each step."
      }, {
        "title": "Assist in a task",
        "prompt": "How do I make a delicious lemon cheesecake?"
      }
    ],
    "parameters": {
      "temperature": 0.9,
      "top_p": 0.95,
      "repetition_penalty": 1.2,
      "top_k": 50,
      "truncate": 1000,
      "max_new_tokens": 1024
    }
  }
]`

What are you replacing this with?

coyotte508 avatar May 13 '23 14:05 coyotte508

How are you changing the models?

# 'name', 'userMessageToken', 'assistantMessageToken' are required
MODELS=`[
  {
    "name": "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
    "datasetName": "OpenAssistant/oasst1",
    "description": "A good alternative to ChatGPT",
    "websiteUrl": "https://open-assistant.io",
    "userMessageToken": "<|prompter|>",
    "assistantMessageToken": "<|assistant|>",
    "messageEndToken": "</s>",
    "preprompt": "Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful.\n-----\n",
    "promptExamples": [
      {
        "title": "Write an email from bullet list",
        "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
      }, {
        "title": "Code a snake game",
        "prompt": "Code a basic snake game in python, give explanations for each step."
      }, {
        "title": "Assist in a task",
        "prompt": "How do I make a delicious lemon cheesecake?"
      }
    ],
    "parameters": {
      "temperature": 0.9,
      "top_p": 0.95,
      "repetition_penalty": 1.2,
      "top_k": 50,
      "truncate": 1000,
      "max_new_tokens": 1024
    }
  }
]`

What are you replacing this with?

I replaced only .env.local with this (as described in the readme): MODELS=[{"name": "mymodel", "endpoints": [{"url": "127.0.0.1:8080/generate_stream"}]}]

Diotrihhi avatar May 13 '23 20:05 Diotrihhi

I am getting the same error. Running a local model that works using inference text generation:

curl 127.0.0.1:3000/generate -X POST -d '{"inputs":"What is Deep Learning?"," parameters":{"max_new_tokens":17}}' -H 'Content-Type: application/json'

{"generated_text":"\nDeep Learning is a subset of machine learning that focuses on artificial neural networks with multiple"}

However when using chat-ui with .env.local and using:

MODELS=[{"name": "...", "endpoints": [{"url": "127.0.0.1:3000/generate"}]}]

get:

Internal server error: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      0,
      "userMessageToken"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      0,
      "assistantMessageToken"
    ],
    "message": "Required"
  },
  {
    "validation": "url",
    "code": "invalid_string",
    "message": "Invalid url",
    "path": [
      0,
      "endpoints",
      0,
      "url"
    ]
  }
]

Adding userMessageToken and assistantMessageToken fixed the top two errors, but the URL config seems wrong, still getting error for URL:

Internal server error: [
  {
    "validation": "url",
    "code": "invalid_string",
    "message": "Invalid url",
    "path": [
      0,
      "endpoints",
      0,
      "url"
    ]
  }
]

syn-ack-ai avatar May 13 '23 21:05 syn-ack-ai

You need to add http:// in the url at the beginning.

Edit: updated README: https://github.com/huggingface/chat-ui#running-local-inference

coyotte508 avatar May 13 '23 21:05 coyotte508

You need to add http:// in the url at the beginning.

Edit: updated README: https://github.com/huggingface/chat-ui#running-local-inference

That fixed it... suspected that was it, but...

syn-ack-ai avatar May 13 '23 21:05 syn-ack-ai

yes, that was our bad :)

coyotte508 avatar May 13 '23 21:05 coyotte508