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

最新update的代码中,web_demo推理时报错 #12

Open
feyxong opened this issue Apr 3, 2023 · 2 comments
Open

最新update的代码中,web_demo推理时报错 #12

feyxong opened this issue Apr 3, 2023 · 2 comments

Comments

@feyxong
Copy link

feyxong commented Apr 3, 2023

报错定位在modeling_chatglm:
hello

/opt/conda/lib/python3.7/site-packages/transformers/tokenization_utils_base.py:717: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at ../torch/csrc/utils/tensor_new.cpp:230.)
tensor = as_tensor(value)
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/gradio/routes.py", line 400, in run_predict
event_data=event_data,
File "/opt/conda/lib/python3.7/site-packages/gradio/blocks.py", line 1109, in process_api
fn_index, inputs, iterator, request, event_id, event_data
File "/opt/conda/lib/python3.7/site-packages/gradio/blocks.py", line 930, in call_function
utils.async_iteration, iterator, limiter=self.limiter
File "/opt/conda/lib/python3.7/site-packages/anyio/to_thread.py", line 32, in run_sync
func, *args, cancellable=cancellable, limiter=limiter
File "/opt/conda/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/opt/conda/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/opt/conda/lib/python3.7/site-packages/gradio/utils.py", line 490, in async_iteration
return next(iterator)
File "web_demo_belle.py", line 38, in predict
temperature=temperature):
File "/opt/conda/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 43, in generator_context
response = gen.send(None)
File "/mnt/workspace/InstructGLM/modeling_chatglm.py", line 1153, in stream_chat
for outputs in self.stream_generate(**input_ids, **gen_kwargs):
File "/opt/conda/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 43, in generator_context
response = gen.send(None)
File "/mnt/workspace/InstructGLM/modeling_chatglm.py", line 1264, in stream_generate
outputs, model_kwargs, is_encoder_decoder=self.config.is_encoder_decoder
File "/opt/conda/lib/python3.7/site-packages/transformers/generation/utils.py", line 721, in _update_model_kwargs_for_generation
[attention_mask, attention_mask.new_ones((attention_mask.shape[0], 1))], dim=-1
RuntimeError: Tensors must have same number of dimensions: got 4 and 2

@zongking123
Copy link

+1

@yanqiangmiffy
Copy link
Owner

yanqiangmiffy commented Apr 6, 2023

需要更新一下modeling_chatglm.py?

https://huggingface.co/THUDM/chatglm-6b/tree/main

这里有类似的问题:THUDM/ChatGLM-6B#374

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

3 participants