AttributeError in Gradio Web Server: 'list' object has no attribute 'text_models'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
## Description:
I followed the instructions to run the WebGUI service in single-model mode by launching the controller, model workers, and Gradio web server. However, when I opened the website, the Gradio web server triggered an error, and the website failed to render correctly.
## Error Message and Screenshot:
```
2024-10-22 21:45:16 | ERROR | stderr | Traceback (most recent call last):
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/miniconda3/envs/fastchat/lib/python3.10/site-packages/gradio/queueing.py", line 624, in process_events
2024-10-22 21:45:16 | ERROR | stderr | response = await route_utils.call_process_api(
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/miniconda3/envs/fastchat/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
2024-10-22 21:45:16 | ERROR | stderr | output = await app.get_blocks().process_api(
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/miniconda3/envs/fastchat/lib/python3.10/site-packages/gradio/blocks.py", line 2018, in process_api
2024-10-22 21:45:16 | ERROR | stderr | result = await self.call_function(
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/miniconda3/envs/fastchat/lib/python3.10/site-packages/gradio/blocks.py", line 1567, in call_function
2024-10-22 21:45:16 | ERROR | stderr | prediction = await anyio.to_thread.run_sync( # type: ignore
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/.local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
2024-10-22 21:45:16 | ERROR | stderr | return await get_async_backend().run_sync_in_worker_thread(
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
2024-10-22 21:45:16 | ERROR | stderr | return await future
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 851, in run
2024-10-22 21:45:16 | ERROR | stderr | result = context.run(func, *args)
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/miniconda3/envs/fastchat/lib/python3.10/site-packages/gradio/utils.py", line 846, in wrapper
2024-10-22 21:45:16 | ERROR | stderr | response = f(*args, **kwargs)
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/FastChat/fastchat/serve/gradio_web_server.py", line 263, in load_demo
2024-10-22 21:45:16 | ERROR | stderr | return load_demo_single(models, url_params)
2024-10-22 21:45:16 | ERROR | stderr | File "/home/patrickwu/FastChat/fastchat/serve/gradio_web_server.py", line 235, in load_demo_single
2024-10-22 21:45:16 | ERROR | stderr | models = context.text_models
2024-10-22 21:45:16 | ERROR | stderr | AttributeError: 'list' object has no attribute 'text_models'
```
## Potential Issue:
In the `load_demo` function, we're passing a list as the first argument to `load_demo_single(models, url_params)`. However, it appears that this argument should be a `Context` object, not a list. The error occurs because the list object doesn't have the `text_models` attribute, which causes the `AttributeError`.
## Steps to Reproduce:
1. Follow the instructions to install the package and run the WebGUI service in single-model mode.
2. Launch the controller, model workers, and Gradio web server.
3. Open the website and observe the error.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in fastchat/serve/gradio_web_server.py, especially load_demo and load_demo_single around the reported lines. Reproduce single-model mode by launching the controller, model worker, and Gradio web server, then inspect the value passed between these entry points. Done means the website renders in single-model mode without the reported AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100