Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cannot change context in chat box #2730

@reidliu41

Description

@reidliu41

Describe the bug

$ ilab model chat
╭───────────────────────────────────────────── system ─────────────────────────────────────────────╮
│ Welcome to InstructLab Chat w/ GRANITE-7B-LAB-Q4_K_M.GGUF (type /h for help)                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
>>> /c cli_helper                                                                       [S][default]
Traceback (most recent call last):
  File "/Users/xx/src/xxx/instructlab/venv/bin/ilab", line 8, in <module>
    sys.exit(ilab())
             ^^^^^^
  File "/Users/xx/src/xxx/instructlab/venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/venv/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/src/instructlab/clickext.py", line 323, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/src/instructlab/model/chat.py", line 304, in chat
    chat_cli(
  File "/Users/xx/src/xxx/instructlab/src/instructlab/model/chat.py", line 867, in chat_cli
    ccb.start_prompt(logger)
  File "/Users/xx/src/xxx/instructlab/src/instructlab/model/chat.py", line 638, in start_prompt
    handler(content)
  File "/Users/xx/src/xxx/instructlab/src/instructlab/model/chat.py", line 470, in _handle_context
    sys_prompt = CONTEXTS.get(context, "default")(get_model_arch(self.model))
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/src/instructlab/utils.py", line 933, in get_model_arch
    if is_model_gguf(model_path):
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xx/src/xxx/instructlab/src/instructlab/utils.py", line 797, in is_model_gguf
    with model_path.open("rb") as f:
         ^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'open'

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Screenshots

Device Info (please complete the following information):

  • Hardware Specs: [e.g. Apple M2 Pro Chip, 16 GB Memory, etc.]
  • OS Version: [e.g. Mac OS 14.4.1, Fedora Linux 40]
  • Python Version: [output of python --version]
  • InstructLab Version: [output of ilab system info]

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions