ChatGLM2-6B icon indicating copy to clipboard operation
ChatGLM2-6B copied to clipboard

[BUG/Help] <title>运行web_demo.py报错

Open gotcha001x opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

部署环境:阿里云ECS

CPU&内存:12核(vCPU) 92 GiB

操作系统:Anolis OS 8.6 RHCK 64位

GPU: NVIDIA V100 只做了路径修改: tokenizer = AutoTokenizer.from_pretrained("/root/ChatGLM2-6B/chatglm2-6b", trust_remote_code=True) model = AutoModel.from_pretrained("/root/ChatGLM2-6B/chatglm2-6b", trust_remote_code=True).cuda()

运行web_demo.py报错 Loading checkpoint shards: 100%|███████████████████████████████████████████████| 7/7 [00:07<00:00, 1.10s/it] Traceback (most recent call last): File "web_demo.py", line 89, in user_input = gr.Textbox(show_label=False, placeholder="Input...", lines=10).style( AttributeError: 'Textbox' object has no attribute 'style'

运行其他一切正常

Expected Behavior

No response

Steps To Reproduce

yum install python38 -y git clone https://github.com/THUDM/ChatGLM2-6B pip3 install -r requirements.txt git clone https://huggingface.co/THUDM/chatglm2-6b vim web_demo.py python3 web_demo.py

Environment

- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :

Anything else?

No response

gotcha001x avatar Nov 03 '23 06:11 gotcha001x

I think you should the below code: Duplicate of # user_input = gr.Textbox(show_label=False, placeholder="Input...", lines=10).style( container=False) instead user_input = gr.Textbox(show_label=False, placeholder="Input...", lines=10)

huzixuan1 avatar Nov 05 '23 07:11 huzixuan1

AttributeError: 'Textbox' object has no attribute 'style'. Did you mean: 'scale' 当启动web_demo.py出现上面这个错误的时候,其实是gradio的问题,版本太高了。个人猜测可能是pip默认安装最新版本,新版本中api有变化,所以识别不了。

所以只需要卸载当前版本,安装旧版就好了哈。

pip uninstall gradio pip install gradio==3.39.0 ———————————————— 版权声明:本文为CSDN博主「WongVin」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/u013292152/article/details/134266634

NightWalker4396 avatar Nov 27 '23 07:11 NightWalker4396