THUDM / ChatGLM2-6B

ChatGLM2-6B: An Open Bilingual Chat LLM | 开源双语对话语言模型
Other
15.68k stars 1.85k forks source link

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

Open gotcha001x opened 10 months ago

gotcha001x commented 10 months ago

Is there an existing issue for this?

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

huzixuan1 commented 10 months ago

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)

NightWalker4396 commented 9 months ago

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