oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.86k stars 5.34k forks source link

I got c4ai-command-r-v01 running after minor fixes #5897

Closed quartets closed 5 months ago

quartets commented 7 months ago

Describe the bug

When loading c4ai-command-r-v01, I encountered the follow error messages: AttributeError: 'list' object has no attribute 'replace' But when loading c4ai-command-r-v01-4bit, there had been no error.

Using Reka Core, it suggested me to make these changes, and it worked. modules\models_settings.py def get_model_metadata(model): model_settings = {}

# ...

if 'chat_template' in metadata:
    template = metadata['chat_template']
    if isinstance(template, list):
        template = template[0]['template'] if len(template) > 0 else ''
    elif not isinstance(template, str):
        template = ''

    # ...

# ...

modules\chat.py def chatbot_wrapper(text, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message, for_ui=for_ui): if text is None: return [] else: ...

Is there an existing issue for this?

Reproduction

load c4ai-command-r-v01 with --load-in-8bit or --load-in-4bit, the "AttributeError: 'list' object has no attribute 'replace'" occurs.

Screenshot

No response

Logs

Traceback (most recent call last):

File "/mnt/green/text-generation-webui/modules/ui_model_menu.py", line 245, in load_model_wrapper

shared.model, shared.tokenizer = load_model(selected_model, loader)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/green/text-generation-webui/modules/models.py", line 76, in load_model

metadata = get_model_metadata(model_name)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/green/text-generation-webui/modules/models_settings.py", line 122, in get_model_metadata

template = template.replace(k, "'{}'".format(value))

^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'replace'

System Info

Ubuntu 22.04 64bit
NVIDIA 40GB A100-SXM (NVIDIA-SMI 470.223.02   Driver Version: 470.223.02   CUDA Version: 11.4)
transformers 4.40.0
tokenizers 0.19.1
github-actions[bot] commented 5 months ago

This issue has been closed due to inactivity for 2 months. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.