ParisNeo / lollms-webui

Lord of Large Language Models Web User Interface
https://parisneo.github.io/lollms-webui/
Apache License 2.0
4.11k stars 522 forks source link

(Solved, not implemented yet) Windows 11, exllama, cpu_mode: positional argument errors on some personalities due to outdated generator. Please re-generate #480

Closed ba2512005 closed 5 months ago

ba2512005 commented 6 months ago

Expected Behavior

Personalities should work as intended. Get's stuck in warming up on the UI screen and the server outputs error message below.

Current Behavior

Some personalities fail on the workflow execution.

Workflow run failed. Error:Processor.run_workflow() takes from 2 to 4 positional arguments but 5 were given Traceback (most recent call last): File "C:\Users\ba251\lollms-webui\scripts\windows\lollms-webui\lollms_webui.py", line 1262, in generate self.personality.processor.run_workflow( prompt, full_prompt, callback, context_details) TypeError: Processor.run_workflow() takes from 2 to 4 positional arguments but 5 were given

Steps to Reproduce

Load lord of internet personality on windows with exllamav2 binding using cpu mode.

Possible Solution

Seems like there's a positional argument issue where it's expecting 2-4 arguments but 5 were given, the function declaration and the calling function are different. The generator used for creating this personality is older than the one calling it, having a mismatch of argument types. When debugging, it points to the generator instead of the generated code. after some digging I found the solution

Edit: see comments below on fix.

Context

Personalities that search the internet. Using Windows 11, CPU mode, exllama binding

Screenshots

There is no error on the UI portion. Not sure if it's enabling it or not

ba2512005 commented 6 months ago

Also similar error for multiple personalities (Lord of Internet / wikipedia and others that use Processor.run_workflow() )

Traceback (most recent call last): File "C:\Users\ba251\lollms-webui\scripts\windows\lollms-webui\lollms_webui.py", line 1262, in generate self.personality.processor.run_workflow( prompt, full_prompt, callback, context_details) TypeError: Processor.run_workflow() takes from 2 to 4 positional arguments but 5 were given

Workflow run failed. Error:Processor.run_workflow() takes from 2 to 4 positional arguments but 5 were given Traceback (most recent call last): File "C:\Users\ba251\lollms-webui\scripts\windows\lollms-webui\lollms_webui.py", line 1262, in generate self.personality.processor.run_workflow( prompt, full_prompt, callback, context_details) TypeError: Processor.run_workflow() takes from 2 to 4 positional arguments but 5 were given

Workflow run failed Error:Processor.run_workflow() takes from 2 to 4 positional arguments but 5 were given --> Exception from personality:Workflow run failed Error:Processor.run_workflow() takes from 2 to 4 positional arguments but 5 were given Finished executing the workflow

This modified decode function seems to make it work somewhat:

def decode(self, ids, decode_special_tokens = False):
    # if ids.is_list:
    #     return [self.decode(ids, decode_special_tokens) for ids in ids]
    if type(ids) == torch.Tensor:
        if ids.dim() > 1:

            texts = []
            for i in range(ids.shape[0]):
                seq = ids[i].tolist()
                texts.append(self.decode_(seq, decode_special_tokens))
            return texts

        else:

            ids = ids.tolist()
            text = self.decode_(ids, decode_special_tokens)
            return text
    elif type(ids) == list:
            texts = []
            for id in ids:
                texts.append(self.decode(id, decode_special_tokens))
            return texts

Created pull request in exllamav2: https://github.com/turboderp/exllamav2/pull/296

ba2512005 commented 6 months ago

Additionally it seems some personalities are based on older generation code and need to be re-created and cleaned up.

I made it work by modifying the def run_workflow definition in the file: zoos/personality_zoo/internet//processor.py

from: def run_workflow(self, prompt, previous_discussion_text="", callback=None):

to:

def run_workflow(self, prompt: str, previous_discussion_text: str = "", callback: Callable[[str, MSG_TYPE, dict, list], bool] = None, context_details: dict = None):

and importing:

from typing import Callable

ba2512005 commented 6 months ago

@ParisNeo I just looked through the code and found 3 that need to be changed: Thinking_methodologies/tree_of_thoughts (which you already did)

Additionally: Thinking_methodologies/chain_of_thoughts data/database_maker data/text2bulletpoints

ParisNeo commented 6 months ago

Thanks I'll fix them now

ParisNeo commented 6 months ago

Well got distracted by something else and didn't do it. I'll try tomorrow if i find the Time

ba2512005 commented 5 months ago

personalities updated