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

Generation Error with Ollama - Inconsistent Output Generation #1393

Open
juanjuanignacio opened this issue Aug 7, 2024 · 1 comment · Fixed by #1429
Open

Generation Error with Ollama - Inconsistent Output Generation #1393

juanjuanignacio opened this issue Aug 7, 2024 · 1 comment · Fixed by #1429
Labels
support A request for help setting things up

Comments

@juanjuanignacio
Copy link

juanjuanignacio commented Aug 7, 2024

Hi,

I'm experiencing issues while running GEMMA2 on Ollama. Specifically, I'm encountering the following problems:

Error on Message Generation:
Whenever a new chat is created, every message results in the error:

Error: Generation failed, in the back end

No output is generated,on the front end.

Inconsistent Message Handling:
After retrying the same message multiple times (ranging from 2 to 15 attempts), the message is eventually processed correctly and the output is displayed on the front end.

Server Responsiveness:
Despite the above issues, the server responds to every query.

Expected Behavior:
Messages should be processed and output generated on the first attempt without errors.

Additional Context:

Ollama Version: 0.3.3
GEMMA2:2b (I've tried others models and the problem is the same)
Operating System: CentOS

Relevant Logs:
error message:

    ERROR (537688): Generation failed
        err: {
          "type": "Error",
          "message": "Generation failed",
          "stack":
              Error: Generation failed
                  at Module.generateFromDefaultEndpoint (/chat-ui/src/lib/server/generateFromDefaultEndpoint.ts:23:9)
                  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                  at async generateTitle (/chat-ui/src/lib/server/textGeneration/title.ts:54:10)
                  at async Module.generateTitleForConversation (/chat-ui/src/lib/server/textGeneration/title.ts:17:19)

Its something with the title of the conversation but retrying the message finally the conversations name is changed too. And messages after conversations name is changed have the same problem, rarely it works at first attempt.

My env.local:

  MONGODB_URL="mongodb://localhost:27017"
  HF_TOKEN=Mytoken
  OPENAI_API_KEY="ollama"
  MODELS=`[
    {
        "name": "google/gemma-2-2b-it",
        "chatPromptTemplate": "{{#each messages}}{{#ifUser}}<start_of_turn>user\n{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<end_of_turn>\n<start_of_turn>model\n{{/ifUser}}{{#ifAssistant}}{{content}}<end_of_turn>\n{{/ifAssistant}}{{/each}}",
        "parameters": {
          "temperature": 0.1,
          "top_p": 0.95,
          "repetition_penalty": 1.2,
          "max_new_tokens": 2048,
          "stop": ["<end_of_turn>"]
        },
        "endpoints": [
          {
           "type": "ollama",
           "baseURL": "http://127.0.0.1:11434",
            "ollamaName" : "gemma2:2b"
          }
        ]
    },
  ]`
  
  USE_LOCAL_WEBSEARCH=true

Any assistance in resolving this issue would be greatly appreciated. Thank you!

@nsarrazin nsarrazin added the support A request for help setting things up label Aug 7, 2024
@juanjuanignacio juanjuanignacio changed the title Generation Error in GEMMA2 on Ollama - Inconsistent Output Generation Generation Error with Ollama - Inconsistent Output Generation Aug 7, 2024
@juanjuanignacio
Copy link
Author

juanjuanignacio commented Aug 7, 2024

Solution Found:
I managed to resolve the inconsistency in message generation by switching the model to use the OpenAI API as follows(Ollama supports Open AI API calls):

    {
      "name": "gemma2:2b",
      "chatPromptTemplate": "{{#each messages}}{{#ifUser}}<start_of_turn>user\n{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<end_of_turn>\n<start_of_turn>model\n{{/ifUser}}{{#ifAssistant}}{{content}}<end_of_turn>\n{{/ifAssistant}}{{/each}}",
      "parameters": {
        "temperature": 0.1,
        "top_p": 0.95,
        "repetition_penalty": 1.0,
        "max_new_tokens": 2048,
        "stop": ["<end_of_turn>", "<start_of_turn>"]
      },
      "endpoints": [
        {
          "type": "openai",
          "baseURL": "http://127.0.0.1:11434/v1",
          "model": "gemma2:2b"
        }
      ]
    }

Persistent Issue:
Despite this fix, I am still encountering the error Generation failed in the back end related to the titles of the conversations. The output is consistent and messages are printed correctly on the first attempt, but the conversation title never updates and remains as 'new chat'.

Any assistance in resolving the issue with the conversation titles would be greatly appreciated. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support A request for help setting things up
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants