Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG/Help] <ptuning成功后,运行web_demo.py,输入promts后后台抛异常> #458

Closed
1 task done
StarRanger opened this issue Apr 8, 2023 · 1 comment
Closed
1 task done

Comments

@StarRanger
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

ptuning成功后,运行web_demo.py,输入promts后后台抛异常。

Expected Behavior

No response

Steps To Reproduce

  1. 运行ptuning文件夹下的bash trains.sh成功,数据集是自己准备的中文数据集。
  2. 将web_demo.py下面的ChatGLM-6B,替换称为ptuning下面最新的checkpoint路径,启动也成功。
  3. 在输入框输入原本数据集中就存在的prompts后,后端服务日志抛异常如下:
    This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
    Traceback (most recent call last):
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/gradio/routes.py", line 393, in run_predict
    output = await app.get_blocks().process_api(
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/gradio/blocks.py", line 1108, in process_api
    result = await self.call_function(
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/gradio/blocks.py", line 929, in call_function
    prediction = await anyio.to_thread.run_sync(
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/gradio/utils.py", line 490, in async_iteration
    return next(iterator)
    File "/root/llm/ChatGLM-6B-main/web_demo.py", line 63, in predict
    for response, history in model.stream_chat(tokenizer, input, history, max_length=max_length, top_p=top_p,
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 35, in generator_context
    response = gen.send(None)
    File "/root/.cache/huggingface/modules/transformers_modules/checkpoint-3000/modeling_chatglm.py", line 1281, in stream_chat
    for outputs in self.stream_generate(**inputs, **gen_kwargs):
    File "/root/.conda/envs/python39/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 35, in generator_context
    response = gen.send(None)
    File "/root/.cache/huggingface/modules/transformers_modules/checkpoint-3000/modeling_chatglm.py", line 1356, in stream_generate
    model_inputs = self.prepare_inputs_for_generation(input_ids, **model_kwargs)
    File "/root/.cache/huggingface/modules/transformers_modules/checkpoint-3000/modeling_chatglm.py", line 1091, in prepare_inputs_for_generation
    mask_positions = [seq.index(mask_token) for seq in seqs]
    File "/root/.cache/huggingface/modules/transformers_modules/checkpoint-3000/modeling_chatglm.py", line 1091, in
    mask_positions = [seq.index(mask_token) for seq in seqs]
    ValueError: 130000 is not in list

这是否还需要加载原本chatglm-6b的那几个.bin文件啊?

Environment

- OS:Centos 7.6
- Python:3.9
- Transformers:4.28.0
- PyTorch:2.0.0+cu117
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) : True

Anything else?

No response

@duzx16
Copy link
Member

duzx16 commented Apr 8, 2023

Duplicate of #457

@duzx16 duzx16 marked this as a duplicate of #457 Apr 8, 2023
@duzx16 duzx16 closed this as completed Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants